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 BCCB31386F1 for ; Mon, 10 Aug 2015 14:45:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A5B4F95744; Mon, 10 Aug 2015 14:45:36 +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 8B7209573E for ; Mon, 10 Aug 2015 14:45:35 +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 66D1F3409FE for ; Mon, 10 Aug 2015 14:45:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3079E156 for ; Mon, 10 Aug 2015 14:45:32 +0000 (UTC) From: "Michał Górny" 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" Message-ID: <1439217920.b4a778380fd8d6a0750ef296d9b3afc5038d0d30.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/use_flags.py X-VCS-Directories: pym/repoman/checks/ebuilds/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: b4a778380fd8d6a0750ef296d9b3afc5038d0d30 X-VCS-Branch: repoman Date: Mon, 10 Aug 2015 14:45:32 +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: aef4424b-cd99-401f-9925-549a81c47366 X-Archives-Hash: 4e5a3555d0b998c4ff37009da352a54f commit: b4a778380fd8d6a0750ef296d9b3afc5038d0d30 Author: Brian Dolbec gentoo org> AuthorDate: Tue Jun 3 19:39:56 2014 +0000 Commit: Michał Górny gentoo org> CommitDate: Mon Aug 10 14:45:20 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4a77838 repoman.../use_flags.py: Reset state variables for each check() run Also double space function separations. pym/repoman/checks/ebuilds/use_flags.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/checks/ebuilds/use_flags.py index bc09ed7..d63ae6d 100644 --- a/pym/repoman/checks/ebuilds/use_flags.py +++ b/pym/repoman/checks/ebuilds/use_flags.py @@ -19,10 +19,11 @@ class USEFlagChecks(object): @param globalUseFlags: Global USE flags ''' self.qatracker = qatracker + self.globalUseFlags = globalUseFlags self.useFlags = [] self.defaultUseFlags = [] self.usedUseFlags = set() - self.globalUseFlags = globalUseFlags + def check(self, pkg, package, ebuild, y_ebuild, localUseFlags): '''Perform the check. @@ -33,14 +34,20 @@ class USEFlagChecks(object): @param y_ebuild: Ebuild which we check (string). @param localUseFlags: Local USE flags of the package ''' + # reset state variables for the run + self.useFlags = [] + self.defaultUseFlags = [] + self.usedUseFlags = set() self._checkGlobal(pkg) self._checkMetadata(package, ebuild, y_ebuild, localUseFlags) self._checkRequiredUSE(pkg, ebuild) + def getUsedUseFlags(self): '''Get the USE flags that this check has seen''' return self.usedUseFlags + def _checkGlobal(self, pkg): for myflag in pkg._metadata["IUSE"].split(): flag_name = myflag.lstrip("+-") @@ -50,6 +57,7 @@ class USEFlagChecks(object): if flag_name not in self.globalUseFlags: self.useFlags.append(flag_name) + def _checkMetadata(self, package, ebuild, y_ebuild, localUseFlags): for mypos in range(len(self.useFlags) - 1, -1, -1): if self.useFlags[mypos] and (self.useFlags[mypos] in localUseFlags): @@ -67,6 +75,7 @@ class USEFlagChecks(object): "IUSE.invalid", "%s/%s.ebuild: %s" % (package, y_ebuild, self.useFlags[mypos])) + def _checkRequiredUSE(self, pkg, ebuild): required_use = pkg._metadata["REQUIRED_USE"] if required_use: