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