mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-10 06:14:22 +00:00
Fix bugs with publishing w/o source or short names.
This commit is contained in:
Vendored
+6
-1
@@ -98,7 +98,12 @@ func (p *PublishedRepo) Publish(repo *Repository, packageCollection *PackageColl
|
|||||||
|
|
||||||
err = list.ForEach(func(pkg *Package) error {
|
err = list.ForEach(func(pkg *Package) error {
|
||||||
if pkg.Architecture == arch || pkg.Architecture == "all" {
|
if pkg.Architecture == arch || pkg.Architecture == "all" {
|
||||||
path, err := repo.LinkFromPool(p.Prefix, p.Component, pkg.Filename, pkg.HashMD5, pkg.Source)
|
source := pkg.Source
|
||||||
|
if source == "" {
|
||||||
|
source = pkg.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
path, err := repo.LinkFromPool(p.Prefix, p.Component, pkg.Filename, pkg.HashMD5, source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+6
-1
@@ -45,6 +45,11 @@ func (r *Repository) PoolPath(filename string, hashMD5 string) (string, error) {
|
|||||||
return filepath.Join(r.RootPath, "pool", hashMD5[0:2], hashMD5[2:4], filename), nil
|
return filepath.Join(r.RootPath, "pool", hashMD5[0:2], hashMD5[2:4], filename), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PublicPath returns root of public part of repository
|
||||||
|
func (r *Repository) PublicPath() string {
|
||||||
|
return filepath.Join(r.RootPath, "public")
|
||||||
|
}
|
||||||
|
|
||||||
// MkDir creates directory recursively under public path
|
// MkDir creates directory recursively under public path
|
||||||
func (r *Repository) MkDir(path string) error {
|
func (r *Repository) MkDir(path string) error {
|
||||||
return os.MkdirAll(filepath.Join(r.RootPath, "public", path), 0755)
|
return os.MkdirAll(filepath.Join(r.RootPath, "public", path), 0755)
|
||||||
@@ -62,7 +67,7 @@ func (r *Repository) LinkFromPool(prefix string, component string, filename stri
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(source) < 3 {
|
if len(source) < 2 {
|
||||||
return "", fmt.Errorf("package source %s too short", source)
|
return "", fmt.Errorf("package source %s too short", source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
@@ -28,6 +28,10 @@ func (s *RepositorySuite) TestPoolPath(c *C) {
|
|||||||
c.Assert(err, ErrorMatches, ".*is invalid")
|
c.Assert(err, ErrorMatches, ".*is invalid")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *RepositorySuite) TestPublicPath(c *C) {
|
||||||
|
c.Assert(s.repo.PublicPath(), Equals, filepath.Join(s.repo.RootPath, "public"))
|
||||||
|
}
|
||||||
|
|
||||||
func (s *RepositorySuite) TestMkDir(c *C) {
|
func (s *RepositorySuite) TestMkDir(c *C) {
|
||||||
err := s.repo.MkDir("ppa/dists/squeeze/")
|
err := s.repo.MkDir("ppa/dists/squeeze/")
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|||||||
Reference in New Issue
Block a user