From 287a947c628e77e6f66f0a248ddb0ce1aafc6a80 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Fri, 24 Jun 2022 11:28:35 -0300 Subject: [PATCH] Revert "Don't allow '/' in distribution name, auto-replace '/' with '-' while guessing. #110" This reverts commit 1daa076d65e642f2f365e3cd580a78548a9b65a6. Signed-off-by: Ariel D'Alessandro --- deb/publish.go | 7 ------- deb/publish_test.go | 10 ---------- 2 files changed, 17 deletions(-) diff --git a/deb/publish.go b/deb/publish.go index 5932f926..09ecbb83 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -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 == "" { @@ -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 diff --git a/deb/publish_test.go b/deb/publish_test.go index 4850720f..ec9c940a 100644 --- a/deb/publish_test.go +++ b/deb/publish_test.go @@ -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) { @@ -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")