Command aptly publish switch to switch published snapshot. #8

This commit is contained in:
Andrey Smirnov
2014-04-22 20:17:21 +04:00
parent 1200e9cc95
commit cc8baec317
15 changed files with 532 additions and 7 deletions

View File

@@ -29,11 +29,12 @@ func makeCmdPublish() *commander.Command {
UsageLine: "publish",
Short: "manage published repositories",
Subcommands: []*commander.Command{
makeCmdPublishDrop(),
makeCmdPublishList(),
makeCmdPublishRepo(),
makeCmdPublishSnapshot(),
makeCmdPublishSwitch(),
makeCmdPublishUpdate(),
makeCmdPublishList(),
makeCmdPublishDrop(),
},
}
}

107
cmd/publish_switch.go Normal file
View File

@@ -0,0 +1,107 @@
package cmd
import (
"fmt"
"github.com/smira/aptly/deb"
"github.com/smira/commander"
"github.com/smira/flag"
)
func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
var err error
if len(args) < 2 || len(args) > 3 {
cmd.Usage()
return err
}
distribution := args[0]
prefix := "."
var (
name string
snapshot *deb.Snapshot
)
if len(args) == 3 {
prefix = args[1]
name = args[2]
} else {
name = args[1]
}
snapshot, err = context.CollectionFactory().SnapshotCollection().ByName(name)
if err != nil {
return fmt.Errorf("unable to switch: %s", err)
}
err = context.CollectionFactory().SnapshotCollection().LoadComplete(snapshot)
if err != nil {
return fmt.Errorf("unable to switch: %s", err)
}
var published *deb.PublishedRepo
published, err = context.CollectionFactory().PublishedRepoCollection().ByPrefixDistribution(prefix, distribution)
if err != nil {
return fmt.Errorf("unable to update: %s", err)
}
if published.SourceKind != "snapshot" {
return fmt.Errorf("unable to update: not a snapshot publish")
}
err = context.CollectionFactory().PublishedRepoCollection().LoadComplete(published, context.CollectionFactory())
if err != nil {
return fmt.Errorf("unable to update: %s", err)
}
published.UpdateSnapshot(snapshot)
signer, err := getSigner(context.flags)
if err != nil {
return fmt.Errorf("unable to initialize GPG signer: %s", err)
}
err = published.Publish(context.PackagePool(), context.PublishedStorage(), context.CollectionFactory(), signer, context.Progress())
if err != nil {
return fmt.Errorf("unable to publish: %s", err)
}
err = context.CollectionFactory().PublishedRepoCollection().Update(published)
if err != nil {
return fmt.Errorf("unable to save to DB: %s", err)
}
err = context.CollectionFactory().PublishedRepoCollection().CleanupPrefixComponentFiles(published.Prefix, published.Component,
context.PublishedStorage(), context.CollectionFactory(), context.Progress())
if err != nil {
return fmt.Errorf("unable to update: %s", err)
}
context.Progress().Printf("\nPublish for snapshot %s has been successfully switched to new snapshot.\n", published.String())
return err
}
func makeCmdPublishSwitch() *commander.Command {
cmd := &commander.Command{
Run: aptlyPublishSwitch,
UsageLine: "switch <distribution> [<prefix>] <new-snapshot>",
Short: "update published repository by switching to new snapshot",
Long: `
Command switches in-place published repository with new snapshot contents. All
publishing parameters are preserved (architecture list, distribution, component).
Example:
$ aptly publish update wheezy ppa wheezy-7.5
`,
Flag: *flag.NewFlagSet("aptly-publish-switch", flag.ExitOnError),
}
cmd.Flag.String("gpg-key", "", "GPG key ID to use when signing the release")
cmd.Flag.Var(&keyRingsFlag{}, "keyring", "GPG keyring to use (instead of default)")
cmd.Flag.String("secret-keyring", "", "GPG secret keyring to use (instead of default)")
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
return cmd
}

View File

