Skip to content

Commit

Permalink
Revert "Don't allow '/' in distribution name, auto-replace '/' with '…
Browse files Browse the repository at this point in the history
…-' while guessing. #110"

This reverts commit 1daa076.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
  • Loading branch information
adalessandro authored and neolynx committed Apr 11, 2024
1 parent 32595e7 commit 287a947
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
7 changes: 0 additions & 7 deletions deb/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ func NewPublishedRepo(storage, prefix, distribution string, architectures []stri
if distribution == "" || component == "" {
rootDistributions, rootComponents := walkUpTree(source, collectionFactory)
if distribution == "" {
for i := range rootDistributions {
rootDistributions[i] = strings.Replace(rootDistributions[i], "/", "-", -1)
}
discoveredDistributions = append(discoveredDistributions, rootDistributions...)
}
if component == "" {
Expand Down Expand Up @@ -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

// only fields which are unique by all given snapshots are set on published
Expand Down
10 changes: 0 additions & 10 deletions deb/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ func (s *PublishedRepoSuite) TestNewPublishedRepo(c *C) {

_, err := NewPublishedRepo("", ".", "a", nil, []string{"main", "main"}, []interface{}{s.snapshot, s.snapshot2}, s.factory)
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) {
Expand Down Expand Up @@ -290,13 +287,6 @@ func (s *PublishedRepoSuite) TestDistributionComponentGuessing(c *C) {
c.Check(repo.Distribution, Equals, "precise")
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)
c.Check(err, IsNil)
c.Check(repo.Distribution, Equals, "squeeze")
Expand Down

0 comments on commit 287a947

Please sign in to comment.