diff --git a/cmd/publish_snapshot.go b/cmd/publish_snapshot.go index d9d92f52..a796d33b 100644 --- a/cmd/publish_snapshot.go +++ b/cmd/publish_snapshot.go @@ -116,11 +116,11 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error { if err != nil { return fmt.Errorf("unable to publish: %s", err) } - published.Origin = cmd.Flag.Lookup("origin").Value.String() - published.Label = cmd.Flag.Lookup("label").Value.String() + published.Origin = context.Flags().Lookup("origin").Value.String() + published.Label = context.Flags().Lookup("label").Value.String() - if cmd.Flag.IsSet("skip-contents") { - published.SkipContents = cmd.Flag.Lookup("skip-contents").Value.Get().(bool) + if context.Flags().IsSet("skip-contents") { + published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool) } duplicate := context.CollectionFactory().PublishedRepoCollection().CheckDuplicate(published) diff --git a/cmd/publish_switch.go b/cmd/publish_switch.go index 13ae0ae1..23b3b7b5 100644 --- a/cmd/publish_switch.go +++ b/cmd/publish_switch.go @@ -90,8 +90,8 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error { "the same package pool.\n") } - if cmd.Flag.IsSet("skip-contents") { - published.SkipContents = cmd.Flag.Lookup("skip-contents").Value.Get().(bool) + if context.Flags().IsSet("skip-contents") { + published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool) } 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 7b6b65f1..befb2312 100644 --- a/cmd/publish_update.go +++ b/cmd/publish_update.go @@ -54,8 +54,8 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error { "the same package pool.\n") } - if cmd.Flag.IsSet("skip-contents") { - published.SkipContents = cmd.Flag.Lookup("skip-contents").Value.Get().(bool) + if context.Flags().IsSet("skip-contents") { + published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool) } err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite) diff --git a/system/t06_publish/PublishRepo28Test_gold b/system/t06_publish/PublishRepo28Test_gold new file mode 100644 index 00000000..67294302 --- /dev/null +++ b/system/t06_publish/PublishRepo28Test_gold @@ -0,0 +1,14 @@ +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: + +Local repo local-repo has been successfully published. +Please setup your webserver to serve directory '/Users/smira/.aptly/public' with autoindexing. +Now you can add following line to apt sources: + deb http://your-server/ maverick main + deb-src http://your-server/ maverick 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/PublishSnapshot36Test_gold b/system/t06_publish/PublishSnapshot36Test_gold new file mode 100644 index 00000000..e44feb2d --- /dev/null +++ b/system/t06_publish/PublishSnapshot36Test_gold @@ -0,0 +1,13 @@ +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: + +Snapshot snap36 has been successfully published. +Please setup your webserver to serve directory '/Users/smira/.aptly/public' with autoindexing. +Now you can add following line to apt sources: + deb http://your-server/ maverick 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/PublishSwitch13Test_gold b/system/t06_publish/PublishSwitch13Test_gold new file mode 100644 index 00000000..3369aa06 --- /dev/null +++ b/system/t06_publish/PublishSwitch13Test_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 main... + +Publish for snapshot ./maverick [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new snapshot. diff --git a/system/t06_publish/PublishUpdate11Test_gold b/system/t06_publish/PublishUpdate11Test_gold new file mode 100644 index 00000000..72e92234 --- /dev/null +++ b/system/t06_publish/PublishUpdate11Test_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 main... + +Publish for local repo ./maverick [i386, source] publishes {main: [local-repo]} has been successfully updated. diff --git a/system/t06_publish/repo.py b/system/t06_publish/repo.py index f82e9de4..d0864bac 100644 --- a/system/t06_publish/repo.py +++ b/system/t06_publish/repo.py @@ -668,3 +668,25 @@ class PublishRepo27Test(BaseTest): # verify contents except of sums self.check_file_contents('public/dists/maverick/main/debian-installer/binary-i386/Packages', 'udeb_binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n")))) + + +class PublishRepo28Test(BaseTest): + """ + publish repo: -skip-contents + """ + fixtureCmds = [ + "aptly repo create local-repo", + "aptly repo add local-repo ${files} ${udebs}", + ] + runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -skip-contents local-repo" + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishRepo28Test, self).check() + + self.check_exists('public/dists/maverick/Release') + + self.check_exists('public/dists/maverick/main/binary-i386/Release') + self.check_not_exists('public/dists/maverick/main/Contents-i386.gz') + self.check_exists('public/dists/maverick/main/debian-installer/binary-i386/Release') + self.check_not_exists('public/dists/maverick/main/Contents-udeb-i386.gz') diff --git a/system/t06_publish/snapshot.py b/system/t06_publish/snapshot.py index 96eaac8d..0132db39 100644 --- a/system/t06_publish/snapshot.py +++ b/system/t06_publish/snapshot.py @@ -969,3 +969,27 @@ class PublishSnapshot35Test(BaseTest): if pathsSeen != pathsExepcted: raise Exception("path seen wrong: %r != %r" % (pathsSeen, pathsExepcted)) + + +class PublishSnapshot36Test(BaseTest): + """ + publish snapshot: -skip-contents + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap36 from mirror gnuplot-maverick", + ] + runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -skip-contents snap36" + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishSnapshot36Test, self).check() + + self.check_exists('public/dists/maverick/Release') + self.check_exists('public/dists/maverick/Release.gpg') + + self.check_exists('public/dists/maverick/main/binary-i386/Release') + self.check_not_exists('public/dists/maverick/main/Contents-i386.gz') + self.check_exists('public/dists/maverick/main/binary-amd64/Release') + self.check_not_exists('public/dists/maverick/main/Contents-amd64.gz') diff --git a/system/t06_publish/switch.py b/system/t06_publish/switch.py index 1e0d554a..6d85f3cc 100644 --- a/system/t06_publish/switch.py +++ b/system/t06_publish/switch.py @@ -419,3 +419,29 @@ class PublishSwitch12Test(BaseTest): ] runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -component=a,c maverick snap2 snap1" expectedCode = 1 + + +class PublishSwitch13Test(BaseTest): + """ + publish switch: -skip-contents + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly snapshot create snap2 empty", + "aptly snapshot pull -no-deps -architectures=i386,amd64 snap2 snap1 snap3 gnuplot-x11", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -skip-contents snap1", + ] + runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick snap3" + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishSwitch13Test, self).check() + + self.check_exists('public/dists/maverick/Release') + + self.check_exists('public/dists/maverick/main/binary-i386/Packages') + self.check_not_exists('public/dists/maverick/main/Contents-i386.gz') + self.check_exists('public/dists/maverick/main/binary-amd64/Packages') + self.check_not_exists('public/dists/maverick/main/Contents-amd64.gz') diff --git a/system/t06_publish/update.py b/system/t06_publish/update.py index be591116..62869dda 100644 --- a/system/t06_publish/update.py +++ b/system/t06_publish/update.py @@ -313,3 +313,27 @@ class PublishUpdate10Test(BaseTest): super(PublishUpdate10Test, self).check() self.check_file_contents("public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz", "file") + + +class PublishUpdate11Test(BaseTest): + """ + publish update: -skip-contents + """ + 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 -skip-contents local-repo", + "aptly repo remove local-repo pyspi" + ] + runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -skip-contents maverick" + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishUpdate11Test, 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_not_exists('public/dists/maverick/main/Contents-i386.gz')