@@ -223,6 +223,16 @@ func (p *PublishedRepo) UpdateLocalRepo() {
p.rePublishing = true
}
func (p *PublishedRepo) UpdateSnapshot(snapshot *Snapshot) {
if p.SourceKind != "snapshot" {
panic("not snapshot publish")
}
p.snapshot = snapshot
p.SourceUUID = snapshot.UUID
p.rePublishing = true
}
// Encode does msgpack encoding of PublishedRepo
func (p *PublishedRepo) Encode() []byte {
var buf bytes.Buffer

View File

@@ -0,0 +1,29 @@
.
.
C-like language. Can perform smoothing, spline-fitting, or nonlinear fits,
Data files and self-defined functions can be manipulated by the internal
Gnuplot is a portable command-line driven interactive data and function
This package contains the terminal driver that enables gnuplot to plot
and can work with complex numbers.
for many printers, (La)TeX, (x)fig, Postscript, and so on. The X11-output
gnuplot.
images interactively under X11. Most users will want this, it is however
is packaged in gnuplot-x11.
packaged separately so that low-end systems don't need X installed to use
plotting utility that supports lots of output formats, including drivers
Architecture: i386
Depends: gnuplot-nox (>= 4.6.1-1~maverick2), libc6 (>= 2.11), libcairo2 (>= 1.6.0), libedit2 (>= 2.5.cvs.20010821-1), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg), libglib2.0-0 (>= 2.12.0), liblua5.1-0, libpango1.0-0 (>= 1.14.0), libstdc++6 (>= 4.1.1), libwxbase2.8-0 (>= 2.8.11.0), libwxgtk2.8-0 (>= 2.8.11.0), libx11-6
Description: Command-line driven interactive plotting program
Filename: pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb
Installed-Size: 1604
MD5sum: fcad938905d0ace50a6ce0c73b2c6583
Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Package: gnuplot-x11
Priority: optional
Replaces: gnuplot (<< 4.0.0)
SHA1: 02f9a93097a8f798a054e26154dbe5789088c069
Section: math
Size: 724388
Source: gnuplot
Version: 4.6.1-1~maverick2

View File

@@ -0,0 +1,7 @@
Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Publish for snapshot ./maverick (main) [amd64, i386] publishes [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11' has been successfully switched to new snapshot.

View File

@@ -0,0 +1,9 @@
Origin: . maverick
Label: . maverick
Codename: maverick
Architectures: amd64 i386
Components: main
Description: Generated by aptly
MD5Sum:
SHA1:
SHA256:

View File

@@ -0,0 +1,109 @@
.
.
.
.
.
.
.
.
C-like language. Can perform smoothing, spline-fitting, or nonlinear fits,
C-like language. Can perform smoothing, spline-fitting, or nonlinear fits,
C-like language. Can perform smoothing, spline-fitting, or nonlinear fits,
C-like language. Can perform smoothing, spline-fitting, or nonlinear fits,
Data files and self-defined functions can be manipulated by the internal
Data files and self-defined functions can be manipulated by the internal
Data files and self-defined functions can be manipulated by the internal
Data files and self-defined functions can be manipulated by the internal
Gnuplot is a portable command-line driven interactive data and function
Gnuplot is a portable command-line driven interactive data and function
Gnuplot is a portable command-line driven interactive data and function
Gnuplot is a portable command-line driven interactive data and function
This package contains the additional documentation.
This package contains the terminal driver that enables gnuplot to plot
This package is for transition and to install a full-featured gnuplot
This package is for working without an X server.
and can work with complex numbers.
and can work with complex numbers.
and can work with complex numbers.
and can work with complex numbers.
for many printers, (La)TeX, (x)fig, Postscript, and so on. The X11-output
for many printers, (La)TeX, (x)fig, Postscript, and so on. The X11-output
for many printers, (La)TeX, (x)fig, Postscript, and so on. The X11-output
for many printers, (La)TeX, (x)fig, Postscript, and so on. The X11-output
gnuplot.
images interactively under X11. Most users will want this, it is however
is packaged in gnuplot-x11.
is packaged in gnuplot-x11.
is packaged in gnuplot-x11.
is packaged in gnuplot-x11.
packaged separately so that low-end systems don't need X installed to use
plotting utility that supports lots of output formats, including drivers
plotting utility that supports lots of output formats, including drivers
plotting utility that supports lots of output formats, including drivers
plotting utility that supports lots of output formats, including drivers
supporting the X11-output.
Architecture: all
Architecture: all
Architecture: i386
Architecture: i386
Depends: dpkg (>= 1.15.4) | install-info
Depends: gnuplot-nox (>= 4.6.1-1~maverick2), gnuplot-x11 (>= 4.6.1-1~maverick2)
Depends: gnuplot-nox (>= 4.6.1-1~maverick2), libc6 (>= 2.11), libcairo2 (>= 1.6.0), libedit2 (>= 2.5.cvs.20010821-1), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg), libglib2.0-0 (>= 2.12.0), liblua5.1-0, libpango1.0-0 (>= 1.14.0), libstdc++6 (>= 4.1.1), libwxbase2.8-0 (>= 2.8.11.0), libwxgtk2.8-0 (>= 2.8.11.0), libx11-6
Depends: libc6 (>= 2.11), libcairo2 (>= 1.6.0), libedit2 (>= 2.5.cvs.20010821-1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg), libglib2.0-0 (>= 2.12.0), liblua5.1-0, libpango1.0-0 (>= 1.14.0)
Description: Command-line driven interactive plotting program
Description: Command-line driven interactive plotting program
Description: Command-line driven interactive plotting program
Description: Command-line driven interactive plotting program
Filename: pool/main/g/gnuplot/gnuplot-doc_4.6.1-1~maverick2_all.deb
Filename: pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_i386.deb
Filename: pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb
Filename: pool/main/g/gnuplot/gnuplot_4.6.1-1~maverick2_all.deb
Installed-Size: 1604
Installed-Size: 20
Installed-Size: 2536
Installed-Size: 5572
MD5sum: 25a5028811171f2f1fa157a2f6953e82
MD5sum: 4912a4464d5588f685c4aa6cfc6be46c
MD5sum: a7ef16004b62fd78acb77edb058ea1c1
MD5sum: fcad938905d0ace50a6ce0c73b2c6583
Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Maintainer: Debian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Package: gnuplot
Package: gnuplot-doc
Package: gnuplot-nox
Package: gnuplot-x11
Priority: optional
Priority: optional
Priority: optional
Priority: optional
Recommends: groff, ttf-liberation
Replaces: gnuplot (<< 4.0.0)
Replaces: gnuplot (<< 4.0.0)
SHA1: 02f9a93097a8f798a054e26154dbe5789088c069
SHA1: 4a50deb413e05f77b31687405465b1229b3be328
SHA1: 629c3e62f787b0af47b184beb0460dd261c9ca4d
SHA1: 837dd002143054ca01d3b01cae410cc4b4fe10c4
Section: doc
Section: math
Section: math
Section: math
Size: 1046
Size: 1046496
Size: 2675242
Size: 724388
Source:
Source: gnuplot
Source: gnuplot
Source: gnuplot
Suggests: gnuplot-doc (>= 4.6.1-1~maverick2)
Suggests: gnuplot-x11 (>= 4.6.1-1~maverick2), gnuplot-doc (>= 4.6.1-1~maverick2)
Version: 4.6.1-1~maverick2
Version: 4.6.1-1~maverick2
Version: 4.6.1-1~maverick2
Version: 4.6.1-1~maverick2

