mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Revert "Don't allow '/' in distribution name, auto-replace '/' with '-' while guessing. #110"
This reverts commit 1daa076d65.
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
This commit is contained in:
committed by
André Roth
parent
32595e7cb7
commit
287a947c62
@@ -197,9 +197,6 @@ func NewPublishedRepo(storage, prefix, distribution string, architectures []stri
|
|||||||
if distribution == "" || component == "" {
|
if distribution == "" || component == "" {
|
||||||
rootDistributions, rootComponents := walkUpTree(source, collectionFactory)
|
rootDistributions, rootComponents := walkUpTree(source, collectionFactory)
|
||||||
if distribution == "" {
|
if distribution == "" {
|
||||||
for i := range rootDistributions {
|
|
||||||
rootDistributions[i] = strings.Replace(rootDistributions[i], "/", "-", -1)
|
|
||||||
}
|
|
||||||
discoveredDistributions = append(discoveredDistributions, rootDistributions...)
|
discoveredDistributions = append(discoveredDistributions, rootDistributions...)
|
||||||
}
|
}
|
||||||
if component == "" {
|
if component == "" {
|
||||||
@@ -264,10 +261,6 @@ func NewPublishedRepo(storage, prefix, distribution string, architectures []stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(distribution, "/") {
|
|
||||||
return nil, fmt.Errorf("invalid distribution %s, '/' is not allowed", distribution)
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Distribution = distribution
|
result.Distribution = distribution
|
||||||
|
|
||||||
// only fields which are unique by all given snapshots are set on published
|
// only fields which are unique by all given snapshots are set on published
|
||||||
|
|||||||
@@ -187,9 +187,6 @@ func (s *PublishedRepoSuite) TestNewPublishedRepo(c *C) {
|
|||||||
|
|
||||||
_, err := NewPublishedRepo("", ".", "a", nil, []string{"main", "main"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
|
_, err := NewPublishedRepo("", ".", "a", nil, []string{"main", "main"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
|
||||||
c.Check(err, ErrorMatches, "duplicate component name: main")
|
c.Check(err, ErrorMatches, "duplicate component name: main")
|
||||||
|
|
||||||
_, err = NewPublishedRepo("", ".", "wheezy/updates", nil, []string{"main"}, []interface{}{s.snapshot}, s.factory)
|
|
||||||
c.Check(err, ErrorMatches, "invalid distribution wheezy/updates, '/' is not allowed")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PublishedRepoSuite) TestPrefixNormalization(c *C) {
|
func (s *PublishedRepoSuite) TestPrefixNormalization(c *C) {
|
||||||
@@ -290,13 +287,6 @@ func (s *PublishedRepoSuite) TestDistributionComponentGuessing(c *C) {
|
|||||||
c.Check(repo.Distribution, Equals, "precise")
|
c.Check(repo.Distribution, Equals, "precise")
|
||||||
c.Check(repo.Components(), DeepEquals, []string{"contrib"})
|
c.Check(repo.Components(), DeepEquals, []string{"contrib"})
|
||||||
|
|
||||||
s.localRepo.DefaultDistribution = "precise/updates"
|
|
||||||
|
|
||||||
repo, err = NewPublishedRepo("", "ppa", "", nil, []string{""}, []interface{}{s.localRepo}, s.factory)
|
|
||||||
c.Check(err, IsNil)
|
|
||||||
c.Check(repo.Distribution, Equals, "precise-updates")
|
|
||||||
c.Check(repo.Components(), DeepEquals, []string{"contrib"})
|
|
||||||
|
|
||||||
repo, err = NewPublishedRepo("", "ppa", "", nil, []string{"", "contrib"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
|
repo, err = NewPublishedRepo("", "ppa", "", nil, []string{"", "contrib"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
|
||||||
c.Check(err, IsNil)
|
c.Check(err, IsNil)
|
||||||
c.Check(repo.Distribution, Equals, "squeeze")
|
c.Check(repo.Distribution, Equals, "squeeze")
|
||||||
|
|||||||
Reference in New Issue
Block a user