Compare commits

...

15 Commits

Author SHA1 Message Date
Andrey Smirnov 9d02f057c6 Version bump: 0.7.1. 2014-08-06 02:24:43 +04:00
Andrey Smirnov 8387586cc8 Man page update: -force-overwrite flag. #90 2014-08-06 02:04:25 +04:00
Andrey Smirnov b433e7dad5 Workaround for broken time.Time encoding in msgpack with go < 1.2. #89
Decoding looses value of time.Time field, but that is not critical.
2014-08-06 01:56:13 +04:00
Andrey Smirnov dec4bdee71 Merge branch 'patch-1' of https://github.com/guilhem/aptly 2014-08-05 17:01:55 +04:00
Andrey Smirnov bb6593d21e Add -force-overwrite flag to publish update, switch, snapshot and repo commands. #90
Includes new and updated system tests.
2014-08-05 17:01:18 +04:00
Andrey Smirnov fe879acf9c Remove Makefile part specific for go1.1 2014-08-05 15:59:32 +04:00
Andrey Smirnov 5b8390c644 Uncomment and fix publish updat tests. 2014-08-05 15:58:47 +04:00
Andrey Smirnov d558791070 Add -force-overwrite command flag. #90 2014-08-05 15:47:38 +04:00
Andrey Smirnov 38ea595c9a Add forceOverwrite on the path to LinkFromPool. #90 2014-08-05 15:47:23 +04:00
Andrey Smirnov c03b7929d4 Fix line ends: system tests. 2014-08-05 15:44:12 +04:00
Andrey Smirnov d122ab6013 Fix system tests. 2014-08-05 15:27:39 +04:00
Andrey Smirnov a7b594d076 Drop support for go1.1 2014-08-05 15:26:41 +04:00
Andrey Smirnov e07bcf8e51 Fix style and add comments. #90 2014-08-05 14:50:15 +04:00
Andrey Smirnov da6d5b7cf8 Add 'force' to LinkFromPool method: overwrite file even if exists and different content. #90 2014-08-05 14:50:06 +04:00
Guilhem Lettron 15ef5c63c5 Add gobuild.io badge 2014-07-31 14:52:22 +02:00
57 changed files with 728 additions and 251 deletions
-1
View File
@@ -1,7 +1,6 @@
language: go
go:
- 1.1
- 1.2.1
- 1.3
- tip
-2
View File
@@ -43,9 +43,7 @@ install:
$(GOM) build -o $(BINPATH)/aptly
system-test: install
ifeq ($(GOVERSION),$(filter $(GOVERSION),go1.2 go1.2.1 go1.3 devel))
if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi
endif
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
PATH=$(BINPATH)/:$(PATH) $(PYTHON) system/run.py --long
+5 -1
View File
@@ -8,6 +8,10 @@ aptly
.. image:: https://coveralls.io/repos/smira/aptly/badge.png?branch=HEAD
:target: https://coveralls.io/r/smira/aptly?branch=HEAD
.. image:: http://gobuild.io/badge/github.com/smira/aptly/download.png
:target: http://gobuild.io/github.com/smira/aptly
Aptly is a swiss army knife for Debian repository management.
Documentation is available at `http://www.aptly.info/ <http://www.aptly.info/>`_. For support use
@@ -51,7 +55,7 @@ Ubuntu 10.0+. Package contains aptly binary, man page and bash completion.
Binary executables (depends almost only on libc) are available for download from `Bintray <http://dl.bintray.com/smira/aptly/>`_.
If you have Go environment set up, you can build aptly from source by running (go 1.1+ required)::
If you have Go environment set up, you can build aptly from source by running (go 1.2+ required)::
go get -u github.com/mattn/gom
mkdir -p $GOPATH/src/github.com/smira/aptly
+1 -1
View File
@@ -34,7 +34,7 @@ type PublishedStorage interface {
// Remove removes single file under public path
Remove(path string) error
// LinkFromPool links package file from pool to dist's pool location
LinkFromPool(publishedDirectory string, sourcePool PackagePool, sourcePath, sourceMD5 string) error
LinkFromPool(publishedDirectory string, sourcePool PackagePool, sourcePath, sourceMD5 string, force bool) error
// Filelist returns list of files under prefix
Filelist(prefix string) ([]string, error)
// RenameFile renames (moves) file
+1 -1
View File
@@ -1,7 +1,7 @@
package aptly
// Version of aptly
const Version = "0.7"
const Version = "0.7.1"
// Enable debugging features?
const EnableDebug = false
+1
View File
@@ -40,6 +40,7 @@ Example:
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
cmd.Flag.String("origin", "", "origin name to publish")
cmd.Flag.String("label", "", "label to publish")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
return cmd
}
+8 -1
View File
@@ -130,7 +130,13 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to initialize GPG signer: %s", err)
}
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress())
forceOverwrite := context.flags.Lookup("force-overwrite").Value.Get().(bool)
if forceOverwrite {
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)
if err != nil {
return fmt.Errorf("unable to publish: %s", err)
}
@@ -196,6 +202,7 @@ Example:
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
cmd.Flag.String("origin", "", "origin name to publish")
cmd.Flag.String("label", "", "label to publish")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
return cmd
}
+8 -1
View File
@@ -79,7 +79,13 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to initialize GPG signer: %s", err)
}
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress())
forceOverwrite := context.flags.Lookup("force-overwrite").Value.Get().(bool)
if forceOverwrite {
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)
if err != nil {
return fmt.Errorf("unable to publish: %s", err)
}
@@ -127,6 +133,7 @@ Example:
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")
cmd.Flag.String("component", "", "component names to update (for multi-component publishing, separate components with commas)")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
return cmd
}
+8 -1
View File
@@ -48,7 +48,13 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to initialize GPG signer: %s", err)
}
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, context.Progress())
forceOverwrite := context.flags.Lookup("force-overwrite").Value.Get().(bool)
if forceOverwrite {
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)
if err != nil {
return fmt.Errorf("unable to publish: %s", err)
}
@@ -93,6 +99,7 @@ Example:
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")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
return cmd
}
+3 -2
View File
@@ -462,7 +462,8 @@ func (p *Package) Equals(p2 *Package) bool {
}
// LinkFromPool links package file from pool to dist's pool location
func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packagePool aptly.PackagePool, prefix string, component string) error {
func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packagePool aptly.PackagePool,
prefix, component string, force bool) error {
poolDir, err := p.PoolDirectory()
if err != nil {
return err
@@ -477,7 +478,7 @@ func (p *Package) LinkFromPool(publishedStorage aptly.PublishedStorage, packageP
relPath := filepath.Join("pool", component, poolDir)
publishedDirectory := filepath.Join(prefix, relPath)
err = publishedStorage.LinkFromPool(publishedDirectory, packagePool, sourcePath, f.Checksums.MD5)
err = publishedStorage.LinkFromPool(publishedDirectory, packagePool, sourcePath, f.Checksums.MD5, force)
if err != nil {
return err
}
+2 -2
View File
@@ -345,13 +345,13 @@ func (s *PackageSuite) TestLinkFromPool(c *C) {
c.Assert(err, IsNil)
file.Close()
err = p.LinkFromPool(publishedStorage, packagePool, "", "non-free")
err = p.LinkFromPool(publishedStorage, packagePool, "", "non-free", false)
c.Check(err, IsNil)
c.Check(p.Files()[0].Filename, Equals, "alien-arena-common_7.40-2_i386.deb")
c.Check(p.Files()[0].downloadPath, Equals, "pool/non-free/a/alien-arena")
p.IsSource = true
err = p.LinkFromPool(publishedStorage, packagePool, "", "non-free")
err = p.LinkFromPool(publishedStorage, packagePool, "", "non-free", false)
c.Check(err, IsNil)
c.Check(p.Extra()["Directory"], Equals, "pool/non-free/a/alien-arena")
}
+2 -2
View File
@@ -393,7 +393,7 @@ func (p *PublishedRepo) GetLabel() string {
// Publish publishes snapshot (repository) contents, links package files, generates Packages & Release files, signs them
func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider,
collectionFactory *CollectionFactory, signer utils.Signer, progress aptly.Progress) error {
collectionFactory *CollectionFactory, signer utils.Signer, progress aptly.Progress, forceOverwrite bool) error {
publishedStorage := publishedStorageProvider.GetPublishedStorage(p.Storage)
err := publishedStorage.MkDir(filepath.Join(p.Prefix, "pool"))
@@ -488,7 +488,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
progress.AddBar(1)
}
if pkg.MatchesArchitecture(arch) {
err = pkg.LinkFromPool(publishedStorage, packagePool, p.Prefix, component)
err = pkg.LinkFromPool(publishedStorage, packagePool, p.Prefix, component, forceOverwrite)
if err != nil {
return err
}
+5 -5
View File
@@ -274,7 +274,7 @@ func (s *PublishedRepoSuite) TestDistributionComponentGuessing(c *C) {
}
func (s *PublishedRepoSuite) TestPublish(c *C) {
err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil)
err := s.repo.Publish(s.packagePool, s.provider, s.factory, &NullSigner{}, nil, false)
c.Assert(err, IsNil)
c.Check(s.repo.Architectures, DeepEquals, []string{"i386"})
@@ -321,7 +321,7 @@ func (s *PublishedRepoSuite) TestPublish(c *C) {
}
func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) {
err := s.repo.Publish(s.packagePool, s.provider, s.factory, nil, nil)
err := s.repo.Publish(s.packagePool, s.provider, s.factory, nil, nil, false)
c.Assert(err, IsNil)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/Release"), PathExists)
@@ -329,7 +329,7 @@ func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) {
}
func (s *PublishedRepoSuite) TestPublishLocalRepo(c *C) {
err := s.repo2.Publish(s.packagePool, s.provider, s.factory, nil, nil)
err := s.repo2.Publish(s.packagePool, s.provider, s.factory, nil, nil, false)
c.Assert(err, IsNil)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/Release"), PathExists)
@@ -337,7 +337,7 @@ func (s *PublishedRepoSuite) TestPublishLocalRepo(c *C) {
}
func (s *PublishedRepoSuite) TestPublishLocalSourceRepo(c *C) {
err := s.repo4.Publish(s.packagePool, s.provider, s.factory, nil, nil)
err := s.repo4.Publish(s.packagePool, s.provider, s.factory, nil, nil, false)
c.Assert(err, IsNil)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/Release"), PathExists)
@@ -345,7 +345,7 @@ func (s *PublishedRepoSuite) TestPublishLocalSourceRepo(c *C) {
}
func (s *PublishedRepoSuite) TestPublishOtherStorage(c *C) {
err := s.repo5.Publish(s.packagePool, s.provider, s.factory, nil, nil)
err := s.repo5.Publish(s.packagePool, s.provider, s.factory, nil, nil, false)
c.Assert(err, IsNil)
c.Check(filepath.Join(s.publishedStorage2.PublicPath(), "ppa/dists/maverick/Release"), PathExists)
+37 -1
View File
@@ -502,7 +502,43 @@ func (repo *RemoteRepo) Decode(input []byte) error {
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
err := decoder.Decode(repo)
if err != nil {
return err
if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") {
// probably it is broken DB from go < 1.2, try decoding w/o time.Time
var repo11 struct {
UUID string
Name string
ArchiveRoot string
Distribution string
Components []string
Architectures []string
DownloadSources bool
Meta Stanza
LastDownloadDate []byte
ReleaseFiles map[string]utils.ChecksumInfo
Filter string
FilterWithDeps bool
}
decoder = codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
err2 := decoder.Decode(&repo11)
if err2 != nil {
return err
}
repo.UUID = repo11.UUID
repo.Name = repo11.Name
repo.ArchiveRoot = repo11.ArchiveRoot
repo.Distribution = repo11.Distribution
repo.Components = repo11.Components
repo.Architectures = repo11.Architectures
repo.DownloadSources = repo11.DownloadSources
repo.Meta = repo11.Meta
repo.ReleaseFiles = repo11.ReleaseFiles
repo.Filter = repo11.Filter
repo.FilterWithDeps = repo11.FilterWithDeps
} else {
return err
}
}
return repo.prepare()
}
+31 -1
View File
@@ -9,6 +9,7 @@ import (
"github.com/smira/aptly/utils"
"github.com/ugorji/go/codec"
"log"
"strings"
"time"
)
@@ -125,7 +126,36 @@ func (s *Snapshot) Encode() []byte {
// Decode decodes msgpack representation into Snapshot
func (s *Snapshot) Decode(input []byte) error {
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
return decoder.Decode(s)
err := decoder.Decode(s)
if err != nil {
if strings.HasPrefix(err.Error(), "codec.decoder: readContainerLen: Unrecognized descriptor byte: hex: 80") {
// probably it is broken DB from go < 1.2, try decoding w/o time.Time
var snapshot11 struct {
UUID string
Name string
CreatedAt []byte
SourceKind string
SourceIDs []string
Description string
}
decoder = codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
err2 := decoder.Decode(&snapshot11)
if err2 != nil {
return err
}
s.UUID = snapshot11.UUID
s.Name = snapshot11.Name
s.SourceKind = snapshot11.SourceKind
s.SourceIDs = snapshot11.SourceIDs
s.Description = snapshot11.Description
} else {
return err
}
}
return nil
}
// SnapshotCollection does listing, updating/adding/deleting of Snapshots
+16 -3
View File
@@ -79,7 +79,8 @@ func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress
// sourcePath is filepath to package file in package pool
//
// LinkFromPool returns relative path for the published file to be included in package index
func (storage *PublishedStorage) LinkFromPool(publishedDirectory string, sourcePool aptly.PackagePool, sourcePath, sourceMD5 string) error {
func (storage *PublishedStorage) LinkFromPool(publishedDirectory string, sourcePool aptly.PackagePool,
sourcePath, sourceMD5 string, force bool) error {
// verify that package pool is local pool is filesystem pool
_ = sourcePool.(*PackagePool)
@@ -105,12 +106,24 @@ func (storage *PublishedStorage) LinkFromPool(publishedDirectory string, sourceP
srcSys := srcStat.Sys().(*syscall.Stat_t)
dstSys := dstStat.Sys().(*syscall.Stat_t)
if srcSys.Ino != dstSys.Ino {
// source and destination inodes match, no need to link
if srcSys.Ino == dstSys.Ino {
return nil
}
// source and destination have different inodes, if !forced, this is fatal error
if !force {
return fmt.Errorf("error linking file to %s: file already exists and is different", filepath.Join(poolPath, baseName))
}
return nil
// forced, so remove destination
err = os.Remove(filepath.Join(poolPath, baseName))
if err != nil {
return err
}
}
// destination doesn't exist (or forced), create link
return os.Link(sourcePath, filepath.Join(poolPath, baseName))
}
+18 -2
View File
@@ -153,7 +153,7 @@ func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
err = ioutil.WriteFile(t.sourcePath, []byte("Contents"), 0644)
c.Assert(err, IsNil)
err = s.storage.LinkFromPool(filepath.Join(t.prefix, "pool", t.component, t.poolDirectory), pool, t.sourcePath, "")
err = s.storage.LinkFromPool(filepath.Join(t.prefix, "pool", t.component, t.poolDirectory), pool, t.sourcePath, "", false)
c.Assert(err, IsNil)
st, err := os.Stat(filepath.Join(s.storage.rootPath, t.prefix, t.expectedFilename))
@@ -171,6 +171,22 @@ func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
err = ioutil.WriteFile(sourcePath, []byte("Contents"), 0644)
c.Assert(err, IsNil)
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath, "")
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath, "", false)
c.Check(err, ErrorMatches, ".*file already exists and is different")
st, err := os.Stat(sourcePath)
c.Assert(err, IsNil)
info := st.Sys().(*syscall.Stat_t)
c.Check(int(info.Nlink), Equals, 1)
// linking with force
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath, "", true)
c.Check(err, IsNil)
st, err = os.Stat(sourcePath)
c.Assert(err, IsNil)
info = st.Sys().(*syscall.Stat_t)
c.Check(int(info.Nlink), Equals, 2)
}
+17 -1
View File
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "APTLY" "1" "July 2014" "" ""
.TH "APTLY" "1" "August 2014" "" ""
.
.SH "NAME"
\fBaptly\fR \- Debian repository management tool
@@ -971,6 +971,10 @@ component name to publish (for multi\-component publishing, separate components
distribution name to publish
.
.TP
\-\fBforce\-overwrite\fR=false
overwrite files in package pool in case of mismatch
.
.TP
\-\fBgpg\-key\fR=
GPG key ID to use when signing the release
.
@@ -1038,6 +1042,10 @@ component name to publish (for multi\-component publishing, separate components
distribution name to publish
.
.TP
\-\fBforce\-overwrite\fR=false
overwrite files in package pool in case of mismatch
.
.TP
\-\fBgpg\-key\fR=
GPG key ID to use when signing the release
.
@@ -1101,6 +1109,10 @@ Options:
component names to update (for multi\-component publishing, separate components with commas)
.
.TP
\-\fBforce\-overwrite\fR=false
overwrite files in package pool in case of mismatch
.
.TP
\-\fBgpg\-key\fR=
GPG key ID to use when signing the release
.
@@ -1142,6 +1154,10 @@ $ aptly publish update wheezy ppa
Options:
.
.TP
\-\fBforce\-overwrite\fR=false
overwrite files in package pool in case of mismatch
.
.TP
\-\fBgpg\-key\fR=
GPG key ID to use when signing the release
.
+9 -2
View File
@@ -140,7 +140,8 @@ func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress
// sourcePath is filepath to package file in package pool
//
// LinkFromPool returns relative path for the published file to be included in package index
func (storage *PublishedStorage) LinkFromPool(publishedDirectory string, sourcePool aptly.PackagePool, sourcePath, sourceMD5 string) error {
func (storage *PublishedStorage) LinkFromPool(publishedDirectory string, sourcePool aptly.PackagePool,
sourcePath, sourceMD5 string, force bool) error {
// verify that package pool is local pool in filesystem
_ = sourcePool.(*files.PackagePool)
@@ -159,9 +160,15 @@ func (storage *PublishedStorage) LinkFromPool(publishedDirectory string, sourceP
return fmt.Errorf("error getting information about %s from %s: %s", poolPath, storage, err)
}
} else {
if strings.Replace(dstKey.ETag, "\"", "", -1) == sourceMD5 {
destinationMD5 := strings.Replace(dstKey.ETag, "\"", "", -1)
if destinationMD5 == sourceMD5 {
return nil
}
if !force && destinationMD5 != sourceMD5 {
return fmt.Errorf("error putting file to %s: file already exists and is different: %s", poolPath, storage)
}
}
return storage.PutFile(relPath, sourcePath)
+57
View File
@@ -3,8 +3,10 @@ package s3
import (
"github.com/mitchellh/goamz/aws"
"github.com/mitchellh/goamz/s3/s3test"
"github.com/smira/aptly/files"
"io/ioutil"
. "launchpad.net/gocheck"
"os"
"path/filepath"
)
@@ -114,3 +116,58 @@ func (s *PublishedStorageSuite) TestRemoveDirs(c *C) {
c.Check(list, DeepEquals, []string{"a", "b", "c", "lala/a", "lala/b", "lala/c", "test/a", "test/b", "testa"})
}
func (s *PublishedStorageSuite) TestRenameFile(c *C) {
c.Skip("copy not available in s3test")
}
func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
root := c.MkDir()
pool := files.NewPackagePool(root)
sourcePath := filepath.Join(root, "pool/c1/df/mars-invaders_1.03.deb")
err := os.MkdirAll(filepath.Dir(sourcePath), 0755)
c.Assert(err, IsNil)
err = ioutil.WriteFile(sourcePath, []byte("Contents"), 0644)
c.Assert(err, IsNil)
sourcePath2 := filepath.Join(root, "pool/e9/df/mars-invaders_1.03.deb")
err = os.MkdirAll(filepath.Dir(sourcePath2), 0755)
c.Assert(err, IsNil)
err = ioutil.WriteFile(sourcePath2, []byte("Spam"), 0644)
c.Assert(err, IsNil)
// first link from pool
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath, "c1df1da7a1ce305a3b60af9d5733ac1d", false)
c.Check(err, IsNil)
data, err := s.storage.bucket.Get("pool/main/m/mars-invaders/mars-invaders_1.03.deb")
c.Check(err, IsNil)
c.Check(data, DeepEquals, []byte("Contents"))
// duplicate link from pool
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath, "c1df1da7a1ce305a3b60af9d5733ac1d", false)
c.Check(err, IsNil)
data, err = s.storage.bucket.Get("pool/main/m/mars-invaders/mars-invaders_1.03.deb")
c.Check(err, IsNil)
c.Check(data, DeepEquals, []byte("Contents"))
// link from pool with conflict
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath2, "e9dfd31cc505d51fc26975250750deab", false)
c.Check(err, ErrorMatches, ".*file already exists and is different.*")
data, err = s.storage.bucket.Get("pool/main/m/mars-invaders/mars-invaders_1.03.deb")
c.Check(err, IsNil)
c.Check(data, DeepEquals, []byte("Contents"))
// link from pool with conflict and force
err = s.storage.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), pool, sourcePath2, "e9dfd31cc505d51fc26975250750deab", true)
c.Check(err, IsNil)
data, err = s.storage.bucket.Get("pool/main/m/mars-invaders/mars-invaders_1.03.deb")
c.Check(err, IsNil)
c.Check(data, DeepEquals, []byte("Spam"))
}
+1 -1
View File
@@ -1 +1 @@
aptly version: 0.7
aptly version: 0.7.1
@@ -8,6 +8,6 @@ Last update: never
Information from release file:
Architectures: all
Date: Tue, 01 Jul 2014 04:41:04 UTC
Date: Wed, 30 Jul 2014 15:23:01 UTC
Origin: jenkins-ci.org
Suite: binary
@@ -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 <jsogo@debian.org>
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
+15
View File
@@ -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.
@@ -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 <jsogo@debian.org>
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
@@ -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
@@ -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 <jsogo@debian.org>
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
@@ -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.
@@ -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 <jsogo@debian.org>
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
@@ -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
@@ -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 <jsogo@debian.org>
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
@@ -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.
@@ -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 <jsogo@debian.org>
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
@@ -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.
+2 -2
View File
@@ -1,7 +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:
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.
+2 -2
View File
@@ -1,7 +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:
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.
+2 -2
View File
@@ -1,7 +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:
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.
+2 -2
View File
@@ -1,7 +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:
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 [source] publishes {main: [local-repo]} has been successfully updated.
+1 -1
View File
@@ -1 +1 @@
ERROR: unable to update: published repo with prefix/distribution ppa/maverick not found
ERROR: unable to update: published repo with storage:prefix/distribution ppa/maverick not found
+2 -2
View File
@@ -1,7 +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:
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 contrib, main...
Publish for local repo ./maverick [i386, source] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.
@@ -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 <jsogo@debian.org>
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
@@ -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
+20
View File
@@ -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")
+40
View File
@@ -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")
+41
View File
@@ -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")
+244 -208
View File
@@ -8,258 +8,258 @@ def strip_processor(output):
return "\n".join([l for l in output.split("\n") if not l.startswith(' ') and not l.startswith('Date:')])
# class PublishUpdate1Test(BaseTest):
# """
# publish update: removed some packages
# """
# 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 pyspi"
# ]
# runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
# gold_processor = BaseTest.expand_environ
class PublishUpdate1Test(BaseTest):
"""
publish update: removed some packages
"""
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 pyspi"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
# def check(self):
# super(PublishUpdate1Test, self).check()
def check(self):
super(PublishUpdate1Test, 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/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/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/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/source/Sources')
self.check_exists('public/dists/maverick/main/source/Sources.gz')
self.check_exists('public/dists/maverick/main/source/Sources.bz2')
# self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
# self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
# self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
# self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
# self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.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/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# 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/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
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 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)
# 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)
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))
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()
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)))
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 h.hexdigest() != fileHash:
raise Exception("file hash doesn't match for %s: %s != %s" % (path, fileHash, h.hexdigest()))
# if pathsSeen != set(['main/binary-i386/Packages', 'main/binary-i386/Packages.bz2', 'main/binary-i386/Packages.gz',
# 'main/source/Sources', 'main/source/Sources.gz', 'main/source/Sources.bz2',
# 'main/binary-i386/Release', 'main/source/Release']):
# raise Exception("path seen wrong: %r" % (pathsSeen, ))
if pathsSeen != set(['main/binary-i386/Packages', 'main/binary-i386/Packages.bz2', 'main/binary-i386/Packages.gz',
'main/source/Sources', 'main/source/Sources.gz', 'main/source/Sources.bz2',
'main/binary-i386/Release', 'main/source/Release']):
raise Exception("path seen wrong: %r" % (pathsSeen, ))
# class PublishUpdate2Test(BaseTest):
# """
# publish update: added some packages
# """
# fixtureCmds = [
# "aptly repo create local-repo",
# "aptly repo add local-repo ${files}/libboost-program-options-dev_1.49.0.1_i386.deb ${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}/pyspi-0.6.1-1.3.stripped.dsc"
# ]
# runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
# gold_processor = BaseTest.expand_environ
class PublishUpdate2Test(BaseTest):
"""
publish update: added some packages
"""
fixtureCmds = [
"aptly repo create local-repo",
"aptly repo add local-repo ${files}/libboost-program-options-dev_1.49.0.1_i386.deb ${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}/pyspi-0.6.1-1.3.stripped.dsc"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
# def check(self):
# super(PublishUpdate2Test, self).check()
def check(self):
super(PublishUpdate2Test, 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/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/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/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/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_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
# self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
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_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
# # verify contents except of sums
# self.check_file_contents('public/dists/maverick/main/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# verify contents except of sums
self.check_file_contents('public/dists/maverick/main/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# class PublishUpdate3Test(BaseTest):
# """
# publish update: removed some packages, files occupied by another package
# """
# 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 publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick2 local-repo",
# "aptly repo remove local-repo pyspi"
# ]
# runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
# gold_processor = BaseTest.expand_environ
class PublishUpdate3Test(BaseTest):
"""
publish update: removed some packages, files occupied by another package
"""
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 publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick2 local-repo",
"aptly repo remove local-repo pyspi"
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
# def check(self):
# super(PublishUpdate3Test, self).check()
def check(self):
super(PublishUpdate3Test, 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/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/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/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/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_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
# self.check_exists('public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
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_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
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
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()
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_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_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')
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
# """
# runCmd = "aptly publish update maverick ppa"
# expectedCode = 1
class PublishUpdate5Test(BaseTest):
"""
publish update: no such publish
"""
runCmd = "aptly publish update maverick ppa"
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 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
# """
# fixtureCmds = [
# "aptly repo create repo1",
# "aptly repo create repo2",
# "aptly repo add repo1 ${files}/pyspi_0.6.1-1.3.dsc",
# "aptly repo add repo2 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb",
# "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,contrib repo1 repo2",
# "aptly repo add repo1 ${files}/pyspi-0.6.1-1.3.stripped.dsc",
# ]
# runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
# gold_processor = BaseTest.expand_environ
class PublishUpdate7Test(BaseTest):
"""
publish update: multiple components, add some packages
"""
fixtureCmds = [
"aptly repo create repo1",
"aptly repo create repo2",
"aptly repo add repo1 ${files}/pyspi_0.6.1-1.3.dsc",
"aptly repo add repo2 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb",
"aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=main,contrib repo1 repo2",
"aptly repo add repo1 ${files}/pyspi-0.6.1-1.3.stripped.dsc",
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick"
gold_processor = BaseTest.expand_environ
# def check(self):
# super(PublishUpdate7Test, self).check()
def check(self):
super(PublishUpdate7Test, 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/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/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/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/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/dists/maverick/contrib/binary-i386/Packages')
# self.check_exists('public/dists/maverick/contrib/binary-i386/Packages.gz')
# self.check_exists('public/dists/maverick/contrib/binary-i386/Packages.bz2')
# self.check_exists('public/dists/maverick/contrib/source/Sources')
# self.check_exists('public/dists/maverick/contrib/source/Sources.gz')
# self.check_exists('public/dists/maverick/contrib/source/Sources.bz2')
self.check_exists('public/dists/maverick/contrib/binary-i386/Packages')
self.check_exists('public/dists/maverick/contrib/binary-i386/Packages.gz')
self.check_exists('public/dists/maverick/contrib/binary-i386/Packages.bz2')
self.check_exists('public/dists/maverick/contrib/source/Sources')
self.check_exists('public/dists/maverick/contrib/source/Sources.gz')
self.check_exists('public/dists/maverick/contrib/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_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
# self.check_exists('public/pool/contrib/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
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_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
self.check_exists('public/pool/contrib/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
# # verify contents except of sums
# self.check_file_contents('public/dists/maverick/main/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# self.check_file_contents('public/dists/maverick/contrib/source/Sources', 'sources2', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# self.check_file_contents('public/dists/maverick/contrib/binary-i386/Packages', 'binary2', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
# verify contents except of sums
self.check_file_contents('public/dists/maverick/main/source/Sources', 'sources', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
self.check_file_contents('public/dists/maverick/main/binary-i386/Packages', 'binary', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
self.check_file_contents('public/dists/maverick/contrib/source/Sources', 'sources2', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
self.check_file_contents('public/dists/maverick/contrib/binary-i386/Packages', 'binary2', match_prepare=lambda s: "\n".join(sorted(s.split("\n"))))
class PublishUpdate8Test(BaseTest):
@@ -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")