diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2012-02-26 10:34:31 +0100 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-02-26 01:59:00 -0800 |
commit | b684a8d3a73da02423d090c58c0f1536c25b093b (patch) | |
tree | 658ae4a7ea25609220bf92e011c936469ae4287d /pym/_emerge | |
parent | c9a0df701f983b41fd0f1aac7bb4536f771846cb (diff) | |
download | portage-b684a8d3a73da02423d090c58c0f1536c25b093b.tar.gz portage-b684a8d3a73da02423d090c58c0f1536c25b093b.tar.bz2 portage-b684a8d3a73da02423d090c58c0f1536c25b093b.zip |
autounmask: Avoid unmasking live versions if possible
Before this patch the allowed changes were:
1. USE
2. USE + ~arch + license
3. USE + ~arch + license + missing keywords + masks
With this patch:
1. USE
2. USE + ~arch + license
3. USE + ~arch + license + missing keywords
4. USE + ~arch + license + masks
5. USE + ~arch + license + missing keywords + masks
This avoids unmasking live versions, which are typically masked
and have missing keywords to be avoided if there is a regular
masked version available.
Diffstat (limited to 'pym/_emerge')
-rw-r--r-- | pym/_emerge/depgraph.py | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index a05c17e93..e4310b480 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3505,15 +3505,31 @@ class depgraph(object): return True class _AutounmaskLevel(object): - __slots__ = ("allow_use_changes", "allow_unstable_keywords", "allow_license_changes", "allow_unmasks") + __slots__ = ("allow_use_changes", "allow_unstable_keywords", "allow_license_changes", \ + "allow_missing_keywords", "allow_unmasks") def __init__(self): self.allow_use_changes = False - self.allow_unstable_keywords = False self.allow_license_changes = False + self.allow_unstable_keywords = False + self.allow_missing_keywords = False self.allow_unmasks = False def _autounmask_levels(self): + """ + Iterate over the different allowed things to unmask. + + 1. USE + 2. USE + ~arch + license + 3. USE + ~arch + license + missing keywords + 4. USE + ~arch + license + masks + 5. USE + ~arch + license + missing keywords + masks + + Some thoughts: + * Do least invasive changes first. + * Try unmasking alone before unmasking + missing keywords + to avoid -9999 versions if possible + """ if self._dynamic_config._autounmask is not True: return @@ -3528,11 +3544,13 @@ class depgraph(object): autounmask_level.allow_unstable_keywords = (not only_use_changes) autounmask_level.allow_license_changes = (not only_use_changes) - for allow_unmasks in (False, True): - if allow_unmasks and (only_use_changes or autounmask_keep_masks): - continue + for missing_keyword, unmask in ((False,False), (True, False), (False, True), (True, True)): + + if (only_use_changes or autounmask_keep_masks) and (missing_keyword or unmask): + break - autounmask_level.allow_unmasks = allow_unmasks + autounmask_level.allow_missing_keywords = missing_keyword + autounmask_level.allow_unmasks = unmask yield autounmask_level @@ -3634,9 +3652,8 @@ class depgraph(object): #Package has already been unmasked. return True - #We treat missing keywords in the same way as masks. if (masked_by_unstable_keywords and not autounmask_level.allow_unstable_keywords) or \ - (masked_by_missing_keywords and not autounmask_level.allow_unmasks) or \ + (masked_by_missing_keywords and not autounmask_level.allow_missing_keywords) or \ (masked_by_p_mask and not autounmask_level.allow_unmasks) or \ (missing_licenses and not autounmask_level.allow_license_changes): #We are not allowed to do the needed changes. |