mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-12 06:30:35 +00:00
package.go: Fix bug in providesDependency
Use package version if `Provides:` entry does not specify a version.
This commit is contained in:
+15
-17
@@ -362,24 +362,22 @@ func (p *Package) providesDependency(dep Dependency) (bool, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
}
|
}
|
||||||
// The only relation allowed here is `=`.
|
if providedDep.Relation != VersionEqual && providedDep.Relation != VersionDontCare {
|
||||||
// > The relations allowed are [...]. The exception is the Provides field, for which only = is allowed.
|
// The only relation allowed here is `=`.
|
||||||
// > [...]
|
// > The relations allowed are [...]. The exception is the Provides field, for which only = is allowed.
|
||||||
// > A Provides field may contain version numbers, and such a version number will be considered when
|
// > [...]
|
||||||
// > considering a dependency on or conflict with the virtual package name.
|
// > A Provides field may contain version numbers, and such a version number will be considered when
|
||||||
// -- https://www.debian.org/doc/debian-policy/ch-relationships.html
|
// > considering a dependency on or conflict with the virtual package name.
|
||||||
switch providedDep.Relation {
|
// -- https://www.debian.org/doc/debian-policy/ch-relationships.html
|
||||||
case VersionDontCare:
|
|
||||||
if providedDep.Pkg == dep.Pkg {
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
case VersionEqual:
|
|
||||||
providedVersion := providedDep.Version
|
|
||||||
if providedDep.Pkg == dep.Pkg && versionSatisfiesDependency(providedVersion, dep) {
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
errs = append(errs, fmt.Errorf("unsupported relation in Provides: %s", providedDep.String()))
|
errs = append(errs, fmt.Errorf("unsupported relation in Provides: %s", providedDep.String()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
providedVersion := providedDep.Version
|
||||||
|
if providedVersion == "" {
|
||||||
|
providedVersion = p.Version
|
||||||
|
}
|
||||||
|
if providedDep.Pkg == dep.Pkg && versionSatisfiesDependency(providedVersion, dep) {
|
||||||
|
return true, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false, JoinErrors(errs...)
|
return false, JoinErrors(errs...)
|
||||||
|
|||||||
Reference in New Issue
Block a user