mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
Merge pull request #574 from smira/376-checksum-search-fix
Fix checksum matching from Release file
This commit is contained in:
+33
-34
@@ -7,7 +7,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -191,49 +190,49 @@ func (repo *RemoteRepo) CheckLock() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReleaseURL returns URL to Release* files in repo root
|
// IndexesRootURL builds URL for various indexes
|
||||||
func (repo *RemoteRepo) ReleaseURL(name string) *url.URL {
|
func (repo *RemoteRepo) IndexesRootURL() *url.URL {
|
||||||
var path *url.URL
|
var path *url.URL
|
||||||
|
|
||||||
if !repo.IsFlat() {
|
if !repo.IsFlat() {
|
||||||
path = &url.URL{Path: fmt.Sprintf("dists/%s/%s", repo.Distribution, name)}
|
path = &url.URL{Path: fmt.Sprintf("dists/%s/", repo.Distribution)}
|
||||||
} else {
|
} else {
|
||||||
path = &url.URL{Path: filepath.Join(repo.Distribution, name)}
|
path = &url.URL{Path: fmt.Sprintf("%s", repo.Distribution)}
|
||||||
}
|
}
|
||||||
|
|
||||||
return repo.archiveRootURL.ResolveReference(path)
|
return repo.archiveRootURL.ResolveReference(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatBinaryURL returns URL to Packages files for flat repo
|
// ReleaseURL returns URL to Release* files in repo root
|
||||||
func (repo *RemoteRepo) FlatBinaryURL() *url.URL {
|
func (repo *RemoteRepo) ReleaseURL(name string) *url.URL {
|
||||||
path := &url.URL{Path: filepath.Join(repo.Distribution, "Packages")}
|
return repo.IndexesRootURL().ResolveReference(&url.URL{Path: name})
|
||||||
return repo.archiveRootURL.ResolveReference(path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatSourcesURL returns URL to Sources files for flat repo
|
// FlatBinaryPath returns path to Packages files for flat repo
|
||||||
func (repo *RemoteRepo) FlatSourcesURL() *url.URL {
|
func (repo *RemoteRepo) FlatBinaryPath() string {
|
||||||
path := &url.URL{Path: filepath.Join(repo.Distribution, "Sources")}
|
return "Packages"
|
||||||
return repo.archiveRootURL.ResolveReference(path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// BinaryURL returns URL of Packages files for given component and
|
// FlatSourcesPath returns path to Sources files for flat repo
|
||||||
|
func (repo *RemoteRepo) FlatSourcesPath() string {
|
||||||
|
return "Sources"
|
||||||
|
}
|
||||||
|
|
||||||
|
// BinaryPath returns path to Packages files for given component and
|
||||||
// architecture
|
// architecture
|
||||||
func (repo *RemoteRepo) BinaryURL(component string, architecture string) *url.URL {
|
func (repo *RemoteRepo) BinaryPath(component string, architecture string) string {
|
||||||
path := &url.URL{Path: fmt.Sprintf("dists/%s/%s/binary-%s/Packages", repo.Distribution, component, architecture)}
|
return fmt.Sprintf("%s/binary-%s/Packages", component, architecture)
|
||||||
return repo.archiveRootURL.ResolveReference(path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SourcesURL returns URL of Sources files for given component
|
// SourcesPath returns path to Sources files for given component
|
||||||
func (repo *RemoteRepo) SourcesURL(component string) *url.URL {
|
func (repo *RemoteRepo) SourcesPath(component string) string {
|
||||||
path := &url.URL{Path: fmt.Sprintf("dists/%s/%s/source/Sources", repo.Distribution, component)}
|
return fmt.Sprintf("%s/source/Sources", component)
|
||||||
return repo.archiveRootURL.ResolveReference(path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UdebURL returns URL of Packages files for given component and
|
// UdebPath returns path of Packages files for given component and
|
||||||
// architecture
|
// architecture
|
||||||
func (repo *RemoteRepo) UdebURL(component string, architecture string) *url.URL {
|
func (repo *RemoteRepo) UdebPath(component string, architecture string) string {
|
||||||
path := &url.URL{Path: fmt.Sprintf("dists/%s/%s/debian-installer/binary-%s/Packages", repo.Distribution, component, architecture)}
|
return fmt.Sprintf("%s/debian-installer/binary-%s/Packages", component, architecture)
|
||||||
return repo.archiveRootURL.ResolveReference(path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PackageURL returns URL of package file relative to repository root
|
// PackageURL returns URL of package file relative to repository root
|
||||||
@@ -407,30 +406,30 @@ func (repo *RemoteRepo) DownloadPackageIndexes(progress aptly.Progress, d aptly.
|
|||||||
repo.packageList = NewPackageList()
|
repo.packageList = NewPackageList()
|
||||||
|
|
||||||
// Download and parse all Packages & Source files
|
// Download and parse all Packages & Source files
|
||||||
packagesURLs := [][]string{}
|
packagesPaths := [][]string{}
|
||||||
|
|
||||||
if repo.IsFlat() {
|
if repo.IsFlat() {
|
||||||
packagesURLs = append(packagesURLs, []string{repo.FlatBinaryURL().String(), PackageTypeBinary})
|
packagesPaths = append(packagesPaths, []string{repo.FlatBinaryPath(), PackageTypeBinary})
|
||||||
if repo.DownloadSources {
|
if repo.DownloadSources {
|
||||||
packagesURLs = append(packagesURLs, []string{repo.FlatSourcesURL().String(), PackageTypeSource})
|
packagesPaths = append(packagesPaths, []string{repo.FlatSourcesPath(), PackageTypeSource})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, component := range repo.Components {
|
for _, component := range repo.Components {
|
||||||
for _, architecture := range repo.Architectures {
|
for _, architecture := range repo.Architectures {
|
||||||
packagesURLs = append(packagesURLs, []string{repo.BinaryURL(component, architecture).String(), PackageTypeBinary})
|
packagesPaths = append(packagesPaths, []string{repo.BinaryPath(component, architecture), PackageTypeBinary})
|
||||||
if repo.DownloadUdebs {
|
if repo.DownloadUdebs {
|
||||||
packagesURLs = append(packagesURLs, []string{repo.UdebURL(component, architecture).String(), PackageTypeUdeb})
|
packagesPaths = append(packagesPaths, []string{repo.UdebPath(component, architecture), PackageTypeUdeb})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if repo.DownloadSources {
|
if repo.DownloadSources {
|
||||||
packagesURLs = append(packagesURLs, []string{repo.SourcesURL(component).String(), PackageTypeSource})
|
packagesPaths = append(packagesPaths, []string{repo.SourcesPath(component), PackageTypeSource})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, info := range packagesURLs {
|
for _, info := range packagesPaths {
|
||||||
url, kind := info[0], info[1]
|
path, kind := info[0], info[1]
|
||||||
packagesReader, packagesFile, err := http.DownloadTryCompression(d, url, repo.ReleaseFiles, ignoreMismatch, maxTries)
|
packagesReader, packagesFile, err := http.DownloadTryCompression(d, repo.IndexesRootURL(), path, repo.ReleaseFiles, ignoreMismatch, maxTries)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-10
@@ -157,24 +157,30 @@ func (s *RemoteRepoSuite) TestReleaseURL(c *C) {
|
|||||||
c.Assert(s.flat.ReleaseURL("Release").String(), Equals, "http://repos.express42.com/virool/precise/Release")
|
c.Assert(s.flat.ReleaseURL("Release").String(), Equals, "http://repos.express42.com/virool/precise/Release")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoSuite) TestBinaryURL(c *C) {
|
func (s *RemoteRepoSuite) TestIndexesRootURL(c *C) {
|
||||||
c.Assert(s.repo.BinaryURL("main", "amd64").String(), Equals, "http://mirror.yandex.ru/debian/dists/squeeze/main/binary-amd64/Packages")
|
c.Assert(s.repo.IndexesRootURL().String(), Equals, "http://mirror.yandex.ru/debian/dists/squeeze/")
|
||||||
|
|
||||||
|
c.Assert(s.flat.IndexesRootURL().String(), Equals, "http://repos.express42.com/virool/precise/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoSuite) TestUdebURL(c *C) {
|
func (s *RemoteRepoSuite) TestBinaryPath(c *C) {
|
||||||
c.Assert(s.repo.UdebURL("main", "amd64").String(), Equals, "http://mirror.yandex.ru/debian/dists/squeeze/main/debian-installer/binary-amd64/Packages")
|
c.Assert(s.repo.BinaryPath("main", "amd64"), Equals, "main/binary-amd64/Packages")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoSuite) TestSourcesURL(c *C) {
|
func (s *RemoteRepoSuite) TestUdebPath(c *C) {
|
||||||
c.Assert(s.repo.SourcesURL("main").String(), Equals, "http://mirror.yandex.ru/debian/dists/squeeze/main/source/Sources")
|
c.Assert(s.repo.UdebPath("main", "amd64"), Equals, "main/debian-installer/binary-amd64/Packages")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoSuite) TestFlatBinaryURL(c *C) {
|
func (s *RemoteRepoSuite) TestSourcesPath(c *C) {
|
||||||
c.Assert(s.flat.FlatBinaryURL().String(), Equals, "http://repos.express42.com/virool/precise/Packages")
|
c.Assert(s.repo.SourcesPath("main"), Equals, "main/source/Sources")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoSuite) TestFlatSourcesURL(c *C) {
|
func (s *RemoteRepoSuite) TestFlatBinaryPath(c *C) {
|
||||||
c.Assert(s.flat.FlatSourcesURL().String(), Equals, "http://repos.express42.com/virool/precise/Sources")
|
c.Assert(s.flat.FlatBinaryPath(), Equals, "Packages")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RemoteRepoSuite) TestFlatSourcesPath(c *C) {
|
||||||
|
c.Assert(s.flat.FlatSourcesPath(), Equals, "Sources")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RemoteRepoSuite) TestPackageURL(c *C) {
|
func (s *RemoteRepoSuite) TestPackageURL(c *C) {
|
||||||
|
|||||||
+18
-9
@@ -5,6 +5,7 @@ import (
|
|||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -38,29 +39,37 @@ var compressionMethods = []struct {
|
|||||||
|
|
||||||
// DownloadTryCompression tries to download from URL .bz2, .gz and raw extension until
|
// DownloadTryCompression tries to download from URL .bz2, .gz and raw extension until
|
||||||
// it finds existing file.
|
// it finds existing file.
|
||||||
func DownloadTryCompression(downloader aptly.Downloader, url string, expectedChecksums map[string]utils.ChecksumInfo, ignoreMismatch bool, maxTries int) (io.Reader, *os.File, error) {
|
func DownloadTryCompression(downloader aptly.Downloader, baseURL *url.URL, path string, expectedChecksums map[string]utils.ChecksumInfo, ignoreMismatch bool, maxTries int) (io.Reader, *os.File, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
for _, method := range compressionMethods {
|
for _, method := range compressionMethods {
|
||||||
var file *os.File
|
var file *os.File
|
||||||
|
|
||||||
tryURL := url + method.extenstion
|
tryPath := path + method.extenstion
|
||||||
foundChecksum := false
|
foundChecksum := false
|
||||||
|
|
||||||
for suffix, expected := range expectedChecksums {
|
bestSuffix := ""
|
||||||
if strings.HasSuffix(tryURL, suffix) {
|
|
||||||
file, err = DownloadTempWithChecksum(downloader, tryURL, &expected, ignoreMismatch, maxTries)
|
for suffix := range expectedChecksums {
|
||||||
|
if strings.HasSuffix(tryPath, suffix) {
|
||||||
foundChecksum = true
|
foundChecksum = true
|
||||||
break
|
if len(suffix) > len(bestSuffix) {
|
||||||
|
bestSuffix = suffix
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !foundChecksum {
|
tryURL := baseURL.ResolveReference(&url.URL{Path: tryPath})
|
||||||
|
|
||||||
|
if foundChecksum {
|
||||||
|
expected := expectedChecksums[bestSuffix]
|
||||||
|
file, err = DownloadTempWithChecksum(downloader, tryURL.String(), &expected, ignoreMismatch, maxTries)
|
||||||
|
} else {
|
||||||
if !ignoreMismatch {
|
if !ignoreMismatch {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err = DownloadTemp(downloader, tryURL)
|
file, err = DownloadTemp(downloader, tryURL.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -80,7 +89,7 @@ func DownloadTryCompression(downloader aptly.Downloader, url string, expectedChe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = fmt.Errorf("no candidates for %s found", url)
|
err = fmt.Errorf("no candidates for %s found", baseURL.ResolveReference(&url.URL{Path: path}))
|
||||||
}
|
}
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,16 @@ package http
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
"github.com/smira/aptly/utils"
|
"github.com/smira/aptly/utils"
|
||||||
|
|
||||||
. "gopkg.in/check.v1"
|
. "gopkg.in/check.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CompressionSuite struct{}
|
type CompressionSuite struct {
|
||||||
|
baseURL *url.URL
|
||||||
|
}
|
||||||
|
|
||||||
var _ = Suite(&CompressionSuite{})
|
var _ = Suite(&CompressionSuite{})
|
||||||
|
|
||||||
@@ -20,6 +23,10 @@ const (
|
|||||||
rawData = "test"
|
rawData = "test"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (s *CompressionSuite) SetUpTest(c *C) {
|
||||||
|
s.baseURL, _ = url.Parse("http://example.com/")
|
||||||
|
}
|
||||||
|
|
||||||
func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
||||||
var buf []byte
|
var buf []byte
|
||||||
|
|
||||||
@@ -34,7 +41,7 @@ func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
|||||||
buf = make([]byte, 4)
|
buf = make([]byte, 4)
|
||||||
d := NewFakeDownloader()
|
d := NewFakeDownloader()
|
||||||
d.ExpectResponse("http://example.com/file.bz2", bzipData)
|
d.ExpectResponse("http://example.com/file.bz2", bzipData)
|
||||||
r, file, err := DownloadTryCompression(d, "http://example.com/file", expectedChecksums, false, 1)
|
r, file, err := DownloadTryCompression(d, s.baseURL, "file", expectedChecksums, false, 1)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
io.ReadFull(r, buf)
|
io.ReadFull(r, buf)
|
||||||
@@ -46,7 +53,7 @@ func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
|||||||
d = NewFakeDownloader()
|
d = NewFakeDownloader()
|
||||||
d.ExpectError("http://example.com/file.bz2", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.bz2", &Error{Code: 404})
|
||||||
d.ExpectResponse("http://example.com/file.gz", gzipData)
|
d.ExpectResponse("http://example.com/file.gz", gzipData)
|
||||||
r, file, err = DownloadTryCompression(d, "http://example.com/file", expectedChecksums, false, 1)
|
r, file, err = DownloadTryCompression(d, s.baseURL, "file", expectedChecksums, false, 1)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
io.ReadFull(r, buf)
|
io.ReadFull(r, buf)
|
||||||
@@ -59,7 +66,7 @@ func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
|||||||
d.ExpectError("http://example.com/file.bz2", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.bz2", &Error{Code: 404})
|
||||||
d.ExpectError("http://example.com/file.gz", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.gz", &Error{Code: 404})
|
||||||
d.ExpectResponse("http://example.com/file.xz", xzData)
|
d.ExpectResponse("http://example.com/file.xz", xzData)
|
||||||
r, file, err = DownloadTryCompression(d, "http://example.com/file", expectedChecksums, false, 1)
|
r, file, err = DownloadTryCompression(d, s.baseURL, "file", expectedChecksums, false, 1)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
io.ReadFull(r, buf)
|
io.ReadFull(r, buf)
|
||||||
@@ -73,7 +80,7 @@ func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
|||||||
d.ExpectError("http://example.com/file.gz", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.gz", &Error{Code: 404})
|
||||||
d.ExpectError("http://example.com/file.xz", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.xz", &Error{Code: 404})
|
||||||
d.ExpectResponse("http://example.com/file", rawData)
|
d.ExpectResponse("http://example.com/file", rawData)
|
||||||
r, file, err = DownloadTryCompression(d, "http://example.com/file", expectedChecksums, false, 1)
|
r, file, err = DownloadTryCompression(d, s.baseURL, "file", expectedChecksums, false, 1)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
io.ReadFull(r, buf)
|
io.ReadFull(r, buf)
|
||||||
@@ -84,14 +91,35 @@ func (s *CompressionSuite) TestDownloadTryCompression(c *C) {
|
|||||||
d = NewFakeDownloader()
|
d = NewFakeDownloader()
|
||||||
d.ExpectError("http://example.com/file.bz2", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.bz2", &Error{Code: 404})
|
||||||
d.ExpectResponse("http://example.com/file.gz", "x")
|
d.ExpectResponse("http://example.com/file.gz", "x")
|
||||||
_, _, err = DownloadTryCompression(d, "http://example.com/file", nil, true, 1)
|
_, _, err = DownloadTryCompression(d, s.baseURL, "file", nil, true, 1)
|
||||||
c.Assert(err, ErrorMatches, "unexpected EOF")
|
c.Assert(err, ErrorMatches, "unexpected EOF")
|
||||||
c.Assert(d.Empty(), Equals, true)
|
c.Assert(d.Empty(), Equals, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *CompressionSuite) TestDownloadTryCompressionLongestSuffix(c *C) {
|
||||||
|
var buf []byte
|
||||||
|
|
||||||
|
expectedChecksums := map[string]utils.ChecksumInfo{
|
||||||
|
"file.bz2": {Size: 1},
|
||||||
|
"subdir/file.bz2": {Size: int64(len(bzipData))},
|
||||||
|
"otherdir/file.bz2": {Size: 1},
|
||||||
|
}
|
||||||
|
|
||||||
|
// longest suffix should be picked up
|
||||||
|
buf = make([]byte, 4)
|
||||||
|
d := NewFakeDownloader()
|
||||||
|
d.ExpectResponse("http://example.com/subdir/file.bz2", bzipData)
|
||||||
|
r, file, err := DownloadTryCompression(d, s.baseURL, "subdir/file", expectedChecksums, false, 1)
|
||||||
|
c.Assert(err, IsNil)
|
||||||
|
defer file.Close()
|
||||||
|
io.ReadFull(r, buf)
|
||||||
|
c.Assert(string(buf), Equals, rawData)
|
||||||
|
c.Assert(d.Empty(), Equals, true)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *CompressionSuite) TestDownloadTryCompressionErrors(c *C) {
|
func (s *CompressionSuite) TestDownloadTryCompressionErrors(c *C) {
|
||||||
d := NewFakeDownloader()
|
d := NewFakeDownloader()
|
||||||
_, _, err := DownloadTryCompression(d, "http://example.com/file", nil, true, 1)
|
_, _, err := DownloadTryCompression(d, s.baseURL, "file", nil, true, 1)
|
||||||
c.Assert(err, ErrorMatches, "unexpected request.*")
|
c.Assert(err, ErrorMatches, "unexpected request.*")
|
||||||
|
|
||||||
d = NewFakeDownloader()
|
d = NewFakeDownloader()
|
||||||
@@ -99,7 +127,7 @@ func (s *CompressionSuite) TestDownloadTryCompressionErrors(c *C) {
|
|||||||
d.ExpectError("http://example.com/file.gz", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.gz", &Error{Code: 404})
|
||||||
d.ExpectError("http://example.com/file.xz", &Error{Code: 404})
|
d.ExpectError("http://example.com/file.xz", &Error{Code: 404})
|
||||||
d.ExpectError("http://example.com/file", errors.New("403"))
|
d.ExpectError("http://example.com/file", errors.New("403"))
|
||||||
_, _, err = DownloadTryCompression(d, "http://example.com/file", nil, true, 1)
|
_, _, err = DownloadTryCompression(d, s.baseURL, "file", nil, true, 1)
|
||||||
c.Assert(err, ErrorMatches, "403")
|
c.Assert(err, ErrorMatches, "403")
|
||||||
|
|
||||||
d = NewFakeDownloader()
|
d = NewFakeDownloader()
|
||||||
@@ -113,6 +141,6 @@ func (s *CompressionSuite) TestDownloadTryCompressionErrors(c *C) {
|
|||||||
"file.xz": {Size: 7},
|
"file.xz": {Size: 7},
|
||||||
"file": {Size: 7},
|
"file": {Size: 7},
|
||||||
}
|
}
|
||||||
_, _, err = DownloadTryCompression(d, "http://example.com/file", expectedChecksums, false, 1)
|
_, _, err = DownloadTryCompression(d, s.baseURL, "file", expectedChecksums, false, 1)
|
||||||
c.Assert(err, ErrorMatches, "checksums don't match.*")
|
c.Assert(err, ErrorMatches, "checksums don't match.*")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
Version: GnuPG v1.4.13 (Darwin)
|
||||||
|
|
||||||
|
mQINBFMwev8BEADFbEQsBDRFBGwrJ+NNo7mAUYq8/gykWh2vnHktjGT+wPKdKOtk
|
||||||
|
hq99Y4p+AL9fp+TT23bnsAcbYf5O7oeHRrD710jWfiE3+3d6tqvF1cputJxrH+TT
|
||||||
|
uWlL3bPtJ9nVc8/wpR87aJSMu0+KseoVQI3tfSsiXm/WVcIr0NzcNw0WIV9Dzbd6
|
||||||
|
Vf0Pfzq3/Bo3m22ioEHRMZCwcyXz/VG4/loGpUjiut+VJo9rGVoW0I3uxWnANP9M
|
||||||
|
YcjhbXwA5IPv+ivplX0As1oHR54hLCQgw6lcRS8Q0G1qKvKp0Yyyxx+vFmtDiUak
|
||||||
|
F+Qfejem0gm1vpi5DMI3g/hOGLYeAZ5REEpJJsXPr0e9WdCgg3VxJGyNFF33eAxT
|
||||||
|
snIOSMCLSZyg1OEPbeOj0FrCJ0t4Fgj/XtDOFzJgAX5QJa5pDuUl36XnYSnSKooQ
|
||||||
|
604mKJ99NveMcGnj+1JBdR02Qrl2yRghVXTuuWYHl1mLuG8TbX5esyuiPrOo8F97
|
||||||
|
qH4zopg9Alstp2nn231dI35K2xKvceD0IRZKaJBDzDvyATx0PEQOeiuldsXVgYZE
|
||||||
|
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BFpluDOHRKxByufeK9YBRSMKNWXZ3kb76H2MQ
|
||||||
|
WxuZCjOGsTWVAqxazRlbnJp5o+71dTSdoPoqxKVZMI+rbucUjhfTu9Di9PZgm2yY
|
||||||
|
fqqM1jQCqlzp6eyrthCiXavgEItU8yg8xA6UbErRTBk1mrghLI/4d2HZ4RT2Ltb7
|
||||||
|
n/yynUlNg3aAepd3MDEBhpTm8M+lipQOQJ85XF5ENsM3QiApTAXfMQX7oMN5xGOk
|
||||||
|
nwvnLlXQc+NMBxEYo9nXYaV4IS1gF/IXu+3Z/UC6BJS6BD1KUWQUbRUnAw7UpT7I
|
||||||
|
nULitJpLztjKdlIhNgv+RBGphaz7ps9LDEd+SrH3cw7fID6ICRvoXvkcc+r+HUeQ
|
||||||
|
e+wthyPxn6KWC1P9QvrLBV+M5p6H0CdO6o0pv/XB8FV9qN5IQltSH8jQSZ/HpwYT
|
||||||
|
VOAYT8FmpduWZ43OOoRk1Kj9sygUmazIRaCH/1gkzjCbN3/rEmmLgMEMR1Ki+9Vg
|
||||||
|
Q3dhcorwOdN/vh/rhEcusFTDPhHSypF9aDRVfNFCjVBN0XhhzYhfhirdol5Z02oi
|
||||||
|
cu9OA+4fuB+31GRaH1NtPp4MLUrZQtKrOaSAaX67APt1hydlulsX1UTDkrS/C7rw
|
||||||
|
RiU9bhqMiXthkmmYFsCA40tGoVY39PWzZg==
|
||||||
|
=C8n/
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
@@ -136,6 +136,7 @@ class BaseTest(object):
|
|||||||
os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "debian-archive-keyring.gpg"),
|
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", "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", "pagerduty.key"),
|
||||||
os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "jenkins.key")])
|
os.path.join(os.path.dirname(inspect.getsourcefile(BaseTest)), "files", "jenkins.key")])
|
||||||
|
|
||||||
if hasattr(self, "fixtureCmds"):
|
if hasattr(self, "fixtureCmds"):
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
Downloading http://packages.pagerduty.com/pdagent/deb/InRelease...
|
||||||
|
Downloading http://packages.pagerduty.com/pdagent/deb/Release...
|
||||||
|
Downloading http://packages.pagerduty.com/pdagent/deb/Release.gpg...
|
||||||
|
gpgv: RSA key ID F8253540
|
||||||
|
gpgv: Good signature from "Package Maintainer (PagerDuty, Inc.) <packages@pagerduty.com>"
|
||||||
|
Downloading & parsing package files...
|
||||||
|
Downloading http://packages.pagerduty.com/pdagent/deb/Packages.gz...
|
||||||
|
Building download queue...
|
||||||
|
Download queue: 13 items (1.66 MiB)
|
||||||
|
|
||||||
|
Mirror `pagerduty` has been successfully updated.
|
||||||
@@ -311,3 +311,19 @@ class UpdateMirror18Test(BaseTest):
|
|||||||
super(UpdateMirror18Test, self).check()
|
super(UpdateMirror18Test, self).check()
|
||||||
# check pool
|
# check pool
|
||||||
self.check_exists('pool/c7/6b/4bd12fd92e4dfe1b55b18a67a669_libboost-program-options-dev_1.49.0.1_i386.deb')
|
self.check_exists('pool/c7/6b/4bd12fd92e4dfe1b55b18a67a669_libboost-program-options-dev_1.49.0.1_i386.deb')
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateMirror19Test(BaseTest):
|
||||||
|
"""
|
||||||
|
update mirrors: correct matching of Release checksums
|
||||||
|
"""
|
||||||
|
longTest = False
|
||||||
|
fixtureGpg = True
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly mirror create --keyring=aptlytest.gpg pagerduty http://packages.pagerduty.com/pdagent deb/"
|
||||||
|
]
|
||||||
|
runCmd = "aptly mirror update --keyring=aptlytest.gpg pagerduty"
|
||||||
|
outputMatchPrepare = filterOutSignature
|
||||||
|
|
||||||
|
def output_processor(self, output):
|
||||||
|
return "\n".join(line for line in output.split("\n") if ".deb" not in line)
|
||||||
|
|||||||
Reference in New Issue
Block a user