mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Merge pull request #1386 from aptly-dev/fix/add-provided-package
Fix/add provided package
This commit is contained in:
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -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
|
||||
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -40,6 +40,7 @@ jobs:
|
||||
with:
|
||||
# fetch the whole repo for `git describe` to work
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
|
||||
- name: "Run flake8"
|
||||
run: |
|
||||
|
||||
@@ -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 <user> git@github.com:<user>/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 <user> <your-branch>
|
||||
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
|
||||
|
||||
|
||||
9
Makefile
9
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)
|
||||
|
||||
29
README.rst
29
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 <https://github.com/aptly-dev/aptly/releases>`_.
|
||||
|
||||
If you have Go environment set up, you can build aptly from source by running (go 1.14+ required)::
|
||||
Install CI Version
|
||||
--------------------
|
||||
|
||||
git clone https://github.com/aptly-dev/aptly
|
||||
cd aptly
|
||||
make modules install
|
||||
More recent versions are available as CI builds (development, might be unstable).
|
||||
|
||||
Binary would be installed to ``$GOPATH/bin/aptly``.
|
||||
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``::
|
||||
|
||||
deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/ci DIST main
|
||||
|
||||
Where DIST is one of: ``buster``, ``bullseye``, ``bookworm``, ``focal``, ``jammy``, ``noble``
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
35
deb/list.go
35
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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
system/files/aptly-fixture.tar.xz
LFS
Normal file
BIN
system/files/aptly-fixture.tar.xz
LFS
Normal file
Binary file not shown.
BIN
system/files/etcd.db.xz
LFS
Normal file
BIN
system/files/etcd.db.xz
LFS
Normal file
Binary file not shown.
BIN
system/t09_repo/AddRepo17Test/mesa-stable-no-march_24.2.6-101pika1_amd64.deb
LFS
Normal file
BIN
system/t09_repo/AddRepo17Test/mesa-stable-no-march_24.2.6-101pika1_amd64.deb
LFS
Normal file
Binary file not shown.
BIN
system/t09_repo/AddRepo17Test/mesa-stable_24.2.6-101pika1_amd64.deb
LFS
Normal file
BIN
system/t09_repo/AddRepo17Test/mesa-stable_24.2.6-101pika1_amd64.deb
LFS
Normal file
Binary file not shown.
3
system/t09_repo/AddRepo17Test_gold
Normal file
3
system/t09_repo/AddRepo17Test_gold
Normal file
@@ -0,0 +1,3 @@
|
||||
Loading packages...
|
||||
[+] mesa-stable-no-march_24.2.6-101pika1_amd64 added
|
||||
[+] mesa-stable_24.2.6-101pika1_amd64 added
|
||||
8
system/t09_repo/AddRepo17Test_repo_show
Normal file
8
system/t09_repo/AddRepo17Test_repo_show
Normal file
@@ -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
|
||||
@@ -344,3 +344,21 @@ class AddRepo16Test(BaseTest):
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user