Fix -skip-contents + system tests. #142

This commit is contained in:
Andrey Smirnov
2015-04-05 21:55:41 +03:00
parent 6293ca3206
commit 933b019f71
11 changed files with 147 additions and 8 deletions
+4 -4
View File
@@ -116,11 +116,11 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
if err != nil { if err != nil {
return fmt.Errorf("unable to publish: %s", err) return fmt.Errorf("unable to publish: %s", err)
} }
published.Origin = cmd.Flag.Lookup("origin").Value.String() published.Origin = context.Flags().Lookup("origin").Value.String()
published.Label = cmd.Flag.Lookup("label").Value.String() published.Label = context.Flags().Lookup("label").Value.String()
if cmd.Flag.IsSet("skip-contents") { if context.Flags().IsSet("skip-contents") {
published.SkipContents = cmd.Flag.Lookup("skip-contents").Value.Get().(bool) published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool)
} }
duplicate := context.CollectionFactory().PublishedRepoCollection().CheckDuplicate(published) duplicate := context.CollectionFactory().PublishedRepoCollection().CheckDuplicate(published)
+2 -2
View File
@@ -90,8 +90,8 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
"the same package pool.\n") "the same package pool.\n")
} }
if cmd.Flag.IsSet("skip-contents") { if context.Flags().IsSet("skip-contents") {
published.SkipContents = cmd.Flag.Lookup("skip-contents").Value.Get().(bool) published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool)
} }
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite) err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite)
+2 -2
View File
@@ -54,8 +54,8 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
"the same package pool.\n") "the same package pool.\n")
} }
if cmd.Flag.IsSet("skip-contents") { if context.Flags().IsSet("skip-contents") {
published.SkipContents = cmd.Flag.Lookup("skip-contents").Value.Get().(bool) published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool)
} }
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite) err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress(), forceOverwrite)
+14
View File
@@ -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.
@@ -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.
@@ -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.
@@ -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.
+22
View File
@@ -668,3 +668,25 @@ class PublishRepo27Test(BaseTest):
# verify contents except of sums # 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")))) 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')
+24
View File
@@ -969,3 +969,27 @@ class PublishSnapshot35Test(BaseTest):
if pathsSeen != pathsExepcted: if pathsSeen != pathsExepcted:
raise Exception("path seen wrong: %r != %r" % (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')
+26
View File
@@ -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" runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -component=a,c maverick snap2 snap1"
expectedCode = 1 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')
+24
View File
@@ -313,3 +313,27 @@ class PublishUpdate10Test(BaseTest):
super(PublishUpdate10Test, self).check() super(PublishUpdate10Test, self).check()
self.check_file_contents("public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz", "file") 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')