mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-01 04:40:38 +00:00
Fix for stripping part with slashes from component names. #140
Now aptly won't strip by default, but if distribution contains slash (like 'wheezy/updates')
and component starts with last part of distribution ('updates/main'), it would be stripped.
This commit is contained in:
+9
-2
@@ -323,8 +323,13 @@ ok:
|
|||||||
}
|
}
|
||||||
|
|
||||||
components := strings.Split(stanza["Components"], " ")
|
components := strings.Split(stanza["Components"], " ")
|
||||||
for i := range components {
|
if strings.Contains(repo.Distribution, "/") {
|
||||||
components[i] = path.Base(components[i])
|
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 {
|
if len(repo.Components) == 0 {
|
||||||
repo.Components = components
|
repo.Components = components
|
||||||
@@ -385,6 +390,8 @@ ok:
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete(stanza, "SHA512")
|
||||||
|
|
||||||
repo.Meta = stanza
|
repo.Meta = stanza
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -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
|
||||||
@@ -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/"
|
runCmd = "aptly mirror create -keyring=aptlytest.gpg -with-udebs mirror26 http://pkg.jenkins-ci.org/debian-stable binary/"
|
||||||
fixtureGpg = True
|
fixtureGpg = True
|
||||||
expectedCode = 1
|
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")
|
||||||
|
|||||||
@@ -139,3 +139,23 @@ class ReposAPITestAddFile(APITest):
|
|||||||
['Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378'])
|
['Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378'])
|
||||||
|
|
||||||
self.check_not_exists("upload/" + d)
|
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'])
|
||||||
|
|||||||
Reference in New Issue
Block a user