diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..d564926bd --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.deb filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17f28d648..90222becc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,7 @@ jobs: with: # fetch the whole repo for `git describe` to work fetch-depth: 0 + lfs: true - name: "Run flake8" run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index edebdf22c..68491b688 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,22 +68,16 @@ following [PR template](.github/PULL_REQUEST_TEMPLATE.md). Make sure that purpose of your change is clear, all the tests and checks pass, and all new code is covered with tests if that is possible. -### Forking and Cloning +### Get the Source -As aptly is using Go modules, aptly repository could be cloned to any location on the file system: - - git clone git@github.com:aptly-dev/aptly.git - cd aptly - -For main repo under your GitHub user and add it as another Git remote: - - git remote add git@github.com:/aptly.git - -That way you can continue to build project as is (you don't need to adjust import paths), but you would need -to specify your remote name when pushing branches: - - git push +Make sure git with LFS support ist installed. +To clone the git repo, run the following commands: +``` +git clone git@github.com:aptly-dev/aptly.git +cd aptly +git lfs checkout +``` ## Development Setup diff --git a/Makefile b/Makefile index 5e89df2b7..3ff15d3d8 100644 --- a/Makefile +++ b/Makefile @@ -85,10 +85,9 @@ test: prepare swagger etcd-install ## Run unit tests system-test: prepare swagger etcd-install ## Run system tests # build coverage binary go test -v -coverpkg="./..." -c -tags testruncli - # Download fixture-db, fixture-pool, etcd.db - if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi - if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi - test -f ~/etcd.db || (curl -o ~/etcd.db.xz http://repo.aptly.info/system-tests/etcd.db.xz && xz -d ~/etcd.db.xz) + # Extract fixture-db, fixture-pool, etcd.db + test -e ~/aptly-fixture-db || tar -C ~/ -xf system/files/aptly-fixture.tar.xz + test -f ~/etcd.db || xz -dc system/files/etcd.db.xz > ~/etcd.db # Run system tests PATH=$(BINPATH)/:$(PATH) && FORCE_COLOR=1 $(PYTHON) system/run.py --long --coverage-dir $(COVERAGE_DIR) $(CAPTURE) $(TEST) @@ -100,7 +99,7 @@ serve: prepare swagger-install ## Run development server (auto recompiling) test -f $(BINPATH)/air || go install github.com/air-verse/air@v1.52.3 cp debian/aptly.conf ~/.aptly.conf sed -i /enableSwaggerEndpoint/s/false/true/ ~/.aptly.conf - PATH=$(BINPATH):$$PATH air -build.pre_cmd 'swag init -q --markdownFiles docs' -build.exclude_dir docs,system,debian,pgp/keyrings,pgp/test-bins,completion.d,man,deb/testdata,console,_man,cmd,systemd,obj-x86_64-linux-gnu -- api serve -listen 0.0.0.0:3142 + PATH=$(BINPATH):$$PATH air -build.pre_cmd 'swag init -q --markdownFiles docs' -build.exclude_dir docs,system,debian,pgp/keyrings,pgp/test-bins,completion.d,man,deb/testdata,console,_man,systemd,obj-x86_64-linux-gnu -- api serve -listen 0.0.0.0:3142 dpkg: prepare swagger ## Build debian packages @test -n "$(DEBARCH)" || (echo "please define DEBARCH"; exit 1) diff --git a/README.rst b/README.rst index 1b09a88e3..a53990db6 100644 --- a/README.rst +++ b/README.rst @@ -39,8 +39,8 @@ Current limitations: * translations are not supported yet -Download --------- +Install Stable Version +----------------------- To install aptly on Debian/Ubuntu, add new repository to ``/etc/apt/sources.list``:: @@ -58,19 +58,28 @@ After that you can install aptly as any other software package:: Don't worry about squeeze part in repo name: aptly package should work on Debian squeeze+, Ubuntu 10.0+. Package contains aptly binary, man page and bash completion. -If you would like to use nightly builds (unstable), please use following repository:: - - deb http://repo.aptly.info/ nightly main +Other Binaries +~~~~~~~~~~~~~~~~~ Binary executables (depends almost only on libc) are available for download from `GitHub Releases `_. -If you have Go environment set up, you can build aptly from source by running (go 1.14+ required):: +Install CI Version +-------------------- + +More recent versions are available as CI builds (development, might be unstable). + +Debian GNU/Linux +~~~~~~~~~~~~~~~~~ + +Install the following APT key:: + + sudo wget -O /etc/apt/keyrings/aptly.asc https://www.aptly.info/pubkey.txt + +Define CI APT sources in ``/etc/apt/sources.list.d/aptly-ci.list``:: - git clone https://github.com/aptly-dev/aptly - cd aptly - make modules install + deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/ci DIST main -Binary would be installed to ``$GOPATH/bin/aptly``. +Where DIST is one of: ``buster``, ``bullseye``, ``bookworm``, ``focal``, ``jammy``, ``noble`` Contributing ------------ diff --git a/api/snapshot.go b/api/snapshot.go index 18aa64404..1a9c22786 100644 --- a/api/snapshot.go +++ b/api/snapshot.go @@ -653,7 +653,7 @@ func apiSnapshotsPull(c *gin.Context) { // If we haven't seen such name-architecture pair and were instructed to remove, remove it if !noRemove && !seen { // Remove all packages with the same name and architecture - packageSearchResults := toPackageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, true) + packageSearchResults := toPackageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, true, false) for _, p := range packageSearchResults { toPackageList.Remove(p) removedPackages = append(removedPackages, p.String()) diff --git a/cmd/snapshot_pull.go b/cmd/snapshot_pull.go index 884b50ffb..9c2559f55 100644 --- a/cmd/snapshot_pull.go +++ b/cmd/snapshot_pull.go @@ -112,7 +112,7 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error { // If we haven't seen such name-architecture pair and were instructed to remove, remove it if !noRemove && !seen { // Remove all packages with the same name and architecture - pS := packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, true) + pS := packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, true, false) for _, p := range pS { packageList.Remove(p) context.Progress().ColoredPrintf("@r[-]@| %s removed", p) diff --git a/deb/import.go b/deb/import.go index e1da51016..99d52be82 100644 --- a/deb/import.go +++ b/deb/import.go @@ -209,7 +209,7 @@ func ImportPackageFiles(list *PackageList, packageFiles []string, forceReplace b } if forceReplace { - conflictingPackages := list.Search(Dependency{Pkg: p.Name, Version: p.Version, Relation: VersionEqual, Architecture: p.Architecture}, true) + conflictingPackages := list.Search(Dependency{Pkg: p.Name, Version: p.Version, Relation: VersionEqual, Architecture: p.Architecture}, true, false) for _, cp := range conflictingPackages { reporter.Removed("%s removed due to conflict with package being added", cp) list.Remove(cp) diff --git a/deb/list.go b/deb/list.go index f9a8244ac..e88069f28 100644 --- a/deb/list.go +++ b/deb/list.go @@ -347,7 +347,7 @@ func (l *PackageList) VerifyDependencies(options int, architectures []string, so hash := dep.Hash() satisfied, ok := cache[hash] if !ok { - satisfied = sources.Search(dep, false) != nil + satisfied = sources.Search(dep, false, true) != nil cache[hash] = satisfied } @@ -459,7 +459,7 @@ func (l *PackageList) SearchByKey(arch, name, version string) (result *PackageLi } // Search searches package index for specified package(s) using optimized queries -func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*Package) { +func (l *PackageList) Search(dep Dependency, allMatches bool, searchProvided bool) (searchResults []*Package) { if !l.indexed { panic("list not indexed, can't search") } @@ -479,18 +479,20 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []* i++ } - providers, ok := l.providesIndex[dep.Pkg] - if !ok { - return - } - for _, p := range providers { - if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) { - if p.MatchesDependency(dep) { - searchResults = append(searchResults, p) - } + if searchProvided { + providers, ok := l.providesIndex[dep.Pkg] + if !ok { + return + } + for _, p := range providers { + if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) { + if p.MatchesDependency(dep) { + searchResults = append(searchResults, p) + } - if !allMatches { - return + if !allMatches { + return + } } } } @@ -544,15 +546,16 @@ func (l *PackageList) FilterWithProgress(queries []PackageQuery, withDependencie // // when follow-all-variants is enabled, we need to try to expand anyway, // as even if dependency is satisfied now, there might be other ways to satisfy dependency - if result.Search(dep, false) != nil { + // FIXME: do not search twice + if result.Search(dep, false, true) != nil { if dependencyOptions&DepVerboseResolve == DepVerboseResolve && progress != nil { - progress.ColoredPrintf("@{y}Already satisfied dependency@|: %s with %s", &dep, result.Search(dep, true)) + progress.ColoredPrintf("@{y}Already satisfied dependency@|: %s with %s", &dep, result.Search(dep, true, true)) } continue } } - searchResults := l.Search(dep, true) + searchResults := l.Search(dep, true, true) if len(searchResults) > 0 { for _, p := range searchResults { if result.Has(p) { diff --git a/deb/list_test.go b/deb/list_test.go index 0cb04b76c..4209f125e 100644 --- a/deb/list_test.go +++ b/deb/list_test.go @@ -251,63 +251,63 @@ func (s *PackageListSuite) TestAppend(c *C) { func (s *PackageListSuite) TestSearch(c *C) { //allMatches = False - c.Check(func() { s.list.Search(Dependency{Architecture: "i386", Pkg: "app"}, false) }, Panics, "list not indexed, can't search") + c.Check(func() { s.list.Search(Dependency{Architecture: "i386", Pkg: "app"}, false, true) }, Panics, "list not indexed, can't search") - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "mail-agent"}, false), DeepEquals, []*Package{s.packages[4]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "puppy"}, false), IsNil) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "mail-agent"}, false, true), DeepEquals, []*Package{s.packages[4]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "puppy"}, false, true), IsNil) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionEqual, Version: "1.1~bp1"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionEqual, Version: "1.1~bp2"}, false), IsNil) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionEqual, Version: "1.1~bp1"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionEqual, Version: "1.1~bp2"}, false, true), IsNil) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLess, Version: "1.1"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLess, Version: "1.1~~"}, false), IsNil) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLess, Version: "1.1"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLess, Version: "1.1~~"}, false, true), IsNil) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1~bp1"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1~~"}, false), IsNil) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1~bp1"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1~~"}, false, true), IsNil) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreater, Version: "1.0"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreater, Version: "1.2"}, false), IsNil) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreater, Version: "1.0"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreater, Version: "1.2"}, false, true), IsNil) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.0"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.1~bp1"}, false), DeepEquals, []*Package{s.packages[3]}) - c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.2"}, false), IsNil) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.0"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.1~bp1"}, false, true), DeepEquals, []*Package{s.packages[3]}) + c.Check(s.il.Search(Dependency{Architecture: "i386", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.2"}, false, true), IsNil) // search w/o version should return package with latest version - c.Check(s.il.Search(Dependency{Architecture: "source", Pkg: "dpkg"}, false), DeepEquals, []*Package{s.packages[13]}) + c.Check(s.il.Search(Dependency{Architecture: "source", Pkg: "dpkg"}, false, true), DeepEquals, []*Package{s.packages[13]}) // allMatches = True - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app"}, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4], s.packages2[5]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "mail-agent"}, true), Contains, []*Package{s.packages2[0], s.packages2[1]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "puppy"}, true), IsNil) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4], s.packages2[5]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "mail-agent"}, true, true), Contains, []*Package{s.packages2[0], s.packages2[1]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "puppy"}, true, true), IsNil) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionEqual, Version: "1.1"}, true), Contains, []*Package{s.packages2[2], s.packages2[3]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionEqual, Version: "1.1"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionEqual, Version: "1.1"}, true), Contains, []*Package{s.packages2[2], s.packages2[3]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionEqual, Version: "3"}, true), Contains, []*Package{s.packages2[5]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionEqual, Version: "1.1"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionEqual, Version: "3"}, true, true), Contains, []*Package{s.packages2[5]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLess, Version: "1.2"}, true), Contains, []*Package{s.packages2[2], s.packages2[3]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLess, Version: "1.1~"}, true), IsNil) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLess, Version: "1.2"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLess, Version: "1.1~"}, true, true), IsNil) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.2"}, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1-bp1"}, true), Contains, []*Package{s.packages2[2]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.0"}, true), IsNil) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.2"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.1-bp1"}, true, true), Contains, []*Package{s.packages2[2]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionLessOrEqual, Version: "1.0"}, true, true), IsNil) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreater, Version: "1.1"}, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4], s.packages2[5]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreater, Version: "5.0"}, true), IsNil) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreater, Version: "1.1"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4], s.packages2[5]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreater, Version: "5.0"}, true, true), IsNil) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.2"}, true), Contains, []*Package{s.packages2[4], s.packages2[5]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.1~bp1"}, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4], s.packages2[5]}) - c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "5.0"}, true), IsNil) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.2"}, true, true), Contains, []*Package{s.packages2[4], s.packages2[5]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "1.1~bp1"}, true, true), Contains, []*Package{s.packages2[2], s.packages2[3], s.packages2[4], s.packages2[5]}) + c.Check(s.il2.Search(Dependency{Architecture: "amd64", Pkg: "app", Relation: VersionGreaterOrEqual, Version: "5.0"}, true, true), IsNil) // Provides with version number python3CFFIBackend := &Package{Name: "python3-cffi-backend", Version: "1.15.1-5+b1", Architecture: "amd64", Provides: []string{"python3-cffi-backend-api-9729", "python3-cffi-backend-api-max (= 10495)", "python3-cffi-backend-api-min (= 9729)"}} err := s.il2.Add(python3CFFIBackend) c.Check(err, IsNil) - c.Check(s.il2.Search(Dependency{Pkg: "python3-cffi-backend-api-max", Relation: VersionGreaterOrEqual, Version: "9729"}, false), DeepEquals, []*Package{python3CFFIBackend}) - c.Check(s.il2.Search(Dependency{Pkg: "python3-cffi-backend-api-max", Relation: VersionLess, Version: "9729"}, false), IsNil) - c.Check(s.il2.Search(Dependency{Pkg: "python3-cffi-backend-api-max", Relation: VersionDontCare}, false), DeepEquals, []*Package{python3CFFIBackend}) + c.Check(s.il2.Search(Dependency{Pkg: "python3-cffi-backend-api-max", Relation: VersionGreaterOrEqual, Version: "9729"}, false, true), DeepEquals, []*Package{python3CFFIBackend}) + c.Check(s.il2.Search(Dependency{Pkg: "python3-cffi-backend-api-max", Relation: VersionLess, Version: "9729"}, false, true), IsNil) + c.Check(s.il2.Search(Dependency{Pkg: "python3-cffi-backend-api-max", Relation: VersionDontCare}, false, true), DeepEquals, []*Package{python3CFFIBackend}) } func (s *PackageListSuite) TestFilter(c *C) { diff --git a/deb/package_collection.go b/deb/package_collection.go index c7e6a3008..0027f1de2 100644 --- a/deb/package_collection.go +++ b/deb/package_collection.go @@ -317,7 +317,7 @@ func (collection *PackageCollection) Scan(q PackageQuery) (result *PackageList) } // Search is not implemented -func (collection *PackageCollection) Search(_ Dependency, _ bool) (searchResults []*Package) { +func (collection *PackageCollection) Search(_ Dependency, _ bool, _ bool) (searchResults []*Package) { panic("Not implemented") } diff --git a/deb/query.go b/deb/query.go index 1de9e95b9..ad0ad17af 100644 --- a/deb/query.go +++ b/deb/query.go @@ -20,7 +20,7 @@ type PackageLike interface { // PackageCatalog is abstraction on top of PackageCollection and PackageList type PackageCatalog interface { Scan(q PackageQuery) (result *PackageList) - Search(dep Dependency, allMatches bool) (searchResults []*Package) + Search(dep Dependency, allMatches bool, searchProvided bool) (searchResults []*Package) SearchSupported() bool SearchByKey(arch, name, version string) (result *PackageList) } @@ -244,7 +244,7 @@ func (q *DependencyQuery) Fast(list PackageCatalog) bool { func (q *DependencyQuery) Query(list PackageCatalog) (result *PackageList) { if q.Fast(list) { result = NewPackageList() - for _, pkg := range list.Search(q.Dep, true) { + for _, pkg := range list.Search(q.Dep, true, true) { result.Add(pkg) } } else { diff --git a/system/Dockerfile b/system/Dockerfile index c57f27df5..53fc87d7c 100644 --- a/system/Dockerfile +++ b/system/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg b golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports \ make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage \ g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu \ - binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev && \ + binutils-arm-linux-gnueabihf bash-completion zip ruby3.1-dev git-lfs && \ apt-get clean && rm -rf /var/lib/apt/lists/* RUN useradd -m --shell /bin/bash --home-dir /var/lib/aptly aptly @@ -16,9 +16,6 @@ RUN mkdir /work WORKDIR /work/src RUN chown aptly /work -RUN cd /var/lib/aptly; git clone https://github.com/aptly-dev/aptly-fixture-db.git -RUN cd /var/lib/aptly; git clone https://github.com/aptly-dev/aptly-fixture-pool.git -RUN cd /var/lib/aptly; curl -O http://repo.aptly.info/system-tests/etcd.db.xz && xz -d etcd.db.xz RUN echo "aptly ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/aptly ADD system/t13_etcd/install-etcd.sh /src/ RUN /src/install-etcd.sh diff --git a/system/files/aptly-fixture.tar.xz b/system/files/aptly-fixture.tar.xz new file mode 100644 index 000000000..963ac2ac2 --- /dev/null +++ b/system/files/aptly-fixture.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cef7679d88a35f87fff1d7647473f3413fcca4b643a927185fe5088ac16d8b5 +size 47947528 diff --git a/system/files/etcd.db.xz b/system/files/etcd.db.xz new file mode 100644 index 000000000..c8464e05c --- /dev/null +++ b/system/files/etcd.db.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d6d4e4ef989635ea5d0533a55f862c1524d97dcadcafe8d2f1a79fc4b01a443 +size 27149608 diff --git a/system/t09_repo/AddRepo17Test/mesa-stable-no-march_24.2.6-101pika1_amd64.deb b/system/t09_repo/AddRepo17Test/mesa-stable-no-march_24.2.6-101pika1_amd64.deb new file mode 100644 index 000000000..ef70a0ec1 --- /dev/null +++ b/system/t09_repo/AddRepo17Test/mesa-stable-no-march_24.2.6-101pika1_amd64.deb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3f651297bd4bd0ef999296ef0a282990ec304c58ffed882c73d5a9d2f11d6ae +size 17940 diff --git a/system/t09_repo/AddRepo17Test/mesa-stable_24.2.6-101pika1_amd64.deb b/system/t09_repo/AddRepo17Test/mesa-stable_24.2.6-101pika1_amd64.deb new file mode 100644 index 000000000..35ccd13e7 --- /dev/null +++ b/system/t09_repo/AddRepo17Test/mesa-stable_24.2.6-101pika1_amd64.deb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:016b3d864229761eff49a8680c9987ab4073a0d23b5e118be95b24b0793ca2b9 +size 18440 diff --git a/system/t09_repo/AddRepo17Test_gold b/system/t09_repo/AddRepo17Test_gold new file mode 100644 index 000000000..687c9eb44 --- /dev/null +++ b/system/t09_repo/AddRepo17Test_gold @@ -0,0 +1,3 @@ +Loading packages... +[+] mesa-stable-no-march_24.2.6-101pika1_amd64 added +[+] mesa-stable_24.2.6-101pika1_amd64 added diff --git a/system/t09_repo/AddRepo17Test_repo_show b/system/t09_repo/AddRepo17Test_repo_show new file mode 100644 index 000000000..7be665854 --- /dev/null +++ b/system/t09_repo/AddRepo17Test_repo_show @@ -0,0 +1,8 @@ +Name: repo17 +Comment: Repo17 +Default Distribution: squeeze +Default Component: main +Number of packages: 2 +Packages: + mesa-stable_24.2.6-101pika1_amd64 + mesa-stable-no-march_24.2.6-101pika1_amd64 diff --git a/system/t09_repo/add.py b/system/t09_repo/add.py index 61c64d1ea..08274f77a 100644 --- a/system/t09_repo/add.py +++ b/system/t09_repo/add.py @@ -344,3 +344,21 @@ def check(self): self.check_cmd_output("aptly repo show repo2", "repo_show") shutil.rmtree(self.tempSrcDir) + + +class AddRepo17Test(BaseTest): + """ + add packages to local repo: .deb file with provides + """ + fixtureCmds = [ + "aptly repo create -comment=Repo17 -distribution=squeeze repo17", + ] + runCmd = "aptly repo add repo17 ${testfiles}/mesa-stable_24.2.6-101pika1_amd64.deb ${testfiles}/mesa-stable-no-march_24.2.6-101pika1_amd64.deb" + + def check(self): + self.check_output() + self.check_cmd_output("aptly repo show -with-packages repo17", "repo_show") + + # check pool + self.check_exists('pool/e3/f6/51297bd4bd0ef999296ef0a28299_mesa-stable-no-march_24.2.6-101pika1_amd64.deb') + self.check_exists('pool/01/6b/3d864229761eff49a8680c9987ab_mesa-stable_24.2.6-101pika1_amd64.deb')