mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-26 13:47:40 +00:00
Fix incomplete dependencies with follow-all-variants
When `-dep-follow-all-variants` option is enabled, dependency resolving process shouldn't stop even if dependency is already satisfied - there mgiht be other ways to satisfy dependency. Also fix issue with parsing multiarch specs like `python:any`.
This commit is contained in:
+24
-4
@@ -124,6 +124,14 @@ func NewPackageListFromRefList(reflist *PackageRefList, collection *PackageColle
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Has checks whether package is already in the list
|
||||
func (l *PackageList) Has(p *Package) bool {
|
||||
key := l.keyFunc(p)
|
||||
_, ok := l.packages[key]
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
// Add appends package to package list, additionally checking for uniqueness
|
||||
func (l *PackageList) Add(p *Package) error {
|
||||
key := l.keyFunc(p)
|
||||
@@ -511,15 +519,27 @@ func (l *PackageList) FilterWithProgress(queries []PackageQuery, withDependencie
|
||||
|
||||
// try to satisfy dependencies
|
||||
for _, dep := range missing {
|
||||
// dependency might have already been satisfied
|
||||
// with packages already been added
|
||||
if result.Search(dep, false) != nil {
|
||||
continue
|
||||
if dependencyOptions&DepFollowAllVariants == 0 {
|
||||
// dependency might have already been satisfied
|
||||
// with packages already been added
|
||||
//
|
||||
// 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 {
|
||||
if dependencyOptions&DepVerboseResolve == DepVerboseResolve && progress != nil {
|
||||
progress.ColoredPrintf("@{y}Already satisfied dependency@|: %s with %s", &dep, result.Search(dep, true))
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
searchResults := l.Search(dep, true)
|
||||
if len(searchResults) > 0 {
|
||||
for _, p := range searchResults {
|
||||
if result.Has(p) {
|
||||
continue
|
||||
}
|
||||
|
||||
if dependencyOptions&DepVerboseResolve == DepVerboseResolve && progress != nil {
|
||||
progress.ColoredPrintf("@{g}Injecting package@|: %s", p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user