Handle source repos while creating dist release file

This commit is contained in:
Ryan Uber
2014-05-29 22:24:19 -07:00
parent b0f9a4a419
commit 9a4543500c
2 changed files with 25 additions and 11 deletions
+5 -2
View File
@@ -443,8 +443,11 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorage
st["Archive"] = p.Distribution
st["Architecture"] = arch
file, err := publishedStorage.CreateFile(filepath.Join(basePath, p.Component,
fmt.Sprintf("binary-%s", arch), "Release"))
if arch != "source" {
arch = fmt.Sprintf("binary-%s", arch)
}
file, err := publishedStorage.CreateFile(filepath.Join(basePath, p.Component, arch, "Release"))
if err != nil {
return fmt.Errorf("unable to create Release file: %s", err)
}
+20 -9
View File
@@ -45,15 +45,15 @@ func (n *NullSigner) ClearSign(source string, destination string) error {
type PublishedRepoSuite struct {
PackageListMixinSuite
repo, repo2 *PublishedRepo
root string
publishedStorage aptly.PublishedStorage
packagePool aptly.PackagePool
localRepo *LocalRepo
snapshot *Snapshot
db database.Storage
factory *CollectionFactory
packageCollection *PackageCollection
repo, repo2, repo3 *PublishedRepo
root string
publishedStorage aptly.PublishedStorage
packagePool aptly.PackagePool
localRepo *LocalRepo
snapshot *Snapshot
db database.Storage
factory *CollectionFactory
packageCollection *PackageCollection
}
var _ = Suite(&PublishedRepoSuite{})
@@ -88,6 +88,8 @@ func (s *PublishedRepoSuite) SetUpTest(c *C) {
s.repo2, _ = NewPublishedRepo("ppa", "maverick", "main", nil, s.localRepo, s.factory)
s.repo3, _ = NewPublishedRepo("ppa", "maverick", "main", []string{"source"}, s.localRepo, s.factory)
poolPath, _ := s.packagePool.Path(s.p1.Files()[0].Filename, s.p1.Files()[0].Checksums.MD5)
err := os.MkdirAll(filepath.Dir(poolPath), 0755)
f, err := os.Create(poolPath)
@@ -264,6 +266,7 @@ func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) {
c.Assert(err, IsNil)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/Release"), PathExists)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/main/binary-i386/Release"), PathExists)
}
func (s *PublishedRepoSuite) TestPublishLocalRepo(c *C) {
@@ -274,6 +277,14 @@ func (s *PublishedRepoSuite) TestPublishLocalRepo(c *C) {
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/main/binary-i386/Release"), PathExists)
}
func (s *PublishedRepoSuite) TestPublishLocalSourceRepo(c *C) {
err := s.repo3.Publish(s.packagePool, s.publishedStorage, s.factory, nil, nil)
c.Assert(err, IsNil)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/Release"), PathExists)
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/maverick/main/source/Release"), PathExists)
}
func (s *PublishedRepoSuite) TestString(c *C) {
c.Check(s.repo.String(), Equals,
"ppa/squeeze (main) [] publishes [snap]: Snapshot from mirror [yandex]: http://mirror.yandex.ru/debian/ squeeze")