From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S1auk-00066G-Jj for garchives@archives.gentoo.org; Sun, 26 Feb 2012 10:01:10 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4CCF2E0BFE; Sun, 26 Feb 2012 10:01:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0FDF3E0BFE for ; Sun, 26 Feb 2012 10:00:59 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1735D1B400A for ; Sun, 26 Feb 2012 10:00:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A4EE4E53FD for ; Sun, 26 Feb 2012 10:00:57 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1330249456.c9a0df701f983b41fd0f1aac7bb4536f771846cb.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: c9a0df701f983b41fd0f1aac7bb4536f771846cb X-VCS-Branch: master Date: Sun, 26 Feb 2012 10:00:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: a4f0d452-171c-4eb0-a2ca-134abc689f04 X-Archives-Hash: 9ab56b72722a14427d8dd48679d1d7b1 commit: c9a0df701f983b41fd0f1aac7bb4536f771846cb Author: Sebastian Luther gmx de> AuthorDate: Sun Feb 26 08:49:13 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Feb 26 09:44:16 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dc9a0df70 Reorganize how autounmask allows changes to be made This patch does not change emerge's behaviour. --- pym/_emerge/depgraph.py | 109 ++++++++++++++++++++++++-----------------= ----- 1 files changed, 57 insertions(+), 52 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index bb3bf4a..a05c17e 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3504,42 +3504,63 @@ class depgraph(object): return False return True =20 + class _AutounmaskLevel(object): + __slots__ =3D ("allow_use_changes", "allow_unstable_keywords", "allow_= license_changes", "allow_unmasks") + + def __init__(self): + self.allow_use_changes =3D False + self.allow_unstable_keywords =3D False + self.allow_license_changes =3D False + self.allow_unmasks =3D False + + def _autounmask_levels(self): + + if self._dynamic_config._autounmask is not True: + return + + autounmask_keep_masks =3D self._frozen_config.myopts.get("--autounmask= -keep-masks", "n") !=3D "n" + autounmask_level =3D self._AutounmaskLevel() + + autounmask_level.allow_use_changes =3D True + + for only_use_changes in (True, False): + + autounmask_level.allow_unstable_keywords =3D (not only_use_changes) + autounmask_level.allow_license_changes =3D (not only_use_changes) + + for allow_unmasks in (False, True): + if allow_unmasks and (only_use_changes or autounmask_keep_masks): + continue + + autounmask_level.allow_unmasks =3D allow_unmasks + + yield autounmask_level + + def _select_pkg_highest_available_imp(self, root, atom, onlydeps=3DFals= e): pkg, existing =3D self._wrapped_select_pkg_highest_available_imp(root,= atom, onlydeps=3Donlydeps) =20 default_selection =3D (pkg, existing) =20 - autounmask_keep_masks =3D self._frozen_config.myopts.get("--autounmask= -keep-masks", "n") !=3D "n" - - if self._dynamic_config._autounmask is True: + def reset_pkg(pkg): if pkg is not None and \ pkg.installed and \ not self._want_installed_pkg(pkg): pkg =3D None =20 - for only_use_changes in True, False: + if self._dynamic_config._autounmask is True: + reset_pkg(pkg) + + for autounmask_level in self._autounmask_levels(): if pkg is not None: break =20 - for allow_unmasks in (False, True): - if allow_unmasks and (only_use_changes or autounmask_keep_masks): - continue - - if pkg is not None: - break + pkg, existing =3D \ + self._wrapped_select_pkg_highest_available_imp( + root, atom, onlydeps=3Donlydeps, + autounmask_level=3Dautounmask_level) =20 - pkg, existing =3D \ - self._wrapped_select_pkg_highest_available_imp( - root, atom, onlydeps=3Donlydeps, - allow_use_changes=3DTrue, - allow_unstable_keywords=3D(not only_use_changes), - allow_license_changes=3D(not only_use_changes), - allow_unmasks=3Dallow_unmasks) - - if pkg is not None and \ - pkg.installed and \ - not self._want_installed_pkg(pkg): - pkg =3D None + reset_pkg(pkg) =09 if self._dynamic_config._need_restart: return None, None @@ -3551,8 +3572,7 @@ class depgraph(object): =20 return pkg, existing =20 - def _pkg_visibility_check(self, pkg, allow_unstable_keywords=3DFalse, - allow_license_changes=3DFalse, allow_unmasks=3DFalse, trust_graph=3DTr= ue): + def _pkg_visibility_check(self, pkg, autounmask_level=3DNone, trust_gra= ph=3DTrue): =20 if pkg.visible: return True @@ -3565,7 +3585,7 @@ class depgraph(object): # as though they are visible. return True =20 - if not self._dynamic_config._autounmask: + if not self._dynamic_config._autounmask or autounmask_level is None: return False =20 pkgsettings =3D self._frozen_config.pkgsettings[pkg.root] @@ -3615,10 +3635,10 @@ class depgraph(object): return True =20 #We treat missing keywords in the same way as masks. - if (masked_by_unstable_keywords and not allow_unstable_keywords) or \ - (masked_by_missing_keywords and not allow_unmasks) or \ - (masked_by_p_mask and not allow_unmasks) or \ - (missing_licenses and not allow_license_changes): + if (masked_by_unstable_keywords and not autounmask_level.allow_unstabl= e_keywords) or \ + (masked_by_missing_keywords and not autounmask_level.allow_unmasks) o= r \ + (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. return False =20 @@ -3733,8 +3753,7 @@ class depgraph(object): self._dynamic_config._need_restart =3D True return new_use =20 - def _wrapped_select_pkg_highest_available_imp(self, root, atom, onlydep= s=3DFalse, \ - allow_use_changes=3DFalse, allow_unstable_keywords=3DFalse, allow_lice= nse_changes=3DFalse, allow_unmasks=3DFalse): + def _wrapped_select_pkg_highest_available_imp(self, root, atom, onlydep= s=3DFalse, autounmask_level=3DNone): root_config =3D self._frozen_config.roots[root] pkgsettings =3D self._frozen_config.pkgsettings[root] dbs =3D self._dynamic_config._filtered_trees[root]["dbs"] @@ -3861,10 +3880,7 @@ class depgraph(object): # _dep_check_composite_db, in order to prevent # incorrect choices in || deps like bug #351828. =20 - if not self._pkg_visibility_check(pkg, \ - allow_unstable_keywords=3Dallow_unstable_keywords, - allow_license_changes=3Dallow_license_changes, - allow_unmasks=3Dallow_unmasks): + if not self._pkg_visibility_check(pkg, autounmask_level): continue =20 # Enable upgrade or downgrade to a version @@ -3904,19 +3920,13 @@ class depgraph(object): pkg_eb_visible =3D False for pkg_eb in self._iter_match_pkgs(pkg.root_config, "ebuild", Atom("=3D%s" % (pkg.cpv,))): - if self._pkg_visibility_check(pkg_eb, \ - allow_unstable_keywords=3Dallow_unstable_keywords, - allow_license_changes=3Dallow_license_changes, - allow_unmasks=3Dallow_unmasks): + if self._pkg_visibility_check(pkg_eb, autounmask_level): pkg_eb_visible =3D True break if not pkg_eb_visible: continue else: - if not self._pkg_visibility_check(pkg_eb, \ - allow_unstable_keywords=3Dallow_unstable_keywords, - allow_license_changes=3Dallow_license_changes, - allow_unmasks=3Dallow_unmasks): + if not self._pkg_visibility_check(pkg_eb, autounmask_level): continue =20 # Calculation of USE for unbuilt ebuilds is relatively @@ -3946,7 +3956,7 @@ class depgraph(object): if atom.use: =20 matched_pkgs_ignore_use.append(pkg) - if allow_use_changes and not pkg.built: + if autounmask_level and autounmask_level.allow_use_changes and not= pkg.built: target_use =3D {} for flag in atom.use.enabled: target_use[flag] =3D True @@ -4169,21 +4179,16 @@ class depgraph(object): =20 if avoid_update: for pkg in matched_packages: - if pkg.installed and self._pkg_visibility_check(pkg, \ - allow_unstable_keywords=3Dallow_unstable_keywords, - allow_license_changes=3Dallow_license_changes, - allow_unmasks=3Dallow_unmasks): + if pkg.installed and self._pkg_visibility_check(pkg, autounmask_lev= el): return pkg, existing_node =20 visible_matches =3D [] if matched_oldpkg: visible_matches =3D [pkg.cpv for pkg in matched_oldpkg \ - if self._pkg_visibility_check(pkg, allow_unstable_keywords=3Dallow_= unstable_keywords, - allow_license_changes=3Dallow_license_changes, allow_unmasks=3Dall= ow_unmasks)] + if self._pkg_visibility_check(pkg, autounmask_level)] if not visible_matches: visible_matches =3D [pkg.cpv for pkg in matched_packages \ - if self._pkg_visibility_check(pkg, allow_unstable_keywords=3Dallow_= unstable_keywords, - allow_license_changes=3Dallow_license_changes, allow_unmasks=3Dall= ow_unmasks)] + if self._pkg_visibility_check(pkg, autounmask_level)] if visible_matches: bestmatch =3D portage.best(visible_matches) else: