diff --git a/deb/list_test.go b/deb/list_test.go index 869dc67f..07dbe8c7 100644 --- a/deb/list_test.go +++ b/deb/list_test.go @@ -709,9 +709,9 @@ func (s *PackageListSuite) TestArchitectureVariantIndexArchitectures(c *C) { func (s *PackageListSuite) TestArchitectureVariantFullNames(c *C) { for _, variant := range []string{"", "amd64v3"} { - c.Assert(s.list.Add(&Package{Name: "3cpio", Version: "0.14.0-1ubuntu1", Architecture: "amd64", ArchitectureVariant: variant}), IsNil) + c.Assert(s.list.Add(&Package{Name: "test-package", Version: "1.0", Architecture: "amd64", ArchitectureVariant: variant}), IsNil) } names := s.list.FullNames() sort.Strings(names) - c.Check(names, DeepEquals, []string{"3cpio_0.14.0-1ubuntu1_amd64", "3cpio_0.14.0-1ubuntu1_amd64v3"}) + c.Check(names, DeepEquals, []string{"test-package_1.0_amd64", "test-package_1.0_amd64v3"}) } diff --git a/deb/package_collection_test.go b/deb/package_collection_test.go index 9b1c8ee8..38d123cb 100644 --- a/deb/package_collection_test.go +++ b/deb/package_collection_test.go @@ -69,7 +69,7 @@ func architectureVariantCollectionPackage(variant string) *Package { stanza := Stanza{ "Package": "example", "Version": "1.0", "Architecture": "amd64", "Filename": "pool/example_1.0_amd64.deb", "Size": "123", - "Depends": "libc6 (>= 2.7)", "Priority": "optional", + "Depends": "test-dependency (>= 1.0)", "Priority": "optional", } if variant != "" { stanza["Architecture-Variant"] = variant @@ -92,7 +92,7 @@ func (s *PackageCollectionSuite) TestArchitectureVariantNormalRoundTrip(c *C) { c.Check(loaded.Key(""), DeepEquals, key) c.Check(loaded.Equals(p), Equals, true) c.Check(loaded.Files()[0].Filename, Equals, "example_1.0_amd64.deb") - c.Check(loaded.GetDependencies(0), DeepEquals, []string{"libc6 (>= 2.7)"}) + c.Check(loaded.GetDependencies(0), DeepEquals, []string{"test-dependency (>= 1.0)"}) c.Check(loaded.Extra()["Priority"], Equals, "optional") _, hasVariant := loaded.Stanza()["Architecture-Variant"] c.Check(hasVariant, Equals, false) @@ -113,7 +113,7 @@ func (s *PackageCollectionSuite) TestArchitectureVariantRoundTrip(c *C) { c.Check(loaded.Equals(p), Equals, true) // Exercise offloaded records using the reloaded variant-aware key. c.Check(loaded.Files()[0].Filename, Equals, "example_1.0_amd64v3.deb") - c.Check(loaded.GetDependencies(0), DeepEquals, []string{"libc6 (>= 2.7)"}) + c.Check(loaded.GetDependencies(0), DeepEquals, []string{"test-dependency (>= 1.0)"}) c.Check(loaded.Extra()["Priority"], Equals, "optional") stanza := loaded.Stanza() c.Check(stanza["Architecture"], Equals, "amd64") diff --git a/deb/package_test.go b/deb/package_test.go index 55523d1f..7d9d82ee 100644 --- a/deb/package_test.go +++ b/deb/package_test.go @@ -606,10 +606,10 @@ func (s *PackageSuite) TestArchitectureVariantMatchesIndexArchitecture(c *C) { func (s *PackageSuite) TestArchitectureVariantDisplayNames(c *C) { for _, variant := range []string{"", "amd64v3"} { - p := &Package{Name: "3cpio", Version: "0.14.0-1ubuntu1", Architecture: "amd64", ArchitectureVariant: variant} - expected := "3cpio_0.14.0-1ubuntu1_amd64" + p := &Package{Name: "test-package", Version: "1.0", Architecture: "amd64", ArchitectureVariant: variant} + expected := "test-package_1.0_amd64" if variant != "" { - expected = "3cpio_0.14.0-1ubuntu1_amd64v3" + expected = "test-package_1.0_amd64v3" } c.Check(p.String(), Equals, expected) c.Check(p.GetFullName(), Equals, expected) diff --git a/deb/remote_test.go b/deb/remote_test.go index c92944af..f154d1d0 100644 --- a/deb/remote_test.go +++ b/deb/remote_test.go @@ -319,6 +319,9 @@ func (p *architectureVariantRemoteProgress) ColoredPrintf(format string, args .. } func (s *RemoteRepoSuite) loadArchitectureVariantIndexes(c *C) { + var err error + s.repo, err = NewRemoteRepo("variant-test", "http://mirror.example.invalid/repo", "test", []string{"main"}, nil, false, false, false, false) + c.Assert(err, IsNil) const normalIndex = `Package: example Version: 1.0 Architecture: amd64 @@ -336,7 +339,7 @@ Size: 4 MD5sum: e2fc714c4727ee9395f324cd2e7f331f ` - const root = "http://mirror.yandex.ru/debian/dists/squeeze/" + const root = "http://mirror.example.invalid/repo/dists/test/" release := fmt.Sprintf("Architectures: amd64 amd64v3\nComponents: main\nSHA256:\n %x %d main/binary-amd64/Packages\n %x %d main/binary-amd64v3/Packages\n", sha256.Sum256([]byte(normalIndex)), len(normalIndex), sha256.Sum256([]byte(variantIndex)), len(variantIndex)) s.downloader = http.NewFakeDownloader().ExpectResponse(root+"Release", release) diff --git a/query/architecture_variant_test.go b/query/architecture_variant_test.go index 702668e7..2cbf9e18 100644 --- a/query/architecture_variant_test.go +++ b/query/architecture_variant_test.go @@ -17,11 +17,11 @@ func TestArchitectureVariantQueries(t *testing.T) { defer db.Close() collection := deb.NewPackageCollection(db) list := deb.NewPackageList() - const normal = "3cpio_0.14.0-1ubuntu1_amd64" - const variant = "3cpio_0.14.0-1ubuntu1_amd64v3" + const normal = "test-package_1.0_amd64" + const variant = "test-package_1.0_amd64v3" for _, value := range []string{"", "amd64v3"} { p := deb.NewPackageFromControlFile(deb.Stanza{ - "Package": "3cpio", "Version": "0.14.0-1ubuntu1", + "Package": "test-package", "Version": "1.0", "Architecture": "amd64", "Architecture-Variant": value, }) if err := collection.Update(p); err != nil { @@ -41,7 +41,7 @@ func TestArchitectureVariantQueries(t *testing.T) { name, expression string want []string }{ - {"coexistence", "Name (= 3cpio)", []string{normal, variant}}, + {"coexistence", "Name (= test-package)", []string{normal, variant}}, {"exact_normal", normal, []string{normal}}, {"exact_variant", variant, []string{variant}}, {"base_architecture", "Architecture (= amd64)", []string{normal, variant}}, @@ -75,11 +75,11 @@ func TestArchitectureVariantQueries(t *testing.T) { func TestArchitectureVariantQueryParsing(t *testing.T) { for _, arch := range []string{"amd64", "amd64v3"} { - q, err := Parse("3cpio_0.14.0-1ubuntu1_" + arch) + q, err := Parse("test-package_1.0_" + arch) if err != nil { t.Fatal(err) } - want := &deb.PkgQuery{Pkg: "3cpio", Version: "0.14.0-1ubuntu1", Arch: arch} + want := &deb.PkgQuery{Pkg: "test-package", Version: "1.0", Arch: arch} if !reflect.DeepEqual(q, want) { t.Errorf("got %#v; want %#v", q, want) } diff --git a/system/t05_snapshot/diff.py b/system/t05_snapshot/diff.py index e23448b3..8ca5befd 100644 --- a/system/t05_snapshot/diff.py +++ b/system/t05_snapshot/diff.py @@ -100,8 +100,8 @@ class DiffSnapshotArchitectureVariantTest(BaseTest): control_dir = package_dir / "DEBIAN" control_dir.mkdir(parents=True) control = ( - "Package: 3cpio\n" - "Version: 0.14.0-1ubuntu1\n" + "Package: test-package\n" + "Version: 1.0\n" "Architecture: amd64\n" "Maintainer: Aptly Test \n" "Description: Snapshot diff display fixture\n" @@ -110,7 +110,7 @@ class DiffSnapshotArchitectureVariantTest(BaseTest): control += "Architecture-Variant: amd64v3\n" (control_dir / "control").write_text(control) package_file = str(Path(tmp) / ( - "3cpio_0.14.0-1ubuntu1_" + arch + ".deb")) + "test-package_1.0_" + arch + ".deb")) self.run_cmd(["dpkg-deb", "--build", str(package_dir), package_file]) self.run_cmd(["aptly", "repo", "add", "variant-display", package_file]) snapshot = "variant-normal" if arch == "amd64" else "variant-both" @@ -127,13 +127,13 @@ class DiffSnapshotArchitectureVariantTest(BaseTest): "Arch | Package | Version in A | Version in B") self.check_equal(" ".join(lines[1].split()), expected) - check_row(self.output, "+ amd64 | 3cpio | - | 0.14.0-1ubuntu1") + check_row(self.output, "+ amd64 | test-package | - | 1.0") for left, right, expected in ( ("variant-normal", "variant-both", - "+ amd64v3 | 3cpio | - | 0.14.0-1ubuntu1"), + "+ amd64v3 | test-package | - | 1.0"), ("variant-both", "variant-normal", - "- amd64v3 | 3cpio | 0.14.0-1ubuntu1 | -"), + "- amd64v3 | test-package | 1.0 | -"), ("variant-normal", "variant-empty", - "- amd64 | 3cpio | 0.14.0-1ubuntu1 | -"), + "- amd64 | test-package | 1.0 | -"), ): check_row(self.run_cmd(["aptly", "snapshot", "diff", left, right]), expected)