1 |
Warn if the '=' package dependency operator is used along with pure |
2 |
version with no revision specified. This means to catch a common mistake |
3 |
of developers copying '=' from upstream dependency specification while |
4 |
'~' operator would be more appropriate. This causes unintended depgraph |
5 |
breakage when the dependencies are revbumped e.g. due to dependency |
6 |
changes, or prevents people from upgrading. |
7 |
|
8 |
The developers are given two suggestions: either to use '~' if any |
9 |
revision is acceptable, or to explicitly specify '-r0' when they really |
10 |
do accept -r0 only. |
11 |
|
12 |
Bug: https://bugs.gentoo.org/649482 |
13 |
--- |
14 |
repoman/cnf/qa_data/qa_data.yaml | 1 + |
15 |
repoman/cnf/repository/qa_data.yaml | 1 + |
16 |
.../pym/repoman/modules/scan/depend/_depend_checks.py | 9 +++++++++ |
17 |
3 files changed, 11 insertions(+) |
18 |
|
19 |
Changes in v2: |
20 |
rebased for the repoman rewrite |
21 |
|
22 |
diff --git a/repoman/cnf/qa_data/qa_data.yaml b/repoman/cnf/qa_data/qa_data.yaml |
23 |
index 32994e013..d68673708 100644 |
24 |
--- a/repoman/cnf/qa_data/qa_data.yaml |
25 |
+++ b/repoman/cnf/qa_data/qa_data.yaml |
26 |
@@ -26,6 +26,7 @@ qahelp: |
27 |
badinexp: "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in experimental arch" |
28 |
badmaskedinexp: "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in experimental arch" |
29 |
badtilde: "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)" |
30 |
+ equalsversion: "Suspicious =-dependency with a specific version and no rev. Please either use ~ if any revision is acceptable, or append -r0 to silence the warning." |
31 |
missingslot: "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator" |
32 |
perlcore: "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead." |
33 |
syntax: "Syntax error in dependency string (usually an extra/missing space/parenthesis)" |
34 |
diff --git a/repoman/cnf/repository/qa_data.yaml b/repoman/cnf/repository/qa_data.yaml |
35 |
index 4aa961633..2e9e16b1d 100644 |
36 |
--- a/repoman/cnf/repository/qa_data.yaml |
37 |
+++ b/repoman/cnf/repository/qa_data.yaml |
38 |
@@ -44,6 +44,7 @@ qawarnings: |
39 |
- dependency.badindev |
40 |
- dependency.badmaskedindev |
41 |
- dependency.badtilde |
42 |
+ - dependency.equalsversion |
43 |
- dependency.missingslot |
44 |
- dependency.perlcore |
45 |
- DESCRIPTION.toolong |
46 |
diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py |
47 |
index 79fd0a0c2..690b95aa0 100644 |
48 |
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py |
49 |
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py |
50 |
@@ -152,6 +152,15 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata): |
51 |
qacat, "%s: %s uses the ~ operator" |
52 |
" with a non-zero revision: '%s'" % |
53 |
(ebuild.relative_path, mytype, atom)) |
54 |
+ # plain =foo-1.2.3 without revision or * |
55 |
+ if atom.operator == "=" and '-r' not in atom.version: |
56 |
+ qacat = 'dependency.equalsversion' |
57 |
+ qatracker.add_error( |
58 |
+ qacat, "%s: %s uses the = operator with" |
59 |
+ " no revision: '%s'; if any revision is" |
60 |
+ " acceptable, use '~' instead; if only -r0" |
61 |
+ " then please append '-r0' to the dep" % |
62 |
+ (ebuild.relative_path, mytype, atom)) |
63 |
|
64 |
check_missingslot(atom, mytype, ebuild.eapi, portdb, qatracker, |
65 |
ebuild.relative_path, ebuild.metadata) |
66 |
-- |
67 |
2.18.0 |