From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1036172-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 382FC138334
	for <garchives@archives.gentoo.org>; Sat, 14 Jul 2018 08:43:44 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 05939E09FA;
	Sat, 14 Jul 2018 08:43:43 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id AB649E09FA
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Jul 2018 08:43:42 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6A3B5335C2E
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Jul 2018 08:43:40 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id F3224366
	for <gentoo-commits@lists.gentoo.org>; Sat, 14 Jul 2018 08:43:38 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1531557793.1bc4cd48c85b1a367f3f5adf07428e1e638d5e60.mgorny@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: repoman/cnf/repository/, repoman/cnf/qa_data/, ...
X-VCS-Repository: proj/portage
X-VCS-Files: repoman/cnf/qa_data/qa_data.yaml repoman/cnf/repository/qa_data.yaml repoman/pym/repoman/modules/scan/depend/_depend_checks.py
X-VCS-Directories: repoman/cnf/repository/ repoman/cnf/qa_data/ repoman/pym/repoman/modules/scan/depend/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 1bc4cd48c85b1a367f3f5adf07428e1e638d5e60
X-VCS-Branch: master
Date: Sat, 14 Jul 2018 08:43:38 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 9f6a6dac-c4f5-484d-bbce-bd0b4d578dc9
X-Archives-Hash: 5ca4a1cd1efbbdcf0e1de54b7dc2a0bb

commit:     1bc4cd48c85b1a367f3f5adf07428e1e638d5e60
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Mar  3 21:29:11 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul 14 08:43:13 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1bc4cd48

repoman: Warn on = dependencies without * or revision

Warn if the '=' package dependency operator is used along with pure
version with no revision specified. This means to catch a common mistake
of developers copying '=' from upstream dependency specification while
'~' operator would be more appropriate. This causes unintended depgraph
breakage when the dependencies are revbumped e.g. due to dependency
changes, or prevents people from upgrading.

The developers are given two suggestions: either to use '~' if any
revision is acceptable, or to explicitly specify '-r0' when they really
do accept -r0 only.

Bug: https://bugs.gentoo.org/649482
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 repoman/cnf/qa_data/qa_data.yaml                          | 1 +
 repoman/cnf/repository/qa_data.yaml                       | 1 +
 repoman/pym/repoman/modules/scan/depend/_depend_checks.py | 9 +++++++++
 3 files changed, 11 insertions(+)

diff --git a/repoman/cnf/qa_data/qa_data.yaml b/repoman/cnf/qa_data/qa_data.yaml
index 32994e013..49ffdaf74 100644
--- a/repoman/cnf/qa_data/qa_data.yaml
+++ b/repoman/cnf/qa_data/qa_data.yaml
@@ -26,6 +26,7 @@ qahelp:
         badinexp: "User-visible ebuilds with unsatisfied dependencies (matched against *visible* ebuilds) in experimental arch"
         badmaskedinexp: "Masked ebuilds with unsatisfied dependencies (matched against *all* ebuilds) in experimental arch"
         badtilde: "Uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored)"
+        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."
         missingslot: "RDEPEND matches more than one SLOT but does not specify a slot and/or use the := or :* slot operator"
         perlcore: "This ebuild directly depends on a package in perl-core; it should use the corresponding virtual instead."
         syntax: "Syntax error in dependency string (usually an extra/missing space/parenthesis)"

diff --git a/repoman/cnf/repository/qa_data.yaml b/repoman/cnf/repository/qa_data.yaml
index 4aa961633..2e9e16b1d 100644
--- a/repoman/cnf/repository/qa_data.yaml
+++ b/repoman/cnf/repository/qa_data.yaml
@@ -44,6 +44,7 @@ qawarnings:
     - dependency.badindev
     - dependency.badmaskedindev
     - dependency.badtilde
+    - dependency.equalsversion
     - dependency.missingslot
     - dependency.perlcore
     - DESCRIPTION.toolong

diff --git a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
index 79fd0a0c2..690b95aa0 100644
--- a/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
+++ b/repoman/pym/repoman/modules/scan/depend/_depend_checks.py
@@ -152,6 +152,15 @@ def _depend_checks(ebuild, pkg, portdb, qatracker, repo_metadata, qadata):
 						qacat, "%s: %s uses the ~ operator"
 						" with a non-zero revision: '%s'" %
 						(ebuild.relative_path, mytype, atom))
+				# plain =foo-1.2.3 without revision or *
+				if atom.operator == "=" and '-r' not in atom.version:
+					qacat = 'dependency.equalsversion'
+					qatracker.add_error(
+						qacat, "%s: %s uses the = operator with"
+						" no revision: '%s'; if any revision is"
+						" acceptable, use '~' instead; if only -r0"
+						" then please append '-r0' to the dep" %
+						(ebuild.relative_path, mytype, atom))
 
 				check_missingslot(atom, mytype, ebuild.eapi, portdb, qatracker,
 					ebuild.relative_path, ebuild.metadata)