From 61e9f5a30a62f19b5814bf5804f2dbe7458a2a47 Mon Sep 17 00:00:00 2001 From: Christoph Fiehe Date: Thu, 10 Oct 2024 16:14:25 +0200 Subject: [PATCH] Fix test cases. Signed-off-by: Christoph Fiehe --- cmd/publish_source_add.go | 7 +- cmd/publish_source_drop.go | 6 +- cmd/publish_source_remove.go | 9 +- cmd/publish_source_update.go | 7 +- system/t06_publish/PublishSourceAdd1Test_gold | 4 +- system/t06_publish/PublishSourceAdd2Test_gold | 5 +- system/t06_publish/PublishSourceAdd3Test_gold | 2 +- .../t06_publish/PublishSourceDrop1Test_gold | 2 +- .../t06_publish/PublishSourceList1Test_gold | 4 +- .../t06_publish/PublishSourceList2Test_gold | 1 + .../t06_publish/PublishSourceRemove1Test_gold | 4 +- .../t06_publish/PublishSourceRemove2Test_gold | 5 +- .../t06_publish/PublishSourceRemove3Test_gold | 2 +- .../t06_publish/PublishSourceUpdate1Test_gold | 4 +- .../t06_publish/PublishSourceUpdate2Test_gold | 5 +- .../t06_publish/PublishSourceUpdate3Test_gold | 2 +- system/t06_publish/PublishUpdate15Test_gold | 8 + system/t06_publish/PublishUpdate16Test_gold | 1 + system/t06_publish/PublishUpdate17Test_gold | 1 + system/t06_publish/PublishUpdate18Test_gold | 1 + system/t06_publish/PublishUpdate8Test_gold | 2 +- system/t06_publish/source.py | 159 +++++-------- system/t06_publish/update.py | 221 ++++++++++++++---- 23 files changed, 295 insertions(+), 167 deletions(-) create mode 100644 system/t06_publish/PublishSourceList2Test_gold create mode 100644 system/t06_publish/PublishUpdate15Test_gold create mode 100644 system/t06_publish/PublishUpdate16Test_gold create mode 100644 system/t06_publish/PublishUpdate17Test_gold create mode 100644 system/t06_publish/PublishUpdate18Test_gold diff --git a/cmd/publish_source_add.go b/cmd/publish_source_add.go index 08adeb772..2ee9e7fff 100644 --- a/cmd/publish_source_add.go +++ b/cmd/publish_source_add.go @@ -56,6 +56,9 @@ func aptlyPublishSourceAdd(cmd *commander.Command, args []string) error { return fmt.Errorf("unable to save to DB: %s", err) } + context.Progress().Printf("\nYou can run 'aptly publish update %s %s' to update the content of the published repository.\n", + distribution, published.StoragePrefix()) + return err } @@ -63,9 +66,9 @@ func makeCmdPublishSourceAdd() *commander.Command { cmd := &commander.Command{ Run: aptlyPublishSourceAdd, UsageLine: "add ", - Short: "add package source to published repository", + Short: "add source to staged source list of published repository", Long: ` -The command adds (in place) one or multiple package sources to a published repository. +The command adds sources to the staged source list of the published repository. The flag -component is mandatory. Use a comma-separated list of components, if multiple components should be modified. The number of given components must be diff --git a/cmd/publish_source_drop.go b/cmd/publish_source_drop.go index af5c1f842..d038e0e45 100644 --- a/cmd/publish_source_drop.go +++ b/cmd/publish_source_drop.go @@ -45,13 +45,13 @@ func makeCmdPublishSourceDrop() *commander.Command { cmd := &commander.Command{ Run: aptlyPublishSourceDrop, UsageLine: "drop ", - Short: "drops revision of published repository", + Short: "drops staged source changes of published repository", Long: ` -Command drops revision of a published repository. +Command drops the staged source changes of the published repository. Example: - $ aptly publish revision drop wheezy + $ aptly publish source drop wheezy `, Flag: *flag.NewFlagSet("aptly-publish-revision-create", flag.ExitOnError), } diff --git a/cmd/publish_source_remove.go b/cmd/publish_source_remove.go index 624763b87..1d3892c41 100644 --- a/cmd/publish_source_remove.go +++ b/cmd/publish_source_remove.go @@ -42,7 +42,7 @@ func aptlyPublishSourceRemove(cmd *commander.Command, args []string) error { for _, component := range components { name, exists := sources[component] if !exists { - return fmt.Errorf("unable to remove: Component %q is not part of revision", component) + return fmt.Errorf("unable to remove: component %q does not exist", component) } context.Progress().Printf("Removing component %q with source %q [%s]...\n", component, name, published.SourceKind) @@ -54,6 +54,9 @@ func aptlyPublishSourceRemove(cmd *commander.Command, args []string) error { return fmt.Errorf("unable to save to DB: %s", err) } + context.Progress().Printf("\nYou can run 'aptly publish update %s %s' to update the content of the published repository.\n", + distribution, published.StoragePrefix()) + return err } @@ -61,9 +64,9 @@ func makeCmdPublishSourceRemove() *commander.Command { cmd := &commander.Command{ Run: aptlyPublishSourceRemove, UsageLine: "remove [[:]] ", - Short: "remove package source to published repository", + Short: "remove source from staged source list of published repository", Long: ` -The command removes one or multiple components from a published repository. +The command removes sources from the staged source list of the published repository. The flag -component is mandatory. Use a comma-separated list of components, if multiple components should be removed, e.g.: diff --git a/cmd/publish_source_update.go b/cmd/publish_source_update.go index 9a81fcc98..66c274680 100644 --- a/cmd/publish_source_update.go +++ b/cmd/publish_source_update.go @@ -56,6 +56,9 @@ func aptlyPublishSourceUpdate(cmd *commander.Command, args []string) error { return fmt.Errorf("unable to save to DB: %s", err) } + context.Progress().Printf("\nYou can run 'aptly publish update %s %s' to update the content of the published repository.\n", + distribution, published.StoragePrefix()) + return err } @@ -63,9 +66,9 @@ func makeCmdPublishSourceUpdate() *commander.Command { cmd := &commander.Command{ Run: aptlyPublishSourceUpdate, UsageLine: "update ", - Short: "update package source to published repository", + Short: "update source in staged source list of published repository", Long: ` -The command updates one or multiple components in a published repository. +The command updates sources in the staged source list of the published repository. The flag -component is mandatory. Use a comma-separated list of components, if multiple components should be modified. The number of given components must be diff --git a/system/t06_publish/PublishSourceAdd1Test_gold b/system/t06_publish/PublishSourceAdd1Test_gold index 345e6aef7..8ac95d375 100644 --- a/system/t06_publish/PublishSourceAdd1Test_gold +++ b/system/t06_publish/PublishSourceAdd1Test_gold @@ -1 +1,3 @@ -Test +Adding component "test" with source "snap2" [snapshot]... + +You can run 'aptly publish update maverick .' to update the content of the published repository. diff --git a/system/t06_publish/PublishSourceAdd2Test_gold b/system/t06_publish/PublishSourceAdd2Test_gold index 345e6aef7..904bfc81d 100644 --- a/system/t06_publish/PublishSourceAdd2Test_gold +++ b/system/t06_publish/PublishSourceAdd2Test_gold @@ -1 +1,4 @@ -Test +Adding component "test" with source "snap2" [snapshot]... +Adding component "other-test" with source "snap3" [snapshot]... + +You can run 'aptly publish update maverick .' to update the content of the published repository. diff --git a/system/t06_publish/PublishSourceAdd3Test_gold b/system/t06_publish/PublishSourceAdd3Test_gold index 345e6aef7..e5802b783 100644 --- a/system/t06_publish/PublishSourceAdd3Test_gold +++ b/system/t06_publish/PublishSourceAdd3Test_gold @@ -1 +1 @@ -Test +ERROR: unable to add: component "main" has already been added diff --git a/system/t06_publish/PublishSourceDrop1Test_gold b/system/t06_publish/PublishSourceDrop1Test_gold index 345e6aef7..5f05ba78c 100644 --- a/system/t06_publish/PublishSourceDrop1Test_gold +++ b/system/t06_publish/PublishSourceDrop1Test_gold @@ -1 +1 @@ -Test +Source changes have been removed successfully. diff --git a/system/t06_publish/PublishSourceList1Test_gold b/system/t06_publish/PublishSourceList1Test_gold index 345e6aef7..364ef5c2d 100644 --- a/system/t06_publish/PublishSourceList1Test_gold +++ b/system/t06_publish/PublishSourceList1Test_gold @@ -1 +1,3 @@ -Test +Sources: + main: snap1 [snapshot] + test: snap2 [snapshot] diff --git a/system/t06_publish/PublishSourceList2Test_gold b/system/t06_publish/PublishSourceList2Test_gold new file mode 100644 index 000000000..03e2a99a8 --- /dev/null +++ b/system/t06_publish/PublishSourceList2Test_gold @@ -0,0 +1 @@ +ERROR: unable to list: no source changes exist diff --git a/system/t06_publish/PublishSourceRemove1Test_gold b/system/t06_publish/PublishSourceRemove1Test_gold index 345e6aef7..761bf16b3 100644 --- a/system/t06_publish/PublishSourceRemove1Test_gold +++ b/system/t06_publish/PublishSourceRemove1Test_gold @@ -1 +1,3 @@ -Test +Removing component "test" with source "snap2" [snapshot]... + +You can run 'aptly publish update maverick .' to update the content of the published repository. diff --git a/system/t06_publish/PublishSourceRemove2Test_gold b/system/t06_publish/PublishSourceRemove2Test_gold index 345e6aef7..6692ca2ed 100644 --- a/system/t06_publish/PublishSourceRemove2Test_gold +++ b/system/t06_publish/PublishSourceRemove2Test_gold @@ -1 +1,4 @@ -Test +Removing component "test" with source "snap2" [snapshot]... +Removing component "other-test" with source "snap3" [snapshot]... + +You can run 'aptly publish update maverick .' to update the content of the published repository. diff --git a/system/t06_publish/PublishSourceRemove3Test_gold b/system/t06_publish/PublishSourceRemove3Test_gold index 345e6aef7..54507f259 100644 --- a/system/t06_publish/PublishSourceRemove3Test_gold +++ b/system/t06_publish/PublishSourceRemove3Test_gold @@ -1 +1 @@ -Test +ERROR: unable to remove: component "not-existent" does not exist diff --git a/system/t06_publish/PublishSourceUpdate1Test_gold b/system/t06_publish/PublishSourceUpdate1Test_gold index 345e6aef7..ea66b43f0 100644 --- a/system/t06_publish/PublishSourceUpdate1Test_gold +++ b/system/t06_publish/PublishSourceUpdate1Test_gold @@ -1 +1,3 @@ -Test +Updating component "main" with source "snap2" [snapshot]... + +You can run 'aptly publish update maverick .' to update the content of the published repository. diff --git a/system/t06_publish/PublishSourceUpdate2Test_gold b/system/t06_publish/PublishSourceUpdate2Test_gold index 345e6aef7..134f0d3f4 100644 --- a/system/t06_publish/PublishSourceUpdate2Test_gold +++ b/system/t06_publish/PublishSourceUpdate2Test_gold @@ -1 +1,4 @@ -Test +Updating component "main" with source "snap2" [snapshot]... +Updating component "test" with source "snap3" [snapshot]... + +You can run 'aptly publish update maverick .' to update the content of the published repository. diff --git a/system/t06_publish/PublishSourceUpdate3Test_gold b/system/t06_publish/PublishSourceUpdate3Test_gold index 345e6aef7..4d2fb4c8a 100644 --- a/system/t06_publish/PublishSourceUpdate3Test_gold +++ b/system/t06_publish/PublishSourceUpdate3Test_gold @@ -1 +1 @@ -Test +ERROR: unable to update: component "not-existent" does not exist diff --git a/system/t06_publish/PublishUpdate15Test_gold b/system/t06_publish/PublishUpdate15Test_gold new file mode 100644 index 000000000..ebd8ad244 --- /dev/null +++ b/system/t06_publish/PublishUpdate15Test_gold @@ -0,0 +1,8 @@ +Loading packages... +Generating metadata files and linking package files... +Finalizing metadata 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 ... + +Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap3]: Created as empty}, {test: [snap2]: Created as empty} has been successfully updated. diff --git a/system/t06_publish/PublishUpdate16Test_gold b/system/t06_publish/PublishUpdate16Test_gold new file mode 100644 index 000000000..345e6aef7 --- /dev/null +++ b/system/t06_publish/PublishUpdate16Test_gold @@ -0,0 +1 @@ +Test diff --git a/system/t06_publish/PublishUpdate17Test_gold b/system/t06_publish/PublishUpdate17Test_gold new file mode 100644 index 000000000..345e6aef7 --- /dev/null +++ b/system/t06_publish/PublishUpdate17Test_gold @@ -0,0 +1 @@ +Test diff --git a/system/t06_publish/PublishUpdate18Test_gold b/system/t06_publish/PublishUpdate18Test_gold new file mode 100644 index 000000000..345e6aef7 --- /dev/null +++ b/system/t06_publish/PublishUpdate18Test_gold @@ -0,0 +1 @@ +Test diff --git a/system/t06_publish/PublishUpdate8Test_gold b/system/t06_publish/PublishUpdate8Test_gold index 09aa9845b..1a6ebd262 100644 --- a/system/t06_publish/PublishUpdate8Test_gold +++ b/system/t06_publish/PublishUpdate8Test_gold @@ -3,4 +3,4 @@ Generating metadata files and linking package files... Finalizing metadata files... Cleaning up prefix "." components contrib, main... -Publish for local repo ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated. +Published local repository ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated. diff --git a/system/t06_publish/source.py b/system/t06_publish/source.py index 432f83a8f..585e939e8 100644 --- a/system/t06_publish/source.py +++ b/system/t06_publish/source.py @@ -8,32 +8,13 @@ class PublishSourceAdd1Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-contrib", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", - "aptly publish source add -component=contrib wheezy snap2" + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec" - + runCmd = "aptly publish source add -component=test maverick snap2" gold_processor = BaseTest.expand_environ - def check(self): - super(PublishSourceAdd1Test, self).check() - self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages') - self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.gz') - self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.bz2') - self.check_exists('public/dists/wheezy/contrib/Contents-i386.gz') - self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages') - self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.gz') - self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.bz2') - self.check_exists('public/dists/wheezy/contrib/Contents-amd64.gz') - - release = self.read_file('public/dists/wheezy/Release').split('\n') - components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None) - components = sorted(components.split(' ')) - if ['contrib', 'main'] != components: - raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'contrib main')) - class PublishSourceAdd2Test(BaseTest): """ @@ -42,42 +23,14 @@ class PublishSourceAdd2Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-contrib", - "aptly snapshot create snap3 from mirror wheezy-non-free", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", - "aptly publish source add -component=contrib,non-free wheezy snap2 snap3" + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec" - + runCmd = "aptly publish source add -component=test,other-test maverick snap2 snap3" gold_processor = BaseTest.expand_environ - def check(self): - super(PublishSourceAdd2Test, self).check() - self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages') - self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.gz') - self.check_exists('public/dists/wheezy/contrib/binary-i386/Packages.bz2') - self.check_exists('public/dists/wheezy/contrib/Contents-i386.gz') - self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages') - self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.gz') - self.check_exists('public/dists/wheezy/contrib/binary-amd64/Packages.bz2') - self.check_exists('public/dists/wheezy/contrib/Contents-amd64.gz') - - self.check_exists('public/dists/wheezy/non-free/binary-i386/Packages') - self.check_exists('public/dists/wheezy/non-free/binary-i386/Packages.gz') - self.check_exists('public/dists/wheezy/non-free/binary-i386/Packages.bz2') - self.check_exists('public/dists/wheezy/non-free/Contents-i386.gz') - self.check_exists('public/dists/wheezy/non-free/binary-amd64/Packages') - self.check_exists('public/dists/wheezy/non-free/binary-amd64/Packages.gz') - self.check_exists('public/dists/wheezy/non-free/binary-amd64/Packages.bz2') - self.check_exists('public/dists/wheezy/non-free/Contents-amd64.gz') - - release = self.read_file('public/dists/wheezy/Release').split('\n') - components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None) - components = sorted(components.split(' ')) - if ['contrib', 'main', 'non-free'] != components: - raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'contrib main non-free')) - class PublishSourceAdd3Test(BaseTest): """ @@ -86,11 +39,11 @@ class PublishSourceAdd3Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror gnuplot-maverick", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish add -component=main wheezy snap2" + runCmd = "aptly publish source add -component=main maverick snap2" expectedCode = 1 gold_processor = BaseTest.expand_environ @@ -102,12 +55,28 @@ class PublishSourceList1Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-contrib", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", + "aptly publish source add -component=test maverick snap2", ] - runCmd = "aptly publish source list" + runCmd = "aptly publish source list maverick" + gold_processor = BaseTest.expand_environ + +class PublishSourceList2Test(BaseTest): + """ + publish source list: show source changes (empty) + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", + ] + runCmd = "aptly publish source list maverick" + expectedCode = 1 gold_processor = BaseTest.expand_environ @@ -118,12 +87,11 @@ class PublishSourceDrop1Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-contrib", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish source drop" - + runCmd = "aptly publish source drop maverick" gold_processor = BaseTest.expand_environ @@ -134,12 +102,11 @@ class PublishSourceUpdate1Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror gnuplot-maverick", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish source update -component=main wheezy snap2" - + runCmd = "aptly publish source update -component=main maverick snap2" gold_processor = BaseTest.expand_environ @@ -150,13 +117,12 @@ class PublishSourceUpdate2Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-main", - "aptly snapshot create snap3 from mirror gnuplot-maverick", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main,test snap1 snap2", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,test snap1 snap2", ] - runCmd = "aptly publish source update -component=main,test wheezy snap2 snap3" - + runCmd = "aptly publish source update -component=main,test maverick snap2 snap3" gold_processor = BaseTest.expand_environ @@ -167,11 +133,10 @@ class PublishSourceUpdate3Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish source update -component=not-existent wheezy snap1" - + runCmd = "aptly publish source update -component=not-existent maverick snap1" gold_processor = BaseTest.expand_environ @@ -182,12 +147,11 @@ class PublishSourceRemove1Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-contrib", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main,contrib snap1 snap2", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,test snap1 snap2", ] - runCmd = "aptly publish source remove -component=contrib wheezy" - + runCmd = "aptly publish source remove -component=test maverick" gold_processor = BaseTest.expand_environ @@ -198,13 +162,12 @@ class PublishSourceRemove2Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly snapshot create snap2 from mirror wheezy-contrib", - "aptly snapshot create snap3 from mirror wheezy-non-free", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main,contrib,non-free snap1 snap2 snap3", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,test,other-test snap1 snap2 snap3", ] - runCmd = "aptly publish source remove -component=contrib,non-free wheezy" - + runCmd = "aptly publish source remove -component=test,other-test maverick" gold_processor = BaseTest.expand_environ @@ -215,9 +178,9 @@ class PublishSourceRemove3Test(BaseTest): fixtureDB = True fixturePool = True fixtureCmds = [ - "aptly snapshot create snap1 from mirror wheezy-main", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=wheezy -component=main snap1", + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main snap1", ] - runCmd = "aptly publish source remove -component=not-existent wheezy" + runCmd = "aptly publish source remove -component=not-existent maverick" expectedCode = 1 gold_processor = BaseTest.expand_environ diff --git a/system/t06_publish/update.py b/system/t06_publish/update.py index 88114d926..067906303 100644 --- a/system/t06_publish/update.py +++ b/system/t06_publish/update.py @@ -175,39 +175,6 @@ def check(self): self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb') -#class PublishUpdate4Test(BaseTest): -# """ -# publish update: added some packages, but list of published archs doesn't change -# """ -# fixtureCmds = [ -# "aptly repo create local-repo", -# "aptly repo add local-repo ${files}/pyspi_0.6.1-1.3.dsc", -# "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick local-repo", -# "aptly repo add local-repo ${files}/libboost-program-options-dev_1.49.0.1_i386.deb" -# ] -# runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick" -# gold_processor = BaseTest.expand_environ -# -# def check(self): -# super(PublishUpdate4Test, self).check() -# -# self.check_exists('public/dists/maverick/InRelease') -# self.check_exists('public/dists/maverick/Release') -# self.check_exists('public/dists/maverick/Release.gpg') -# -# self.check_not_exists('public/dists/maverick/main/binary-i386/Packages') -# self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.gz') -# self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.bz2') -# self.check_exists('public/dists/maverick/main/source/Sources') -# self.check_exists('public/dists/maverick/main/source/Sources.gz') -# self.check_exists('public/dists/maverick/main/source/Sources.bz2') -# -# self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc') -# self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz') -# self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz') -# self.check_not_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb') - - class PublishUpdate5Test(BaseTest): """ publish update: no such publish @@ -216,20 +183,6 @@ class PublishUpdate5Test(BaseTest): expectedCode = 1 -class PublishUpdate6Test(BaseTest): - """ - publish update: not a local repo - """ - fixtureDB = True - fixturePool = True - fixtureCmds = [ - "aptly snapshot create snap1 from mirror gnuplot-maverick", - "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1", - ] - runCmd = "aptly publish update maverick" - expectedCode = 1 - - class PublishUpdate7Test(BaseTest): """ publish update: multiple components, add some packages @@ -487,3 +440,177 @@ def check(self): self.check_exists('public/dists/bookworm/main/binary-i386/Packages.gz') self.check_exists('public/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb') + + +class PublishUpdate15Test(BaseTest): + """ + publish update: source added + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -architectures=i386 -component=main snap1", + "aptly publish source add -component=test,other-test maverick snap2 snap3" + ] + runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick" + + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishUpdate15Test, self).check() + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/Contents-i386.gz') + + self.check_exists('public/dists/maverick/test/binary-i386/Packages') + self.check_exists('public/dists/maverick/test/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/test/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/test/Contents-i386.gz') + + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages') + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/other-test/Contents-i386.gz') + + release = self.read_file('public/dists/maverick/Release').split('\n') + components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None) + components = sorted(components.split(' ')) + if ['main', 'other-test', 'test'] != components: + raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main other-test test')) + + +class PublishUpdate16Test(BaseTest): + """ + publish update: source removed + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 empty", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -architectures=i386 -component=main,test,other-test snap1 snap2 snap3", + "aptly publish source remove -component=test,other-test maverick" + ] + runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick" + + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishUpdate16Test, self).check() + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/Contents-i386.gz') + + release = self.read_file('public/dists/maverick/Release').split('\n') + components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None) + components = sorted(components.split(' ')) + if ['main'] != components: + raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main')) + + +class PublishUpdate17Test(BaseTest): + """ + publish update: source updated + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 empty", + "aptly snapshot create snap4 from mirror gnuplot-maverick", + "aptly snapshot create snap5 from mirror gnuplot-maverick", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -architectures=i386 -component=main,test,other-test snap1 snap2 snap3", + "aptly publish source update -component=test,other-test maverick snap4 snap5" + ] + runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick" + + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishUpdate17Test, self).check() + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/Contents-i386.gz') + + self.check_exists('public/dists/maverick/test/binary-i386/Packages') + self.check_exists('public/dists/maverick/test/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/test/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/test/Contents-i386.gz') + + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages') + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/other-test/Contents-i386.gz') + + release = self.read_file('public/dists/maverick/Release').split('\n') + components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None) + components = sorted(components.split(' ')) + if ['main', 'other-test', 'test'] != components: + raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main other-test test')) + + +class PublishUpdate18Test(BaseTest): + """ + publish update: source added, updated and removed + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot create snap3 from mirror gnuplot-maverick", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -architectures=i386 -component=main,test snap1 snap2", + "aptly publish source remove -component=main maverick", + "aptly publish source update -component=test maverick snap3", + "aptly publish source add -component=other-test maverick snap1" + ] + runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick" + + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishUpdate18Test, self).check() + self.check_exists('public/dists/maverick/InRelease') + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/main/Contents-i386.gz') + + self.check_exists('public/dists/maverick/test/binary-i386/Packages') + self.check_exists('public/dists/maverick/test/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/test/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/test/Contents-i386.gz') + + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages') + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.gz') + self.check_exists('public/dists/maverick/other-test/binary-i386/Packages.bz2') + self.check_exists('public/dists/maverick/other-test/Contents-i386.gz') + + release = self.read_file('public/dists/maverick/Release').split('\n') + components = next((e.split(': ')[1] for e in release if e.startswith('Components')), None) + components = sorted(components.split(' ')) + if ['main', 'other-test', 'test'] != components: + raise Exception("value of 'Components' in release file is '%s' and does not match '%s'." % (' '.join(components), 'main other-test test'))