View File

@@ -0,0 +1,7 @@
Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "ppa" component "main"...
Publish for snapshot ppa/maverick (main) [amd64, i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick has been successfully switched to new snapshot.

View File

@@ -0,0 +1,7 @@
Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." component "main"...
Publish for snapshot ./maverick (main) [amd64, i386] publishes [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11' has been successfully switched to new snapshot.

View File

@@ -0,0 +1,7 @@
Loading packages...
Generating metadata files and linking package files...
Signing file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Clearsigning file '${HOME}/.aptly/public/ppa/dists/maverick/Release.tmp' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "ppa" component "main"...
Publish for snapshot ppa/maverick (main) [i386] publishes [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick has been successfully switched to new snapshot.

View File

@@ -0,0 +1 @@
ERROR: unable to update: published repo with prefix/distribution ppa/maverick not found

View File

@@ -0,0 +1 @@
ERROR: unable to update: not a snapshot publish

View File

@@ -0,0 +1 @@
ERROR: unable to switch: snapshot with name snap3 not found

View File

@@ -2,8 +2,9 @@
Testing publishing snapshots
"""
from .drop import *
from .list import *
from .repo import *
from .snapshot import *
from .update import *
# from .drop import *
# from .list import *
# from .repo import *
# from .snapshot import *
from .switch import *
# from .update import *

View File

@@ -0,0 +1,228 @@
import os
import hashlib
import inspect
from lib import BaseTest
def strip_processor(output):
return "\n".join([l for l in output.split("\n") if not l.startswith(' ') and not l.startswith('Date:')])
class PublishSwitch1Test(BaseTest):
"""
publish switch: removed some packages
"""
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 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(PublishSwitch1Test, 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.gz')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.gz')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.bz2')
self.check_exists('public/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb')
self.check_exists('public/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_amd64.deb')
self.check_not_exists('public/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_i386.deb')
self.check_not_exists('public/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_amd64.deb')
# verify contents except of sums
self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor)
self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# verify signatures
self.run_cmd(["gpg", "--no-auto-check-trustdb", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly.pub"),
"--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/InRelease')])
self.run_cmd(["gpg", "--no-auto-check-trustdb", "--keyring", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "aptly.pub"),
"--verify", os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release.gpg'),
os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/Release')])
# verify sums
release = self.read_file('public/dists/maverick/Release').split("\n")
release = [l for l in release if l.startswith(" ")]
pathsSeen = set()
for l in release:
fileHash, fileSize, path = l.split()
pathsSeen.add(path)
fileSize = int(fileSize)
st = os.stat(os.path.join(os.environ["HOME"], ".aptly", 'public/dists/maverick/', path))
if fileSize != st.st_size:
raise Exception("file size doesn't match for %s: %d != %d" % (path, fileSize, st.st_size))
if len(fileHash) == 32:
h = hashlib.md5()
elif len(fileHash) == 40:
h = hashlib.sha1()
else:
h = hashlib.sha256()
h.update(self.read_file(os.path.join('public/dists/maverick', path)))
if h.hexdigest() != fileHash:
raise Exception("file hash doesn't match for %s: %s != %s" % (path, fileHash, h.hexdigest()))
if pathsSeen != set(['main/binary-amd64/Packages', 'main/binary-i386/Packages', 'main/binary-i386/Packages.gz',
'main/binary-amd64/Packages.gz', 'main/binary-amd64/Packages.bz2', 'main/binary-i386/Packages.bz2']):
raise Exception("path seen wrong: %r" % (pathsSeen, ))
class PublishSwitch2Test(BaseTest):
"""
publish switch: added some packages
"""
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 snap3 ppa",
]
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick ppa snap1"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishSwitch2Test, self).check()
self.check_exists('public/ppa/dists/maverick/InRelease')
self.check_exists('public/ppa/dists/maverick/Release')
self.check_exists('public/ppa/dists/maverick/Release.gpg')
self.check_exists('public/ppa/dists/maverick/main/binary-i386/Packages.gz')
self.check_exists('public/ppa/dists/maverick/main/binary-i386/Packages.bz2')
self.check_exists('public/ppa/dists/maverick/main/binary-amd64/Packages')
self.check_exists('public/ppa/dists/maverick/main/binary-amd64/Packages.gz')
self.check_exists('public/ppa/dists/maverick/main/binary-amd64/Packages.bz2')
self.check_exists('public/ppa/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb')
self.check_exists('public/ppa/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_amd64.deb')
self.check_exists('public/ppa/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_i386.deb')
self.check_exists('public/ppa/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_amd64.deb')
# verify contents except of sums
self.check_file_contents('public/ppa/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
class PublishSwitch3Test(BaseTest):
"""
publish switch: removed some packages, files occupied by another package
"""
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 snap1",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick2 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(PublishSwitch3Test, 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.gz')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.gz')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.bz2')
self.check_exists('public/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb')
self.check_exists('public/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_amd64.deb')
self.check_exists('public/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_i386.deb')
self.check_exists('public/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_amd64.deb')
class PublishSwitch4Test(BaseTest):
"""
publish switch: added some packages, but list of published archs doesn't change
"""
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 snap2 snap1 snap3 gnuplot-x11",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap3 ppa",
]
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick ppa snap1"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishSwitch4Test, self).check()
self.check_exists('public/ppa/dists/maverick/InRelease')
self.check_exists('public/ppa/dists/maverick/Release')
self.check_exists('public/ppa/dists/maverick/Release.gpg')
self.check_exists('public/ppa/dists/maverick/main/binary-i386/Packages.gz')
self.check_exists('public/ppa/dists/maverick/main/binary-i386/Packages.bz2')
self.check_not_exists('public/ppa/dists/maverick/main/binary-amd64/Packages')
self.check_not_exists('public/ppa/dists/maverick/main/binary-amd64/Packages.gz')
self.check_not_exists('public/ppa/dists/maverick/main/binary-amd64/Packages.bz2')
self.check_exists('public/ppa/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_i386.deb')
self.check_not_exists('public/ppa/pool/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_amd64.deb')
self.check_exists('public/ppa/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_i386.deb')
self.check_not_exists('public/ppa/pool/main/g/gnuplot/gnuplot-nox_4.6.1-1~maverick2_amd64.deb')
class PublishSwitch5Test(BaseTest):
"""
publish switch: no such publish
"""
fixtureCmds = [
"aptly snapshot create snap1 empty",
]
runCmd = "aptly publish switch maverick ppa snap1"
expectedCode = 1
class PublishSwitch6Test(BaseTest):
"""
publish switch: not a snapshot
"""
fixtureCmds = [
"aptly snapshot create snap1 empty",
"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",
]
runCmd = "aptly publish switch maverick snap1"
expectedCode = 1
class PublishSwitch7Test(BaseTest):
"""
publish switch: no snapshot
"""
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 -distribution=maverick snap1",
]
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick snap3"
expectedCode = 1