mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-08 22:30:41 +00:00
Handle source repos while creating dist release file
This commit is contained in:
+5
-2
@@ -443,8 +443,11 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorage
|
|||||||
st["Archive"] = p.Distribution
|
st["Archive"] = p.Distribution
|
||||||
st["Architecture"] = arch
|
st["Architecture"] = arch
|
||||||
|
|
||||||
file, err := publishedStorage.CreateFile(filepath.Join(basePath, p.Component,
|
if arch != "source" {
|
||||||
fmt.Sprintf("binary-%s", arch), "Release"))
|
arch = fmt.Sprintf("binary-%s", arch)
|
||||||
|
}
|
||||||
|
|
||||||
|
file, err := publishedStorage.CreateFile(filepath.Join(basePath, p.Component, arch, "Release"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to create Release file: %s", err)
|
return fmt.Errorf("unable to create Release file: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-9
@@ -45,15 +45,15 @@ func (n *NullSigner) ClearSign(source string, destination string) error {
|
|||||||
|
|
||||||
type PublishedRepoSuite struct {
|
type PublishedRepoSuite struct {
|
||||||
PackageListMixinSuite
|
PackageListMixinSuite
|
||||||
repo, repo2 *PublishedRepo
|
repo, repo2, repo3 *PublishedRepo
|
||||||
root string
|
root string
|
||||||
publishedStorage aptly.PublishedStorage
|
publishedStorage aptly.PublishedStorage
|
||||||
packagePool aptly.PackagePool
|
packagePool aptly.PackagePool
|
||||||
localRepo *LocalRepo
|
localRepo *LocalRepo
|
||||||
snapshot *Snapshot
|
snapshot *Snapshot
|
||||||
db database.Storage
|
db database.Storage
|
||||||
factory *CollectionFactory
|
factory *CollectionFactory
|
||||||
packageCollection *PackageCollection
|
packageCollection *PackageCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = Suite(&PublishedRepoSuite{})
|
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.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)
|
poolPath, _ := s.packagePool.Path(s.p1.Files()[0].Filename, s.p1.Files()[0].Checksums.MD5)
|
||||||
err := os.MkdirAll(filepath.Dir(poolPath), 0755)
|
err := os.MkdirAll(filepath.Dir(poolPath), 0755)
|
||||||
f, err := os.Create(poolPath)
|
f, err := os.Create(poolPath)
|
||||||
@@ -264,6 +266,7 @@ func (s *PublishedRepoSuite) TestPublishNoSigner(c *C) {
|
|||||||
c.Assert(err, IsNil)
|
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/Release"), PathExists)
|
||||||
|
c.Check(filepath.Join(s.publishedStorage.PublicPath(), "ppa/dists/squeeze/main/binary-i386/Release"), PathExists)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PublishedRepoSuite) TestPublishLocalRepo(c *C) {
|
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)
|
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) {
|
func (s *PublishedRepoSuite) TestString(c *C) {
|
||||||
c.Check(s.repo.String(), Equals,
|
c.Check(s.repo.String(), Equals,
|
||||||
"ppa/squeeze (main) [] publishes [snap]: Snapshot from mirror [yandex]: http://mirror.yandex.ru/debian/ squeeze")
|
"ppa/squeeze (main) [] publishes [snap]: Snapshot from mirror [yandex]: http://mirror.yandex.ru/debian/ squeeze")
|
||||||
|
|||||||
Reference in New Issue
Block a user