From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/, pym/gentoolkit/enalyze/
Date: Thu, 7 Jun 2012 07:59:49 +0000 (UTC) [thread overview]
Message-ID: <1339055864.a9881a28da795ce2285187062bfaa822d4e55a18.dol-sen@gentoo> (raw)
commit: a9881a28da795ce2285187062bfaa822d4e55a18
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 7 07:57:44 2012 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu Jun 7 07:57:44 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=a9881a28
fix a bug in enalyze rebuild where it did not consider IUSE defaults for calculating the use flag differences. Discovered by mingdao in #gentoo.
---
pym/gentoolkit/enalyze/lib.py | 23 +++++++++++++++--------
pym/gentoolkit/flag.py | 16 ++++++++++++++++
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/pym/gentoolkit/enalyze/lib.py b/pym/gentoolkit/enalyze/lib.py
index 015e23b..9dc28a3 100644
--- a/pym/gentoolkit/enalyze/lib.py
+++ b/pym/gentoolkit/enalyze/lib.py
@@ -14,7 +14,7 @@ from gentoolkit.dbapi import PORTDB, VARDB
from gentoolkit import errors
from gentoolkit.keyword import reduce_keywords
from gentoolkit.flag import (reduce_flags, get_flags, get_all_cpv_use,
- filter_flags, get_installed_use, get_iuse)
+ filter_flags, get_installed_use, get_iuse, defaulted_flags)
#from gentoolkit.package import Package
import portage
@@ -65,10 +65,12 @@ class FlagAnalyzer(object):
@return (plus, minus, unset) sets of USE flags
"""
installed = set(self.get_used(cpv, self.target))
- iuse = set(reduce_flags(self.get_flags(cpv)))
- return self._analyse(installed, iuse)
+ _iuse = self.get_flags(cpv)
+ iuse = set(reduce_flags(_iuse))
+ iuse_defaults = defaulted_flags(_iuse)
+ return self._analyse(installed, iuse, iuse_defaults)
- def _analyse(self, installed, iuse):
+ def _analyse(self, installed, iuse, iuse_defaults):
"""Analyzes the supplied info and returns the flag settings
that differ from the defaults
@@ -78,6 +80,9 @@ class FlagAnalyzer(object):
@param iuse: the current ebuilds IUSE
"""
defaults = self.system.intersection(iuse)
+ # update defaults with iuse_defaults
+ defaults.update(iuse_defaults['+'])
+ defaults = defaults.difference(iuse_defaults['-'])
usedflags = iuse.intersection(set(installed))
if self.filter_defaults:
plus = usedflags.difference(defaults)
@@ -98,10 +103,12 @@ class FlagAnalyzer(object):
@return (plus, minus, unset) sets of USE flags
"""
installed = set(self.pkg_used(pkg))
- print("installed =", installed)
- iuse = set(reduce_flags(self.pkg_flags(pkg)))
- print("iuse =", iuse)
- return self._analyse(installed, iuse)
+ #print("installed =", installed)
+ _iuse = self.pkg_flags(pkg)
+ iuse = set(reduce_flags(_iuse))
+ iuse_defaults = defaulted_flags(_iuse)
+ #print("iuse =", iuse)
+ return self._analyse(installed, iuse, iuse_defaults)
def pkg_used(self, pkg):
if self.target == "USE":
diff --git a/pym/gentoolkit/flag.py b/pym/gentoolkit/flag.py
index b5c8228..0377a81 100644
--- a/pym/gentoolkit/flag.py
+++ b/pym/gentoolkit/flag.py
@@ -13,6 +13,7 @@ __all__ = (
'get_installed_use',
'reduce_flag',
'reduce_flags',
+ 'defaulted_flags',
'filter_flags',
'get_all_cpv_use',
'get_flags'
@@ -84,6 +85,21 @@ def reduce_flags(the_list):
return r
+def defaulted_flags(the_list):
+ """Absolute value function for a USE flag list
+
+ @type the_list: list
+ @param the_list: the use flags to get defaulted ones from.
+ @rtype: dict of lists
+ @return defaulted USE flags {'+': [...], '-': [...]}
+ """
+ r={"+":[], "-": []}
+ for member in the_list:
+ if member[0] in ["+","-"]:
+ r[member[0]].append(member[1:])
+ return r
+
+
def filter_flags(use, use_expand_hidden, usemasked, useforced):
"""Filter function to remove hidden or otherwise not normally
visible USE flags from a list.
next reply other threads:[~2012-06-07 8:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 7:59 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-06-29 2:40 [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/, pym/gentoolkit/enalyze/ Brian Dolbec
2012-08-01 3:26 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339055864.a9881a28da795ce2285187062bfaa822d4e55a18.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox