Add -force-overwrite flag to publish update, switch, snapshot and repo commands. #90

Includes new and updated system tests.
This commit is contained in:
Andrey Smirnov
2014-08-05 17:01:18 +04:00
parent fe879acf9c
commit bb6593d21e
32 changed files with 284 additions and 6 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View 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

View 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.

View 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

View 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

View 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

View 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.

View 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

View 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

View 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

View 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.

View 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

View 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.

View 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

View 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

View File

@@ -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")

View 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")

View 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")

View 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")