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