mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Add -force-overwrite flag to publish update, switch, snapshot and repo commands. #90
Includes new and updated system tests.
This commit is contained in:
@@ -132,8 +132,8 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
|
||||
|
||||
forceOverwrite := context.flags.Lookup("force-overwrite").Value.Get().(bool)
|
||||
if forceOverwrite {
|
||||
context.Progress().Printf("WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing " +
|
||||
"the same package pool.")
|
||||
context.Progress().ColoredPrintf("@rWARNING@|: force overwrite mode enabled, aptly might corrupt other published repositories sharing " +
|
||||
"the same package pool.\n")
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite)
|
||||
|
||||
@@ -81,8 +81,8 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
|
||||
|
||||
forceOverwrite := context.flags.Lookup("force-overwrite").Value.Get().(bool)
|
||||
if forceOverwrite {
|
||||
context.Progress().Printf("WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing " +
|
||||
"the same package pool.")
|
||||
context.Progress().ColoredPrintf("@rWARNING@|: force overwrite mode enabled, aptly might corrupt other published repositories sharing " +
|
||||
"the same package pool.\n")
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite)
|
||||
|
||||
@@ -50,8 +50,8 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
|
||||
|
||||
forceOverwrite := context.flags.Lookup("force-overwrite").Value.Get().(bool)
|
||||
if forceOverwrite {
|
||||
context.Progress().Printf("WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing " +
|
||||
"the same package pool.")
|
||||
context.Progress().ColoredPrintf("@rWARNING@|: force overwrite mode enabled, aptly might corrupt other published repositories sharing " +
|
||||
"the same package pool.\n")
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite)
|
||||
|
||||
12
system/t06_publish/PublishRepo25Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishRepo25Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
0
system/t06_publish/PublishRepo25Test_file
Normal file
0
system/t06_publish/PublishRepo25Test_file
Normal file
15
system/t06_publish/PublishRepo25Test_gold
Normal file
15
system/t06_publish/PublishRepo25Test_gold
Normal file
@@ -0,0 +1,15 @@
|
||||
WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing the same package pool.
|
||||
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
Signing file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
|
||||
Local repo local-repo2 has been successfully published.
|
||||
Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing.
|
||||
Now you can add following line to apt sources:
|
||||
deb http://your-server/ squeeze main
|
||||
deb-src http://your-server/ squeeze main
|
||||
Don't forget to add your GPG key to apt with apt-key.
|
||||
|
||||
You can also use `aptly serve` to publish your repositories over HTTP quickly.
|
||||
12
system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
3
system/t06_publish/PublishSnapshot33Test_gold
Normal file
3
system/t06_publish/PublishSnapshot33Test_gold
Normal file
@@ -0,0 +1,3 @@
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
ERROR: unable to publish: unable to process packages: error linking file to ${HOME}/.aptly/public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz: file already exists and is different
|
||||
12
system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
0
system/t06_publish/PublishSnapshot34Test_file
Normal file
0
system/t06_publish/PublishSnapshot34Test_file
Normal file
15
system/t06_publish/PublishSnapshot34Test_gold
Normal file
15
system/t06_publish/PublishSnapshot34Test_gold
Normal file
@@ -0,0 +1,15 @@
|
||||
WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing the same package pool.
|
||||
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
Signing file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
|
||||
Snapshot snap2 has been successfully published.
|
||||
Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing.
|
||||
Now you can add following line to apt sources:
|
||||
deb http://your-server/ squeeze main
|
||||
deb-src http://your-server/ squeeze main
|
||||
Don't forget to add your GPG key to apt with apt-key.
|
||||
|
||||
You can also use `aptly serve` to publish your repositories over HTTP quickly.
|
||||
12
system/t06_publish/PublishSwitch10Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishSwitch10Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
3
system/t06_publish/PublishSwitch10Test_gold
Normal file
3
system/t06_publish/PublishSwitch10Test_gold
Normal file
@@ -0,0 +1,3 @@
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
ERROR: unable to publish: unable to process packages: error linking file to ${HOME}/.aptly/public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz: file already exists and is different
|
||||
12
system/t06_publish/PublishSwitch11Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishSwitch11Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
0
system/t06_publish/PublishSwitch11Test_file
Normal file
0
system/t06_publish/PublishSwitch11Test_file
Normal file
9
system/t06_publish/PublishSwitch11Test_gold
Normal file
9
system/t06_publish/PublishSwitch11Test_gold
Normal file
@@ -0,0 +1,9 @@
|
||||
WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing the same package pool.
|
||||
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
Signing file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
Cleaning up prefix "." components main...
|
||||
|
||||
Publish for snapshot ./maverick [i386, source] publishes {main: [snap2]: Snapshot from local repo [local-repo2]} has been successfully switched to new snapshot.
|
||||
12
system/t06_publish/PublishUpdate10Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishUpdate10Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
0
system/t06_publish/PublishUpdate10Test_file
Normal file
0
system/t06_publish/PublishUpdate10Test_file
Normal file
9
system/t06_publish/PublishUpdate10Test_gold
Normal file
9
system/t06_publish/PublishUpdate10Test_gold
Normal file
@@ -0,0 +1,9 @@
|
||||
WARNING: force overwrite mode enabled, aptly might corrupt other published repositories sharing the same package pool.
|
||||
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
Signing file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
|
||||
Cleaning up prefix "." components main...
|
||||
|
||||
Publish for local repo ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated.
|
||||
12
system/t06_publish/PublishUpdate9Test/pyspi_0.6.1-1.5.dsc
Normal file
12
system/t06_publish/PublishUpdate9Test/pyspi_0.6.1-1.5.dsc
Normal file
@@ -0,0 +1,12 @@
|
||||
Format: 1.0
|
||||
Source: pyspi
|
||||
Binary: python-at-spi
|
||||
Architecture: any
|
||||
Version: 0.6.1-1.5
|
||||
Maintainer: Jose Carlos Garcia Sogo <jsogo@debian.org>
|
||||
Homepage: http://people.redhat.com/zcerza/dogtail
|
||||
Standards-Version: 3.7.3
|
||||
Vcs-Svn: svn://svn.tribulaciones.org/srv/svn/pyspi/trunk
|
||||
Build-Depends: debhelper (>= 5), cdbs, libatspi-dev, python-pyrex, python-support (>= 0.4), python-all-dev, libx11-dev
|
||||
Files:
|
||||
d41d8cd98f00b204e9800998ecf8427e 0 pyspi_0.6.1.orig.tar.gz
|
||||
3
system/t06_publish/PublishUpdate9Test_gold
Normal file
3
system/t06_publish/PublishUpdate9Test_gold
Normal file
@@ -0,0 +1,3 @@
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
ERROR: unable to publish: unable to process packages: error linking file to ${HOME}/.aptly/public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz: file already exists and is different
|
||||
@@ -564,3 +564,23 @@ class PublishRepo24Test(BaseTest):
|
||||
runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze local-repo2"
|
||||
expectedCode = 1
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
|
||||
class PublishRepo25Test(BaseTest):
|
||||
"""
|
||||
publish repo: -force-overwrite
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo1",
|
||||
"aptly repo add local-repo1 ${files}",
|
||||
"aptly repo create local-repo2",
|
||||
"aptly repo add local-repo2 ${testfiles}",
|
||||
"aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo1",
|
||||
]
|
||||
runCmd = "aptly publish repo -force-overwrite -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze local-repo2"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
super(PublishRepo25Test, self).check()
|
||||
|
||||
self.check_file_contents("public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz", "file")
|
||||
|
||||
@@ -782,3 +782,43 @@ class PublishSnapshot32Test(BaseTest):
|
||||
runCmd = "aptly publish snapshot -component=main,contrib snap32.1"
|
||||
expectedCode = 2
|
||||
outputMatchPrepare = lambda _, s: "\n".join([l for l in s.split("\n") if l.startswith("ERROR")])
|
||||
|
||||
|
||||
class PublishSnapshot33Test(BaseTest):
|
||||
"""
|
||||
publish snapshot: conflicting files in the snapshot
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo1",
|
||||
"aptly repo add local-repo1 ${files}",
|
||||
"aptly snapshot create snap1 from repo local-repo1",
|
||||
"aptly repo create local-repo2",
|
||||
"aptly repo add local-repo2 ${testfiles}",
|
||||
"aptly snapshot create snap2 from repo local-repo2",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap1",
|
||||
]
|
||||
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap2"
|
||||
expectedCode = 1
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
|
||||
class PublishSnapshot34Test(BaseTest):
|
||||
"""
|
||||
publish snapshot: -force-overwrite
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo1",
|
||||
"aptly repo add local-repo1 ${files}",
|
||||
"aptly snapshot create snap1 from repo local-repo1",
|
||||
"aptly repo create local-repo2",
|
||||
"aptly repo add local-repo2 ${testfiles}",
|
||||
"aptly snapshot create snap2 from repo local-repo2",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap1",
|
||||
]
|
||||
runCmd = "aptly publish snapshot -force-overwrite -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze snap2"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
super(PublishSnapshot34Test, self).check()
|
||||
|
||||
self.check_file_contents("public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz", "file")
|
||||
|
||||
@@ -347,3 +347,44 @@ class PublishSwitch9Test(BaseTest):
|
||||
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -component=a,b maverick snap2"
|
||||
expectedCode = 2
|
||||
outputMatchPrepare = lambda _, s: "\n".join([l for l in s.split("\n") if l.startswith("ERROR")])
|
||||
|
||||
|
||||
class PublishSwitch10Test(BaseTest):
|
||||
"""
|
||||
publish switch: conflicting files in the snapshot
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo1",
|
||||
"aptly repo add local-repo1 ${files}",
|
||||
"aptly snapshot create snap1 from repo local-repo1",
|
||||
"aptly repo create local-repo2",
|
||||
"aptly repo add local-repo2 ${testfiles}",
|
||||
"aptly snapshot create snap2 from repo local-repo2",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap1",
|
||||
]
|
||||
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick snap2"
|
||||
expectedCode = 1
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
|
||||
class PublishSwitch11Test(BaseTest):
|
||||
"""
|
||||
publish switch: -force-overwrite
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo1",
|
||||
"aptly repo add local-repo1 ${files}",
|
||||
"aptly snapshot create snap1 from repo local-repo1",
|
||||
"aptly repo create local-repo2",
|
||||
"aptly repo add local-repo2 ${testfiles}",
|
||||
"aptly snapshot create snap2 from repo local-repo2",
|
||||
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap1",
|
||||
]
|
||||
runCmd = "aptly publish switch -force-overwrite -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick snap2"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
super(PublishSwitch11Test, self).check()
|
||||
|
||||
self.check_file_contents("public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz", "file")
|
||||
|
||||
|
||||
@@ -273,3 +273,39 @@ class PublishUpdate8Test(BaseTest):
|
||||
]
|
||||
runCmd = "aptly publish update -skip-signing squeeze"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
|
||||
class PublishUpdate9Test(BaseTest):
|
||||
"""
|
||||
publish update: conflicting files in the repo
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo",
|
||||
"aptly repo add local-repo ${files}",
|
||||
"aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo",
|
||||
"aptly repo remove local-repo Name",
|
||||
"aptly repo add local-repo ${testfiles}",
|
||||
]
|
||||
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
|
||||
expectedCode = 1
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
|
||||
class PublishUpdate10Test(BaseTest):
|
||||
"""
|
||||
publish update: -force-overwrite
|
||||
"""
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo",
|
||||
"aptly repo add local-repo ${files}",
|
||||
"aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo",
|
||||
"aptly repo remove local-repo Name",
|
||||
"aptly repo add local-repo ${testfiles}",
|
||||
]
|
||||
runCmd = "aptly publish update -force-overwrite -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
super(PublishUpdate10Test, self).check()
|
||||
|
||||
self.check_file_contents("public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz", "file")
|
||||
|
||||
Reference in New Issue
Block a user