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:
Andrey Smirnov
2014-11-14 00:13:58 +03:00
parent 036baa2264
commit 61e22743af
5 changed files with 63 additions and 2 deletions
+9 -2
View File
@@ -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