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 74D9D58973 for ; Wed, 27 Jan 2016 23:15:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4E0D921C084; Wed, 27 Jan 2016 23:15:39 +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 AC9AD21C084 for ; Wed, 27 Jan 2016 23:15:38 +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 CEB53340A23 for ; Wed, 27 Jan 2016 23:15:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0352710FB for ; Wed, 27 Jan 2016 23:15:33 +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: <1453934662.c1bea69ecabc1fca0ae90def2afd4216ad5e9795.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/arches/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/modules/scan/arches/__init__.py pym/repoman/modules/scan/arches/arches.py pym/repoman/scanner.py X-VCS-Directories: pym/repoman/ pym/repoman/modules/scan/arches/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: c1bea69ecabc1fca0ae90def2afd4216ad5e9795 X-VCS-Branch: repoman Date: Wed, 27 Jan 2016 23:15:33 +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: e69c2682-76f9-4c86-a6ff-9bc6b4ff6ba7 X-Archives-Hash: da8665fb21d4d83f6fe3a0e3b3eb7887 commit: c1bea69ecabc1fca0ae90def2afd4216ad5e9795 Author: Brian Dolbec gentoo org> AuthorDate: Sun Jan 3 19:11:22 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Jan 27 22:44:22 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c1bea69e repoman: Create a new ArchChecks class plugin pym/repoman/modules/scan/arches/__init__.py | 24 +++++++++++ pym/repoman/modules/scan/arches/arches.py | 64 +++++++++++++++++++++++++++++ pym/repoman/scanner.py | 47 +-------------------- 3 files changed, 90 insertions(+), 45 deletions(-) diff --git a/pym/repoman/modules/scan/arches/__init__.py b/pym/repoman/modules/scan/arches/__init__.py new file mode 100644 index 0000000..d080c30 --- /dev/null +++ b/pym/repoman/modules/scan/arches/__init__.py @@ -0,0 +1,24 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Arches plug-in module for repoman. +Performs archs checks on ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'arches', + 'description': doc, + 'provides':{ + 'archs-module': { + 'name': "arches", + 'sourcefile': "arches", + 'class': "ArchChecks", + 'description': doc, + 'functions': ['check'], + 'func_desc': { + }, + }, + } +} + diff --git a/pym/repoman/modules/scan/arches/arches.py b/pym/repoman/modules/scan/arches/arches.py new file mode 100644 index 0000000..2c32028 --- /dev/null +++ b/pym/repoman/modules/scan/arches/arches.py @@ -0,0 +1,64 @@ +# -*- coding:utf-8 -*- + + +class ArchChecks(object): + + def __init__(self, **kwargs): + self.options = kwargs.get('options') + self.repo_settings = kwargs.get('repo_settings') + self.profiles = kwargs.get('profiles') + + def check(self, **kwargs): + ebuild = kwargs.get('ebuild') + if self.options.ignore_arches: + arches = [[ + self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"], + self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]] + else: + arches = set() + for keyword in ebuild.keywords: + if keyword[0] == "-": + continue + elif keyword[0] == "~": + arch = keyword[1:] + if arch == "*": + for expanded_arch in self.profiles: + if expanded_arch == "**": + continue + arches.add( + (keyword, expanded_arch, ( + expanded_arch, "~" + expanded_arch))) + else: + arches.add((keyword, arch, (arch, keyword))) + else: + # For ebuilds with stable keywords, check if the + # dependencies are satisfiable for unstable + # configurations, since use.stable.mask is not + # applied for unstable configurations (see bug + # 563546). + if keyword == "*": + for expanded_arch in self.profiles: + if expanded_arch == "**": + continue + arches.add( + (keyword, expanded_arch, (expanded_arch,))) + arches.add( + (keyword, expanded_arch, + (expanded_arch, "~" + expanded_arch))) + else: + arches.add((keyword, keyword, (keyword,))) + arches.add((keyword, keyword, + (keyword, "~" + keyword))) + if not arches: + # Use an empty profile for checking dependencies of + # packages that have empty KEYWORDS. + arches.add(('**', '**', ('**',))) + return {'continue': False, 'arches': arches} + + @property + def runInPkgs(self): + return (False, []) + + @property + def runInEbuilds(self): + return (True, [self.check]) diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py index 6996f38..4cf7ca1 100644 --- a/pym/repoman/scanner.py +++ b/pym/repoman/scanner.py @@ -304,6 +304,7 @@ class Scanner(object): ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'), ('thirdpartymirrors', 'ThirdPartyMirrors'), ('description', 'DescriptionChecks'), (None, 'KeywordChecks'), + ('arches', 'ArchChecks'), ]: if mod[0]: mod_class = MODULE_CONTROLLER.get_class(mod[0]) @@ -354,50 +355,6 @@ class Scanner(object): self.liveeclasscheck.check( dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict']) - if self.options.ignore_arches: - arches = [[ - self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"], - self.repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]] - else: - arches = set() - for keyword in dynamic_data['ebuild'].keywords: - if keyword[0] == "-": - continue - elif keyword[0] == "~": - arch = keyword[1:] - if arch == "*": - for expanded_arch in self.profiles: - if expanded_arch == "**": - continue - arches.add( - (keyword, expanded_arch, ( - expanded_arch, "~" + expanded_arch))) - else: - arches.add((keyword, arch, (arch, keyword))) - else: - # For ebuilds with stable keywords, check if the - # dependencies are satisfiable for unstable - # configurations, since use.stable.mask is not - # applied for unstable configurations (see bug - # 563546). - if keyword == "*": - for expanded_arch in self.profiles: - if expanded_arch == "**": - continue - arches.add( - (keyword, expanded_arch, (expanded_arch,))) - arches.add( - (keyword, expanded_arch, - (expanded_arch, "~" + expanded_arch))) - else: - arches.add((keyword, keyword, (keyword,))) - arches.add((keyword, keyword, - (keyword, "~" + keyword))) - if not arches: - # Use an empty profile for checking dependencies of - # packages that have empty KEYWORDS. - arches.add(('**', '**', ('**',))) - unknown_pkgs = set() baddepsyntax = False badlicsyntax = False @@ -554,7 +511,7 @@ class Scanner(object): continue relevant_profiles = [] - for keyword, arch, groups in arches: + for keyword, arch, groups in dynamic_data['arches']: if arch not in self.profiles: # A missing profile will create an error further down # during the KEYWORDS verification.