From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id DADCC1387B1 for ; Mon, 21 Sep 2015 23:51:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DACABE086C; Mon, 21 Sep 2015 23:51:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 74AE6E086C for ; Mon, 21 Sep 2015 23:51:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5B990340988 for ; Mon, 21 Sep 2015 23:51:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4C2601FD for ; Mon, 21 Sep 2015 23:51:18 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1442878964.1850a6ebe46abcee14fbf6d28901b186150c2a18.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/checks/ebuilds/, pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/keywords.py pym/repoman/main.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 1850a6ebe46abcee14fbf6d28901b186150c2a18 X-VCS-Branch: master Date: Mon, 21 Sep 2015 23:51:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8d5ed68b-d01b-4b80-a20a-aa070a6c3ef6 X-Archives-Hash: a8e82582446ce2fe8598dc361865bca3 commit: 1850a6ebe46abcee14fbf6d28901b186150c2a18 Author: Tom Wijsman gentoo org> AuthorDate: Wed Jun 4 14:17:49 2014 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Mon Sep 21 23:42:44 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1850a6eb repoman/main.py: More KEYWORDS checks to checks/ebuilds/keywords.py pym/repoman/checks/ebuilds/keywords.py | 64 ++++++++++++++++++++++++++++++---- pym/repoman/main.py | 32 +---------------- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/pym/repoman/checks/ebuilds/keywords.py b/pym/repoman/checks/ebuilds/keywords.py index b724269..235c751 100644 --- a/pym/repoman/checks/ebuilds/keywords.py +++ b/pym/repoman/checks/ebuilds/keywords.py @@ -21,7 +21,7 @@ class KeywordChecks(object): def check( self, pkg, package, ebuild, y_ebuild, keywords, ebuild_archs, changed, - live_ebuild): + live_ebuild, kwlist, profiles): '''Perform the check. @param pkg: Package in which we check (object). @@ -33,21 +33,32 @@ class KeywordChecks(object): @param changed: Changes instance @param slot_keywords: A dictionary of keywords per slot. @param live_ebuild: A boolean that determines if this is a live ebuild. + @param kwlist: A list of all global keywords. + @param profiles: A list of all profiles. ''' if not self.options.straight_to_stable: self._checkAddedWithStableKeywords( package, ebuild, y_ebuild, keywords, changed) + self._checkForDroppedKeywords( pkg, ebuild, ebuild_archs, live_ebuild) + self._checkForInvalidKeywords( + pkg, package, y_ebuild, kwlist, profiles) + + self._checkForMaskLikeKeywords( + package, y_ebuild, keywords, kwlist) + self.slot_keywords[pkg.slot].update(ebuild_archs) + def _isKeywordStable(self, keyword): + return not keyword.startswith("~") and not keyword.startswith("-") + def _checkAddedWithStableKeywords( self, package, ebuild, y_ebuild, keywords, changed): catdir, pkgdir = package.split("/") - is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-") - stable_keywords = list(filter(is_stable, keywords)) + stable_keywords = list(filter(self._isKeywordStable, keywords)) if stable_keywords: if ebuild.ebuild_path in changed.new_ebuilds and catdir != "virtual": stable_keywords.sort() @@ -64,6 +75,47 @@ class KeywordChecks(object): elif ebuild_archs and "*" not in ebuild_archs and not live_ebuild: dropped_keywords = previous_keywords.difference(ebuild_archs) if dropped_keywords: - self.qatracker.add_error("KEYWORDS.dropped", - "%s: %s" % - (ebuild.relative_path, " ".join(sorted(dropped_keywords)))) + self.qatracker.add_error( + "KEYWORDS.dropped", "%s: %s" % ( + ebuild.relative_path, + " ".join(sorted(dropped_keywords)))) + + def _checkForInvalidKeywords( + self, pkg, package, y_ebuild, kwlist, profiles): + myuse = pkg._metadata["KEYWORDS"].split() + + for mykey in myuse: + if mykey not in ("-*", "*", "~*"): + myskey = mykey + + if not self._isKeywordStable(myskey[:1]): + myskey = myskey[1:] + + if myskey not in kwlist: + self.qatracker.add_error( + "KEYWORDS.invalid", + "%s/%s.ebuild: %s" % ( + package, y_ebuild, mykey)) + elif myskey not in profiles: + self.qatracker.add_error( + "KEYWORDS.invalid", + "%s/%s.ebuild: %s (profile invalid)" % ( + package, y_ebuild, mykey)) + + def _checkForMaskLikeKeywords( + self, package, y_ebuild, keywords, kwlist): + + # KEYWORDS="-*" is a stupid replacement for package.mask + # and screws general KEYWORDS semantics + if "-*" in keywords: + haskeyword = False + + for kw in keywords: + if kw[0] == "~": + kw = kw[1:] + if kw in kwlist: + haskeyword = True + + if not haskeyword: + self.qatracker.add_error( + "KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild") diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 4ded687..ea54ec4 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -445,22 +445,9 @@ for xpkg in effective_scanlist: ####################### keywordcheck.check( pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, changed, - live_ebuild) + live_ebuild, kwlist, profiles) ####################### - # KEYWORDS="-*" is a stupid replacement for package.mask - # and screws general KEYWORDS semantics - if "-*" in keywords: - haskeyword = False - for kw in keywords: - if kw[0] == "~": - kw = kw[1:] - if kw in kwlist: - haskeyword = True - if not haskeyword: - qatracker.add_error("KEYWORDS.stupid", - xpkg + "/" + y_ebuild + ".ebuild") - if live_ebuild and repo_settings.repo_config.name == "gentoo": ####################### liveeclasscheck.check( @@ -637,23 +624,6 @@ for xpkg in effective_scanlist: qatracker.add_error("LICENSE.deprecated", "%s: %s" % (ebuild.relative_path, lic)) - # keyword checks - myuse = myaux["KEYWORDS"].split() - for mykey in myuse: - if mykey not in ("-*", "*", "~*"): - myskey = mykey - if myskey[:1] == "-": - myskey = myskey[1:] - if myskey[:1] == "~": - myskey = myskey[1:] - if myskey not in kwlist: - qatracker.add_error("KEYWORDS.invalid", - "%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey)) - elif myskey not in profiles: - qatracker.add_error("KEYWORDS.invalid", - "%s/%s.ebuild: %s (profile invalid)" - % (xpkg, y_ebuild, mykey)) - # restrict checks myrestrict = None try: From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 683CE13881E for ; Mon, 21 Sep 2015 23:48:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A0921E0835; Mon, 21 Sep 2015 23:47:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 24850E0835 for ; Mon, 21 Sep 2015 23:47:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1CA2B340821 for ; Mon, 21 Sep 2015 23:47:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5C3CA1FD for ; Mon, 21 Sep 2015 23:47:55 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1442878964.1850a6ebe46abcee14fbf6d28901b186150c2a18.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/keywords.py pym/repoman/main.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 1850a6ebe46abcee14fbf6d28901b186150c2a18 X-VCS-Branch: repoman Date: Mon, 21 Sep 2015 23:47:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4f11ca48-b603-4e2e-a7d0-6f8f94fc41f3 X-Archives-Hash: 42dc5e88a709d1c8e356354e3b6f0b03 Message-ID: <20150921234755.hAWOXPVre-NBGm4_sAO0cMuJoe6lfdaNRlAB1Wxd5hM@z> commit: 1850a6ebe46abcee14fbf6d28901b186150c2a18 Author: Tom Wijsman gentoo org> AuthorDate: Wed Jun 4 14:17:49 2014 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Mon Sep 21 23:42:44 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1850a6eb repoman/main.py: More KEYWORDS checks to checks/ebuilds/keywords.py pym/repoman/checks/ebuilds/keywords.py | 64 ++++++++++++++++++++++++++++++---- pym/repoman/main.py | 32 +---------------- 2 files changed, 59 insertions(+), 37 deletions(-) diff --git a/pym/repoman/checks/ebuilds/keywords.py b/pym/repoman/checks/ebuilds/keywords.py index b724269..235c751 100644 --- a/pym/repoman/checks/ebuilds/keywords.py +++ b/pym/repoman/checks/ebuilds/keywords.py @@ -21,7 +21,7 @@ class KeywordChecks(object): def check( self, pkg, package, ebuild, y_ebuild, keywords, ebuild_archs, changed, - live_ebuild): + live_ebuild, kwlist, profiles): '''Perform the check. @param pkg: Package in which we check (object). @@ -33,21 +33,32 @@ class KeywordChecks(object): @param changed: Changes instance @param slot_keywords: A dictionary of keywords per slot. @param live_ebuild: A boolean that determines if this is a live ebuild. + @param kwlist: A list of all global keywords. + @param profiles: A list of all profiles. ''' if not self.options.straight_to_stable: self._checkAddedWithStableKeywords( package, ebuild, y_ebuild, keywords, changed) + self._checkForDroppedKeywords( pkg, ebuild, ebuild_archs, live_ebuild) + self._checkForInvalidKeywords( + pkg, package, y_ebuild, kwlist, profiles) + + self._checkForMaskLikeKeywords( + package, y_ebuild, keywords, kwlist) + self.slot_keywords[pkg.slot].update(ebuild_archs) + def _isKeywordStable(self, keyword): + return not keyword.startswith("~") and not keyword.startswith("-") + def _checkAddedWithStableKeywords( self, package, ebuild, y_ebuild, keywords, changed): catdir, pkgdir = package.split("/") - is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-") - stable_keywords = list(filter(is_stable, keywords)) + stable_keywords = list(filter(self._isKeywordStable, keywords)) if stable_keywords: if ebuild.ebuild_path in changed.new_ebuilds and catdir != "virtual": stable_keywords.sort() @@ -64,6 +75,47 @@ class KeywordChecks(object): elif ebuild_archs and "*" not in ebuild_archs and not live_ebuild: dropped_keywords = previous_keywords.difference(ebuild_archs) if dropped_keywords: - self.qatracker.add_error("KEYWORDS.dropped", - "%s: %s" % - (ebuild.relative_path, " ".join(sorted(dropped_keywords)))) + self.qatracker.add_error( + "KEYWORDS.dropped", "%s: %s" % ( + ebuild.relative_path, + " ".join(sorted(dropped_keywords)))) + + def _checkForInvalidKeywords( + self, pkg, package, y_ebuild, kwlist, profiles): + myuse = pkg._metadata["KEYWORDS"].split() + + for mykey in myuse: + if mykey not in ("-*", "*", "~*"): + myskey = mykey + + if not self._isKeywordStable(myskey[:1]): + myskey = myskey[1:] + + if myskey not in kwlist: + self.qatracker.add_error( + "KEYWORDS.invalid", + "%s/%s.ebuild: %s" % ( + package, y_ebuild, mykey)) + elif myskey not in profiles: + self.qatracker.add_error( + "KEYWORDS.invalid", + "%s/%s.ebuild: %s (profile invalid)" % ( + package, y_ebuild, mykey)) + + def _checkForMaskLikeKeywords( + self, package, y_ebuild, keywords, kwlist): + + # KEYWORDS="-*" is a stupid replacement for package.mask + # and screws general KEYWORDS semantics + if "-*" in keywords: + haskeyword = False + + for kw in keywords: + if kw[0] == "~": + kw = kw[1:] + if kw in kwlist: + haskeyword = True + + if not haskeyword: + self.qatracker.add_error( + "KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild") diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 4ded687..ea54ec4 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -445,22 +445,9 @@ for xpkg in effective_scanlist: ####################### keywordcheck.check( pkg, xpkg, ebuild, y_ebuild, keywords, ebuild_archs, changed, - live_ebuild) + live_ebuild, kwlist, profiles) ####################### - # KEYWORDS="-*" is a stupid replacement for package.mask - # and screws general KEYWORDS semantics - if "-*" in keywords: - haskeyword = False - for kw in keywords: - if kw[0] == "~": - kw = kw[1:] - if kw in kwlist: - haskeyword = True - if not haskeyword: - qatracker.add_error("KEYWORDS.stupid", - xpkg + "/" + y_ebuild + ".ebuild") - if live_ebuild and repo_settings.repo_config.name == "gentoo": ####################### liveeclasscheck.check( @@ -637,23 +624,6 @@ for xpkg in effective_scanlist: qatracker.add_error("LICENSE.deprecated", "%s: %s" % (ebuild.relative_path, lic)) - # keyword checks - myuse = myaux["KEYWORDS"].split() - for mykey in myuse: - if mykey not in ("-*", "*", "~*"): - myskey = mykey - if myskey[:1] == "-": - myskey = myskey[1:] - if myskey[:1] == "~": - myskey = myskey[1:] - if myskey not in kwlist: - qatracker.add_error("KEYWORDS.invalid", - "%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey)) - elif myskey not in profiles: - qatracker.add_error("KEYWORDS.invalid", - "%s/%s.ebuild: %s (profile invalid)" - % (xpkg, y_ebuild, mykey)) - # restrict checks myrestrict = None try: