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 E700F1387B1 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 DE03F21C01C; Mon, 21 Sep 2015 23:47:59 +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 2C4A221C00E for ; Mon, 21 Sep 2015 23:47:59 +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 469FE3409A4 for ; Mon, 21 Sep 2015 23:47:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 827EE237 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.4436beeb6f74ffe091cfdfab4975960edf687fbb.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/variables/__init__.py pym/repoman/checks/ebuilds/variables/eapi.py pym/repoman/main.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/variables/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 4436beeb6f74ffe091cfdfab4975960edf687fbb 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: b7c46141-1f7f-4414-a621-b5c8cd6c475d X-Archives-Hash: 9a1c5504cbb272c448bed45c60ae899a commit: 4436beeb6f74ffe091cfdfab4975960edf687fbb Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:40:39 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=4436beeb repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 ++++++++++++++++++++++++ pym/repoman/main.py | 12 +++---- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 0000000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, qatracker, repo_settings): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = qatracker + self.repo_settings = repo_settings + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + eapi = pkg._metadata["EAPI"] + + if not self._checkBanned(ebuild, eapi): + self._checkDeprecated(ebuild, eapi) + + def _checkBanned(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_banned(eapi): + self.qatracker.add_error( + "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) + + return True + + return False + + def _checkDeprecated(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_deprecated(eapi): + self.qatracker.add_error( + "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + + return True + + return False diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 1e23387..42600cd 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ###################### for xpkg in effective_scanlist: @@ -396,13 +398,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + ####################### + eapicheck.check(pkg, ebuild) + ####################### for k, v in myaux.items(): if not isinstance(v, basestring): 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 CE87D13881D for ; Mon, 21 Sep 2015 23:51:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C576AE0870; Mon, 21 Sep 2015 23:51:24 +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 0548721C007 for ; Mon, 21 Sep 2015 23:51:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2EABD34099A for ; Mon, 21 Sep 2015 23:51:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 720E2237 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.4436beeb6f74ffe091cfdfab4975960edf687fbb.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/variables/__init__.py pym/repoman/checks/ebuilds/variables/eapi.py pym/repoman/main.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/variables/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 4436beeb6f74ffe091cfdfab4975960edf687fbb 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: d1c1ae03-9b24-412f-9177-49ba405a7285 X-Archives-Hash: 29425f7b1b8e6b15417a8bfb6156a0a7 Message-ID: <20150921235118.P-SPlL-lunByfaVDhm43wxsDxZiv3HAFXGCC815KqJo@z> commit: 4436beeb6f74ffe091cfdfab4975960edf687fbb Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 14:40:39 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=4436beeb repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py pym/repoman/checks/ebuilds/variables/__init__.py | 0 pym/repoman/checks/ebuilds/variables/eapi.py | 44 ++++++++++++++++++++++++ pym/repoman/main.py | 12 +++---- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py new file mode 100644 index 0000000..2f8b1cb --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/eapi.py @@ -0,0 +1,44 @@ + +'''eapi.py +Perform checks on the EAPI variable. +''' + + +class EAPIChecks(object): + '''Perform checks on the EAPI variable.''' + + def __init__(self, qatracker, repo_settings): + ''' + @param qatracker: QATracker instance + @param repo_settings: Repository settings + ''' + self.qatracker = qatracker + self.repo_settings = repo_settings + + def check(self, pkg, ebuild): + ''' + @param pkg: Package in which we check (object). + @param ebuild: Ebuild which we check (object). + ''' + eapi = pkg._metadata["EAPI"] + + if not self._checkBanned(ebuild, eapi): + self._checkDeprecated(ebuild, eapi) + + def _checkBanned(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_banned(eapi): + self.qatracker.add_error( + "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) + + return True + + return False + + def _checkDeprecated(self, ebuild, eapi): + if self.repo_settings.repo_config.eapi_is_deprecated(eapi): + self.qatracker.add_error( + "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + + return True + + return False diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 1e23387..42600cd 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid from repoman.checks.ebuilds.pkgmetadata import PkgMetadata from repoman.checks.ebuilds.use_flags import USEFlagChecks +from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist) keywordcheck = KeywordChecks(qatracker, options) liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) +eapicheck = EAPIChecks(qatracker, repo_settings) ###################### for xpkg in effective_scanlist: @@ -396,13 +398,9 @@ for xpkg in effective_scanlist: inherited = pkg.inherited live_ebuild = live_eclasses.intersection(inherited) - if repo_settings.repo_config.eapi_is_banned(eapi): - qatracker.add_error( - "repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi)) - - elif repo_settings.repo_config.eapi_is_deprecated(eapi): - qatracker.add_error( - "repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi)) + ####################### + eapicheck.check(pkg, ebuild) + ####################### for k, v in myaux.items(): if not isinstance(v, basestring):