From bb6593d21e46278dcc8339d5d5bf653b56b56328 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 5 Aug 2014 17:01:18 +0400 Subject: [PATCH] Add -force-overwrite flag to publish update, switch, snapshot and repo commands. #90 Includes new and updated system tests. --- cmd/publish_snapshot.go | 4 +- cmd/publish_switch.go | 4 +- cmd/publish_update.go | 4 +- .../PublishRepo25Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../PublishRepo25Test/pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishRepo25Test_file | 0 system/t06_publish/PublishRepo25Test_gold | 15 +++++++ .../PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishSnapshot33Test_gold | 3 ++ .../PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishSnapshot34Test_file | 0 system/t06_publish/PublishSnapshot34Test_gold | 15 +++++++ .../PublishSwitch10Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishSwitch10Test_gold | 3 ++ .../PublishSwitch11Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishSwitch11Test_file | 0 system/t06_publish/PublishSwitch11Test_gold | 9 ++++ .../PublishUpdate10Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishUpdate10Test_file | 0 system/t06_publish/PublishUpdate10Test_gold | 9 ++++ .../PublishUpdate9Test/pyspi_0.6.1-1.5.dsc | 12 ++++++ .../pyspi_0.6.1.orig.tar.gz | 0 system/t06_publish/PublishUpdate9Test_gold | 3 ++ system/t06_publish/repo.py | 20 +++++++++ system/t06_publish/snapshot.py | 40 ++++++++++++++++++ system/t06_publish/switch.py | 41 +++++++++++++++++++ system/t06_publish/update.py | 36 ++++++++++++++++ 32 files changed, 284 insertions(+), 6 deletions(-) create mode 100644 system/t06_publish/PublishRepo25Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishRepo25Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishRepo25Test_file create mode 100644 system/t06_publish/PublishRepo25Test_gold create mode 100644 system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishSnapshot33Test_gold create mode 100644 system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishSnapshot34Test_file create mode 100644 system/t06_publish/PublishSnapshot34Test_gold create mode 100644 system/t06_publish/PublishSwitch10Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishSwitch10Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishSwitch10Test_gold create mode 100644 system/t06_publish/PublishSwitch11Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishSwitch11Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishSwitch11Test_file create mode 100644 system/t06_publish/PublishSwitch11Test_gold create mode 100644 system/t06_publish/PublishUpdate10Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishUpdate10Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishUpdate10Test_file create mode 100644 system/t06_publish/PublishUpdate10Test_gold create mode 100644 system/t06_publish/PublishUpdate9Test/pyspi_0.6.1-1.5.dsc create mode 100644 system/t06_publish/PublishUpdate9Test/pyspi_0.6.1.orig.tar.gz create mode 100644 system/t06_publish/PublishUpdate9Test_gold diff --git a/cmd/publish_snapshot.go b/cmd/publish_snapshot.go index c63032fc..f02f96aa 100644 --- a/cmd/publish_snapshot.go +++ b/cmd/publish_snapshot.go @@ -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) diff --git a/cmd/publish_switch.go b/cmd/publish_switch.go index 1669ee1a..ed4dddcb 100644 --- a/cmd/publish_switch.go +++ b/cmd/publish_switch.go @@ -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) diff --git a/cmd/publish_update.go b/cmd/publish_update.go index 0a0bf9f0..0833d136 100644 --- a/cmd/publish_update.go +++ b/cmd/publish_update.go @@ -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) diff --git a/system/t06_publish/PublishRepo25Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishRepo25Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishRepo25Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishRepo25Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishRepo25Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishRepo25Test_file b/system/t06_publish/PublishRepo25Test_file new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishRepo25Test_gold b/system/t06_publish/PublishRepo25Test_gold new file mode 100644 index 00000000..63326118 --- /dev/null +++ b/system/t06_publish/PublishRepo25Test_gold @@ -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. diff --git a/system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishSnapshot33Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishSnapshot33Test_gold b/system/t06_publish/PublishSnapshot33Test_gold new file mode 100644 index 00000000..8279ee7d --- /dev/null +++ b/system/t06_publish/PublishSnapshot33Test_gold @@ -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 diff --git a/system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishSnapshot34Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishSnapshot34Test_file b/system/t06_publish/PublishSnapshot34Test_file new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishSnapshot34Test_gold b/system/t06_publish/PublishSnapshot34Test_gold new file mode 100644 index 00000000..2a851c89 --- /dev/null +++ b/system/t06_publish/PublishSnapshot34Test_gold @@ -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. diff --git a/system/t06_publish/PublishSwitch10Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishSwitch10Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishSwitch10Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishSwitch10Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishSwitch10Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishSwitch10Test_gold b/system/t06_publish/PublishSwitch10Test_gold new file mode 100644 index 00000000..8279ee7d --- /dev/null +++ b/system/t06_publish/PublishSwitch10Test_gold @@ -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 diff --git a/system/t06_publish/PublishSwitch11Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishSwitch11Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishSwitch11Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishSwitch11Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishSwitch11Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishSwitch11Test_file b/system/t06_publish/PublishSwitch11Test_file new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishSwitch11Test_gold b/system/t06_publish/PublishSwitch11Test_gold new file mode 100644 index 00000000..038992dd --- /dev/null +++ b/system/t06_publish/PublishSwitch11Test_gold @@ -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. diff --git a/system/t06_publish/PublishUpdate10Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishUpdate10Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishUpdate10Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishUpdate10Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishUpdate10Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishUpdate10Test_file b/system/t06_publish/PublishUpdate10Test_file new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishUpdate10Test_gold b/system/t06_publish/PublishUpdate10Test_gold new file mode 100644 index 00000000..f13cb098 --- /dev/null +++ b/system/t06_publish/PublishUpdate10Test_gold @@ -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. diff --git a/system/t06_publish/PublishUpdate9Test/pyspi_0.6.1-1.5.dsc b/system/t06_publish/PublishUpdate9Test/pyspi_0.6.1-1.5.dsc new file mode 100644 index 00000000..0a47f42f --- /dev/null +++ b/system/t06_publish/PublishUpdate9Test/pyspi_0.6.1-1.5.dsc @@ -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 +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 diff --git a/system/t06_publish/PublishUpdate9Test/pyspi_0.6.1.orig.tar.gz b/system/t06_publish/PublishUpdate9Test/pyspi_0.6.1.orig.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/system/t06_publish/PublishUpdate9Test_gold b/system/t06_publish/PublishUpdate9Test_gold new file mode 100644 index 00000000..8279ee7d --- /dev/null +++ b/system/t06_publish/PublishUpdate9Test_gold @@ -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 diff --git a/system/t06_publish/repo.py b/system/t06_publish/repo.py index 2a4d5fa5..e9f7df3b 100644 --- a/system/t06_publish/repo.py +++ b/system/t06_publish/repo.py @@ -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") diff --git a/system/t06_publish/snapshot.py b/system/t06_publish/snapshot.py index 19e45e91..10d26b36 100644 --- a/system/t06_publish/snapshot.py +++ b/system/t06_publish/snapshot.py @@ -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") diff --git a/system/t06_publish/switch.py b/system/t06_publish/switch.py index f86e1f23..0abd8dd5 100644 --- a/system/t06_publish/switch.py +++ b/system/t06_publish/switch.py @@ -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") + diff --git a/system/t06_publish/update.py b/system/t06_publish/update.py index c5b43af3..dd65a6d9 100644 --- a/system/t06_publish/update.py +++ b/system/t06_publish/update.py @@ -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")