Skip to content

Commit

Permalink
Merge pull request #26 from cybozu-go/fix#25
Browse files Browse the repository at this point in the history
[mirror] treat suite "/" as empty & flat.
  • Loading branch information
ymmt2005 committed Oct 10, 2017
2 parents f66357d + 300f46a commit 66c646f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mirror/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ func (mc *MirrConfig) ReleaseFiles(suite string) []string {
if !isFlat(suite) {
relpath = path.Join("dists", suite)
}
// <suite "/"> == <empty relative path ""> + <flat repository indicator "/">
// != <absolute path "/">
if suite == "/" {
relpath = ""
}
l = append(l, path.Clean(path.Join(relpath, "Release")))
l = append(l, path.Clean(path.Join(relpath, "Release.gpg")))
l = append(l, path.Clean(path.Join(relpath, "Release.gz")))
Expand Down
8 changes: 8 additions & 0 deletions mirror/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ func TestMirrorConfig(t *testing.T) {
t.Error(`_, ok := m["14.04/InRelease"]; !ok`)
}

m = make(map[string]struct{})
for _, p := range mc.ReleaseFiles("/") {
m[p] = struct{}{}
}
if _, ok := m["Release.gz"]; !ok {
t.Error(`_, ok := m["Release.gz"]; !ok`)
}

correct = "http://my.local.domain/cybozu/14.04/cybozu_1.0.0_amd64.deb"
if mc.Resolve("./14.04/cybozu_1.0.0_amd64.deb").String() != correct {
t.Error(`mc.Resolve("14.04/cybozu_1.0.0_amd64.deb").String() != correct`)
Expand Down
2 changes: 1 addition & 1 deletion mirror/t/mirror.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ architectures = ["amd64"]

[mirror.flat]
url = "http://my.local.domain/cybozu"
suites = ["12.04/", "14.04/"]
suites = ["12.04/", "14.04/", "/"]

0 comments on commit 66c646f

Please sign in to comment.