From c8fca7953c3a072fe7d709821262c8d61b7296c3 Mon Sep 17 00:00:00 2001 From: 5hir0kur0 <12101162+5hir0kur0@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:00:04 +0900 Subject: [PATCH 1/2] package.go: Fix bug in providesDependency Use package version if `Provides:` entry does not specify a version. --- deb/package.go | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/deb/package.go b/deb/package.go index 82ac7885..cf6a98ca 100644 --- a/deb/package.go +++ b/deb/package.go @@ -362,24 +362,22 @@ func (p *Package) providesDependency(dep Dependency) (bool, error) { if err != nil { errs = append(errs, err) } - // 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. - // -- https://www.debian.org/doc/debian-policy/ch-relationships.html - switch providedDep.Relation { - 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: + if providedDep.Relation != VersionEqual && providedDep.Relation != VersionDontCare { + // 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. + // -- https://www.debian.org/doc/debian-policy/ch-relationships.html 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...) From 19d213d748f8f0e91a1a899605f10de799f84781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Fri, 8 Nov 2024 14:53:10 +0100 Subject: [PATCH 2/2] fix tests --- system/t05_snapshot/VerifySnapshot7Test_gold | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/system/t05_snapshot/VerifySnapshot7Test_gold b/system/t05_snapshot/VerifySnapshot7Test_gold index 85e3ce21..8d2420c7 100644 --- a/system/t05_snapshot/VerifySnapshot7Test_gold +++ b/system/t05_snapshot/VerifySnapshot7Test_gold @@ -1,6 +1,6 @@ Loading packages... Verifying... -Missing dependencies (625): +Missing dependencies (635): abrowser [amd64] abrowser [i386] apache [amd64] @@ -106,6 +106,8 @@ Missing dependencies (625): ghostcript-x (= 9.05~dfsg-6.3+deb7u1) [i386] gij [amd64] gij [i386] + git-core (<= 1:1.7.0.4-1) [amd64] + git-core (<= 1:1.7.0.4-1) [i386] gkrellm2 [amd64] gkrellm2 [i386] gnome-themes-more [amd64] @@ -302,6 +304,8 @@ Missing dependencies (625): libgnomeprint-data [i386] libgtk2.0-dev (<< 2.21) [amd64] libgtk2.0-dev (<< 2.21) [i386] + libhaml-ruby (<< 3.1) [amd64] + libhaml-ruby (<< 3.1) [i386] libicu36-dev [amd64] libicu36-dev [i386] libjasper-1.701-dev [amd64] @@ -328,6 +332,8 @@ Missing dependencies (625): libsvn-core-perl [i386] libswt-mozilla-gtk-3-jni [amd64] libswt-mozilla-gtk-3-jni [i386] + libtest-harness-perl (= 3.23-1) [amd64] + libtest-harness-perl (= 3.23-1) [i386] libwww-perl (<< 6) [amd64] libwww-perl (<< 6) [i386] libzephyr4-krb (= 3.0.2-2) [amd64] @@ -424,6 +430,8 @@ Missing dependencies (625): puredata (<< 0.43) [i386] python-celementtree [amd64] python-celementtree [i386] + python-codespeak-lib (<< 1.0) [amd64] + python-codespeak-lib (<< 1.0) [i386] python-elementtree (>= 1.2) [amd64] python-elementtree (>= 1.2) [i386] python-elementtree [amd64] @@ -576,6 +584,8 @@ Missing dependencies (625): xmessage [i386] xpdf-reader (<< 3.02-2) [amd64] xpdf-reader (<< 3.02-2) [i386] + xpdf-utils (>= 3.02-2) [amd64] + xpdf-utils (>= 3.02-2) [i386] xrandr [amd64] xrandr [i386] xulrunner-1.9 [amd64]