From 84ef963d7dc573fe191711c302699caf2c04c411 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 9 Aug 2017 00:17:40 +0300 Subject: [PATCH] Trim slashes while parsing publish prefix Fixes: #607 --- deb/publish.go | 1 + system/t06_publish/PublishDrop7Test_gold | 4 ++++ system/t06_publish/drop.py | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 system/t06_publish/PublishDrop7Test_gold diff --git a/deb/publish.go b/deb/publish.go index 9ff78bd6..59d722aa 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -78,6 +78,7 @@ func ParsePrefix(param string) (storage, prefix string) { } else { prefix = param } + prefix = strings.TrimPrefix(strings.TrimSuffix(prefix, "/"), "/") return } diff --git a/system/t06_publish/PublishDrop7Test_gold b/system/t06_publish/PublishDrop7Test_gold new file mode 100644 index 00000000..c3758e10 --- /dev/null +++ b/system/t06_publish/PublishDrop7Test_gold @@ -0,0 +1,4 @@ +Removing ${HOME}/.aptly/public/ppa/smira/dists... +Removing ${HOME}/.aptly/public/ppa/smira/pool... + +Published repository has been removed successfully. diff --git a/system/t06_publish/drop.py b/system/t06_publish/drop.py index 31e656c4..8660df10 100644 --- a/system/t06_publish/drop.py +++ b/system/t06_publish/drop.py @@ -122,3 +122,24 @@ class PublishDrop6Test(BaseTest): """ runCmd = "aptly publish drop sq1" expectedCode = 1 + + +class PublishDrop7Test(BaseTest): + """ + publish drop: under prefix with trailing & leading slashes + """ + fixtureDB = True + fixturePool = True + fixtureCmds = [ + "aptly snapshot create snap1 from mirror gnuplot-maverick", + "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap1 ppa/smira/", + ] + runCmd = "aptly publish drop maverick /ppa/smira/" + gold_processor = BaseTest.expand_environ + + def check(self): + super(PublishDrop7Test, self).check() + + self.check_not_exists('public/ppa/smira/dists/') + self.check_not_exists('public/ppa/smira/pool/') + self.check_exists('public/ppa/smira/')