diff --git a/deb/remote.go b/deb/remote.go index 08064244..3ec670bb 100644 --- a/deb/remote.go +++ b/deb/remote.go @@ -323,8 +323,13 @@ ok: } components := strings.Split(stanza["Components"], " ") - for i := range components { - components[i] = path.Base(components[i]) + if strings.Contains(repo.Distribution, "/") { + distributionLast := path.Base(repo.Distribution) + "/" + for i := range components { + if strings.HasPrefix(components[i], distributionLast) { + components[i] = components[i][len(distributionLast):] + } + } } if len(repo.Components) == 0 { repo.Components = components @@ -385,6 +390,8 @@ ok: return err } + delete(stanza, "SHA512") + repo.Meta = stanza return nil diff --git a/system/t04_mirror/CreateMirror27Test_gold b/system/t04_mirror/CreateMirror27Test_gold new file mode 100644 index 00000000..2fe4f9ac --- /dev/null +++ b/system/t04_mirror/CreateMirror27Test_gold @@ -0,0 +1,4 @@ +Downloading http://linux.dell.com/repo/community/ubuntu/dists/wheezy/Release... + +Mirror [mirror27]: http://linux.dell.com/repo/community/ubuntu/ wheezy successfully added. +You can run 'aptly mirror update mirror27' to download repository contents. diff --git a/system/t04_mirror/CreateMirror27Test_mirror_show b/system/t04_mirror/CreateMirror27Test_mirror_show new file mode 100644 index 00000000..41412dd9 --- /dev/null +++ b/system/t04_mirror/CreateMirror27Test_mirror_show @@ -0,0 +1,19 @@ +Name: mirror27 +Archive Root URL: http://linux.dell.com/repo/community/ubuntu/ +Distribution: wheezy +Components: openmanage/740 +Architectures: amd64, i386 +Download Sources: no +Download .udebs: no +Last update: never + +Information from release file: +Architectures: amd64 i386 source +Codename: wheezy +Components: openmanage openmanage/801 openmanage/740 openmanage/730 +Date: Wed, 22 Oct 2014 18:50:39 UTC +Description: Unofficial Dell OMSA build for Ubuntu + +Label: Dell OMSA Archive +Origin: Dell Inc +Suite: wheezy diff --git a/system/t04_mirror/create.py b/system/t04_mirror/create.py index 0e469e33..89b7c19f 100644 --- a/system/t04_mirror/create.py +++ b/system/t04_mirror/create.py @@ -306,3 +306,14 @@ class CreateMirror26Test(BaseTest): runCmd = "aptly mirror create -keyring=aptlytest.gpg -with-udebs mirror26 http://pkg.jenkins-ci.org/debian-stable binary/" fixtureGpg = True expectedCode = 1 + + +class CreateMirror27Test(BaseTest): + """ + create mirror: component with slashes, no stripping + """ + runCmd = "aptly mirror create --ignore-signatures mirror27 http://linux.dell.com/repo/community/ubuntu wheezy openmanage/740" + + def check(self): + self.check_output() + self.check_cmd_output("aptly mirror show mirror27", "mirror_show") diff --git a/system/t12_api/repos.py b/system/t12_api/repos.py index 2f66fbc3..ff1b863c 100644 --- a/system/t12_api/repos.py +++ b/system/t12_api/repos.py @@ -139,3 +139,23 @@ class ReposAPITestAddFile(APITest): ['Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378']) self.check_not_exists("upload/" + d) + + +class ReposAPITestShowQuery(APITest): + """ + GET /api/repos/:name/packages?q=query + """ + def check(self): + repo_name = self.random_name() + + self.check_equal(self.post("/api/repos", json={"Name": repo_name, "Comment": "fun repo"}).status_code, 201) + + d = self.random_name() + self.check_equal(self.upload("/api/files/" + d, + "libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc", + "pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz", + "pyspi-0.6.1-1.3.stripped.dsc").status_code, 200) + self.check_equal(self.post("/api/repos/" + repo_name + "/file/" + d).status_code, 200) + + self.check_equal(self.get("/api/repos/" + repo_name + "/packages", params={"q": "pyspi"}).json(), + ['Psource pyspi 0.6.1-1.3 3a8b37cbd9a3559e', 'Psource pyspi 0.6.1-1.4 f8f1daa806004e89'])