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-00066U-K7 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 319D6E0AA3; 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 DEB0FE0AA3 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 261AD1B400C 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 DFB3DE5405 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: <1330250340.b684a8d3a73da02423d090c58c0f1536c25b093b.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/depgraph.py pym/portage/tests/resolver/test_autounmask.py X-VCS-Directories: pym/portage/tests/resolver/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: b684a8d3a73da02423d090c58c0f1536c25b093b 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: e512f40f-9bcd-4553-bb54-c4f717d80e52 X-Archives-Hash: 9005a42b1dc7f24b6dcd07e1a8083c1f commit: b684a8d3a73da02423d090c58c0f1536c25b093b Author: Sebastian Luther gmx de> AuthorDate: Sun Feb 26 09:34:31 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Feb 26 09:59:00 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Db684a8d3 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. --- pym/_emerge/depgraph.py | 33 +++++++++++++---- pym/portage/tests/resolver/test_autounmask.py | 47 +++++++++++++++++++= +++++- 2 files changed, 71 insertions(+), 9 deletions(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index a05c17e..e4310b4 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -3505,15 +3505,31 @@ class depgraph(object): return True =20 class _AutounmaskLevel(object): - __slots__ =3D ("allow_use_changes", "allow_unstable_keywords", "allow_= license_changes", "allow_unmasks") + __slots__ =3D ("allow_use_changes", "allow_unstable_keywords", "allow_= license_changes", \ + "allow_missing_keywords", "allow_unmasks") =20 def __init__(self): self.allow_use_changes =3D False - self.allow_unstable_keywords =3D False self.allow_license_changes =3D False + self.allow_unstable_keywords =3D False + self.allow_missing_keywords =3D False self.allow_unmasks =3D False =20 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 + """ =20 if self._dynamic_config._autounmask is not True: return @@ -3528,11 +3544,13 @@ class depgraph(object): autounmask_level.allow_unstable_keywords =3D (not only_use_changes) autounmask_level.allow_license_changes =3D (not only_use_changes) =20 - 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 =20 - autounmask_level.allow_unmasks =3D allow_unmasks + autounmask_level.allow_missing_keywords =3D missing_keyword + autounmask_level.allow_unmasks =3D unmask =20 yield autounmask_level =20 @@ -3634,9 +3652,8 @@ class depgraph(object): #Package has already been unmasked. return True =20 - #We treat missing keywords in the same way as masks. 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_missing_keywords and not autounmask_level.allow_missing_ke= ywords) 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. diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/= tests/resolver/test_autounmask.py index 3da1c25..46dbab1 100644 --- a/pym/portage/tests/resolver/test_autounmask.py +++ b/pym/portage/tests/resolver/test_autounmask.py @@ -391,7 +391,11 @@ class AutounmaskTestCase(TestCase): =20 =20 def testAutounmaskKeepMasks(self): - + """ + Ensure that we try to use a masked version with keywords before trying + masked version with missing keywords (prefer masked regular version + over -9999 version). + """ ebuilds =3D { "app-text/A-1": {}, } @@ -427,3 +431,44 @@ class AutounmaskTestCase(TestCase): self.assertEqual(test_case.test_success, True, test_case.fail_msg) finally: playground.cleanup() + + + def testAutounmask9999(self): + + ebuilds =3D { + "dev-libs/A-1": { }, + "dev-libs/A-2": { }, + "dev-libs/A-9999": { "KEYWORDS": "" }, + "dev-libs/B-1": { "DEPEND": ">=3Ddev-libs/A-2" }, + "dev-libs/C-1": { "DEPEND": ">=3Ddev-libs/A-3" }, + } + + profile =3D { + "package.mask": + ( + ">=3Ddev-libs/A-2", + ), + } + + test_cases =3D ( + ResolverPlaygroundTestCase( + ["dev-libs/B"], + success =3D False, + mergelist =3D ["dev-libs/A-2", "dev-libs/B-1"], + needed_p_mask_changes =3D set(["dev-libs/A-2"])), + + ResolverPlaygroundTestCase( + ["dev-libs/C"], + success =3D False, + mergelist =3D ["dev-libs/A-9999", "dev-libs/C-1"], + unstable_keywords =3D set(["dev-libs/A-9999"]), + needed_p_mask_changes =3D set(["dev-libs/A-9999"])), + ) + + playground =3D ResolverPlayground(ebuilds=3Debuilds, profile=3Dprofile= ) + try: + for test_case in test_cases: + playground.run_TestCase(test_case) + self.assertEqual(test_case.test_success, True, test_case.fail_msg) + finally: + playground.cleanup()