From 10bbefeb2596a9537d814662b19f67471cdee460 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Sat, 10 May 2014 16:56:50 +0400 Subject: [PATCH] Fix support for flat format repositories in subdirectories with common pool. #47 --- cmd/mirror_create.go | 3 +- deb/remote.go | 18 ++- deb/remote_test.go | 7 +- man/aptly.1 | 4 +- system/files/jenkins.key | 112 ++++++++++++++++++ system/lib.py | 3 +- .../t04_mirror/CreateMirror14Test_mirror_show | 2 +- system/t04_mirror/CreateMirror21Test_gold | 10 ++ .../t04_mirror/CreateMirror21Test_mirror_show | 13 ++ system/t04_mirror/create.py | 18 ++- 10 files changed, 177 insertions(+), 13 deletions(-) create mode 100644 system/files/jenkins.key create mode 100644 system/t04_mirror/CreateMirror21Test_gold create mode 100644 system/t04_mirror/CreateMirror21Test_mirror_show diff --git a/cmd/mirror_create.go b/cmd/mirror_create.go index 327ef2d0..c5aab1d5 100644 --- a/cmd/mirror_create.go +++ b/cmd/mirror_create.go @@ -63,7 +63,8 @@ func makeCmdMirrorCreate() *commander.Command { Short: "create new mirror", Long: ` Creates mirror of remote repository, aptly supports both regular and flat Debian repositories exported -via HTTP. aptly would try download Release file from remote repository and verify its' signature. +via HTTP. aptly would try download Release file from remote repository and verify its' signature. Command +line format resembles apt utlitily sources.list(5). PPA urls could specified in short format: diff --git a/deb/remote.go b/deb/remote.go index f2c7ba69..7bc53964 100644 --- a/deb/remote.go +++ b/deb/remote.go @@ -13,6 +13,7 @@ import ( "net/url" "os" "path" + "path/filepath" "strconv" "strings" "time" @@ -66,9 +67,11 @@ func NewRemoteRepo(name string, archiveRoot string, distribution string, compone return nil, err } - if result.Distribution == "." || result.Distribution == "./" { + if strings.HasSuffix(result.Distribution, "/") || strings.HasPrefix(result.Distribution, ".") { // flat repo - result.Distribution = "" + if !strings.HasPrefix(result.Distribution, ".") { + result.Distribution = "./" + result.Distribution + } result.Architectures = nil if len(result.Components) > 0 { return nil, fmt.Errorf("components aren't supported for flat repos") @@ -106,7 +109,9 @@ func (repo *RemoteRepo) String() string { // IsFlat determines if repository is flat func (repo *RemoteRepo) IsFlat() bool { - return repo.Distribution == "" + // aptly < 0.5.1 had Distribution = "" for flat repos + // aptly >= 0.5.1 had Distribution = "./[path]/" for flat repos + return repo.Distribution == "" || (strings.HasPrefix(repo.Distribution, ".") && strings.HasSuffix(repo.Distribution, "/")) } // NumPackages return number of packages retrived from remote repo @@ -129,7 +134,7 @@ func (repo *RemoteRepo) ReleaseURL(name string) *url.URL { if !repo.IsFlat() { path = &url.URL{Path: fmt.Sprintf("dists/%s/%s", repo.Distribution, name)} } else { - path = &url.URL{Path: name} + path = &url.URL{Path: filepath.Join(repo.Distribution, name)} } return repo.archiveRootURL.ResolveReference(path) @@ -137,13 +142,13 @@ func (repo *RemoteRepo) ReleaseURL(name string) *url.URL { // FlatBinaryURL returns URL to Packages files for flat repo func (repo *RemoteRepo) FlatBinaryURL() *url.URL { - path := &url.URL{Path: "Packages"} + path := &url.URL{Path: filepath.Join(repo.Distribution, "Packages")} return repo.archiveRootURL.ResolveReference(path) } // FlatSourcesURL returns URL to Sources files for flat repo func (repo *RemoteRepo) FlatSourcesURL() *url.URL { - path := &url.URL{Path: "Sources"} + path := &url.URL{Path: filepath.Join(repo.Distribution, "Sources")} return repo.archiveRootURL.ResolveReference(path) } @@ -341,6 +346,7 @@ func (repo *RemoteRepo) Download(progress aptly.Progress, d aptly.Downloader, co for _, info := range packagesURLs { url, kind := info[0], info[1] + fmt.Printf("repo.ReleaseFiles = %v\n", repo.ReleaseFiles) packagesReader, packagesFile, err := http.DownloadTryCompression(d, url, repo.ReleaseFiles, ignoreMismatch) if err != nil { return err diff --git a/deb/remote_test.go b/deb/remote_test.go index 3cd7d87c..b9bb68ba 100644 --- a/deb/remote_test.go +++ b/deb/remote_test.go @@ -101,10 +101,15 @@ func (s *RemoteRepoSuite) TestInvalidURL(c *C) { } func (s *RemoteRepoSuite) TestFlatCreation(c *C) { - c.Check(s.flat.Distribution, Equals, "") + c.Check(s.flat.IsFlat(), Equals, true) + c.Check(s.flat.Distribution, Equals, "./") c.Check(s.flat.Architectures, IsNil) c.Check(s.flat.Components, IsNil) + flat2, _ := NewRemoteRepo("flat2", "http://pkg.jenkins-ci.org/debian-stable", "binary/", []string{}, []string{}, false) + c.Check(flat2.IsFlat(), Equals, true) + c.Check(flat2.Distribution, Equals, "./binary/") + _, err := NewRemoteRepo("fl", "http://some.repo/", "./", []string{"main"}, []string{}, false) c.Check(err, ErrorMatches, "components aren't supported for flat repos") } diff --git a/man/aptly.1 b/man/aptly.1 index 5f029b75..aca0387b 100644 --- a/man/aptly.1 +++ b/man/aptly.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "APTLY" "1" "April 2014" "" "" +.TH "APTLY" "1" "May 2014" "" "" . .SH "NAME" \fBaptly\fR \- Debian repository management tool @@ -166,7 +166,7 @@ when processing dependencies, follow Suggests \fBaptly\fR \fBmirror\fR \fBcreate\fR \fIname\fR \fIarchive url\fR \fIdistribution\fR [\fIcomponent1\fR \|\.\|\.\|\.] . .P -Creates mirror \fIname\fR of remote repository, aptly supports both regular and flat Debian repositories exported via HTTP\. aptly would try download Release file from remote repository and verify its\(cq signature\. +Creates mirror \fIname\fR of remote repository, aptly supports both regular and flat Debian repositories exported via HTTP\. aptly would try download Release file from remote repository and verify its\(cq signature\. Command line format resembles apt utlitily sources\.list(5)\. . .P PPA urls could specified in short format: diff --git a/system/files/jenkins.key b/system/files/jenkins.key new file mode 100644 index 00000000..7a6e8128 --- /dev/null +++ b/system/files/jenkins.key @@ -0,0 +1,112 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (GNU/Linux) + +mQGiBEmFQG0RBACXScOxb6BTV6rQE/tcJopAEWsdvmE0jNIRWjDDzB7HovX6Anrq +n7+Vq4spAReSFbBVaYiiOx2cGDymj2dyx2i9NAI/9/cQXJOU+RPdDzHVlO1Ed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tevoTE6pCARphY0dzpscCWaXGs/ZqNAhjL96WLYV1Oo +Ut+9mTnOcs6Vuxaxp2wN2S5DK1S9gdIxWEc8wMUPiQe8CYk0OySdORIblMs3bGqD +FoM5HcBAZP1YlXitPH2nIRv0DtOQGMQOCkqUWmQuQAUgKV+YO86lO4S7EhTET/GP +sQb6P7efm/Cs8wbq/wyIiEkEGBECAAkFAkmFQG0CGwwACgkQm30y8tUFgua2mACe +JNBW4snDC4OzjKU6QT386/GA9ssAn3vLzSwn8N1xv5MihWGr5kVzvaE2 +=cjdq +-----END PGP PUBLIC KEY BLOCK----- diff --git a/system/lib.py b/system/lib.py index 7b3b9561..e199d945 100644 --- a/system/lib.py +++ b/system/lib.py @@ -136,7 +136,8 @@ class BaseTest(object): self.run_cmd(["gpg", "--no-default-keyring", "--trust-model", "always", "--batch", "--keyring", "aptlytest.gpg", "--import", os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "debian-archive-keyring.gpg"), os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "launchpad.key"), - os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "flat.key")]) + os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "flat.key"), + os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "jenkins.key")]) if hasattr(self, "fixtureCmds"): for cmd in self.fixtureCmds: diff --git a/system/t04_mirror/CreateMirror14Test_mirror_show b/system/t04_mirror/CreateMirror14Test_mirror_show index 324b6cf2..2789c252 100644 --- a/system/t04_mirror/CreateMirror14Test_mirror_show +++ b/system/t04_mirror/CreateMirror14Test_mirror_show @@ -1,6 +1,6 @@ Name: mirror14 Archive Root URL: http://download.opensuse.org/repositories/home:/DeepDiver1975/xUbuntu_10.04/ -Distribution: +Distribution: ./ Components: Architectures: Download Sources: no diff --git a/system/t04_mirror/CreateMirror21Test_gold b/system/t04_mirror/CreateMirror21Test_gold new file mode 100644 index 00000000..1b6949ec --- /dev/null +++ b/system/t04_mirror/CreateMirror21Test_gold @@ -0,0 +1,10 @@ +Downloading http://pkg.jenkins-ci.org/debian-stable/binary/InRelease... +Downloading http://pkg.jenkins-ci.org/debian-stable/binary/Release... +Downloading http://pkg.jenkins-ci.org/debian-stable/binary/Release.gpg... +gpgv: DSA key ID D50582E6 +gpgv: Good signature from "Kohsuke Kawaguchi " +gpgv: aka "Kohsuke Kawaguchi " +gpgv: aka "[invalid image]" + +Mirror [mirror21]: http://pkg.jenkins-ci.org/debian-stable/ ./binary/ successfully added. +You can run 'aptly mirror update mirror21' to download repository contents. diff --git a/system/t04_mirror/CreateMirror21Test_mirror_show b/system/t04_mirror/CreateMirror21Test_mirror_show new file mode 100644 index 00000000..5bfc806d --- /dev/null +++ b/system/t04_mirror/CreateMirror21Test_mirror_show @@ -0,0 +1,13 @@ +Name: mirror21 +Archive Root URL: http://pkg.jenkins-ci.org/debian-stable/ +Distribution: ./binary/ +Components: +Architectures: +Download Sources: no +Last update: never + +Information from release file: +Architectures: all +Date: Thu, 01 May 2014 05:51:11 UTC +Origin: jenkins-ci.org +Suite: binary diff --git a/system/t04_mirror/create.py b/system/t04_mirror/create.py index b104b659..4faa8277 100644 --- a/system/t04_mirror/create.py +++ b/system/t04_mirror/create.py @@ -211,7 +211,7 @@ class CreateMirror18Test(BaseTest): class CreateMirror19Test(BaseTest): """ - create mirror: mirror with / in components + create mirror: mirror with / in distribution """ fixtureGpg = True outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) @@ -235,3 +235,19 @@ class CreateMirror20Test(BaseTest): runCmd = "aptly -architectures='i386' mirror create -keyring=aptlytest.gpg -with-sources mirror20 http://security.debian.org/ wheezy/updates main" environmentOverride = {"HTTP_PROXY": "127.0.0.1:3137"} expectedCode = 1 + + +class CreateMirror21Test(BaseTest): + """ + create mirror: flat repository in subdir + """ + runCmd = "aptly mirror create -keyring=aptlytest.gpg mirror21 http://pkg.jenkins-ci.org/debian-stable binary/" + fixtureGpg = True + outputMatchPrepare = lambda _, s: re.sub(r'Signature made .* using', '', s) + + def check(self): + def removeSHA512(s): + return re.sub(r"SHA512: .+\n", "", s) + + self.check_output() + self.check_cmd_output("aptly mirror show mirror21", "mirror_show", match_prepare=removeSHA512)