summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2012-04-11 19:44:50 +0000
committerBrian Harring <ferringb@gentoo.org>2012-04-11 19:44:50 +0000
commit07d48353b93117264e56bb0e52b3fef1aedc8ff7 (patch)
treea8f982c4c5734d011042a004d44fcc89f0049e49 /sys-apps/pkgcore
parentStable for HPPA (bug #397979). (diff)
downloadgentoo-2-07d48353b93117264e56bb0e52b3fef1aedc8ff7.tar.gz
gentoo-2-07d48353b93117264e56bb0e52b3fef1aedc8ff7.tar.bz2
gentoo-2-07d48353b93117264e56bb0e52b3fef1aedc8ff7.zip
Fix a resolver assert triggered by recent hwids/usbutils changes
(Portage version: 2.1.10.52/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/pkgcore')
-rw-r--r--sys-apps/pkgcore/ChangeLog8
-rw-r--r--sys-apps/pkgcore/files/pkgcore-0.7.7.8-fix-resolver-assert.patch113
-rw-r--r--sys-apps/pkgcore/pkgcore-0.7.7.8-r1.ebuild56
3 files changed, 176 insertions, 1 deletions
diff --git a/sys-apps/pkgcore/ChangeLog b/sys-apps/pkgcore/ChangeLog
index 1e2259594ad9..61e3eb78c7cb 100644
--- a/sys-apps/pkgcore/ChangeLog
+++ b/sys-apps/pkgcore/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-apps/pkgcore
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/pkgcore/ChangeLog,v 1.151 2012/03/29 06:53:13 ferringb Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pkgcore/ChangeLog,v 1.152 2012/04/11 19:44:50 ferringb Exp $
+
+*pkgcore-0.7.7.8-r1 (11 Apr 2012)
+
+ 11 Apr 2012; Brian Harring <ferringb@gentoo.org> +pkgcore-0.7.7.8-r1.ebuild,
+ +files/pkgcore-0.7.7.8-fix-resolver-assert.patch:
+ Fix a resolver bug/assertion triggered by hwids/usbutils changes.
29 Mar 2012; Brian Harring <ferringb@gentoo.org> pkgcore-9999.ebuild:
Update to match vcs head allowing man pages and html to be optional in
diff --git a/sys-apps/pkgcore/files/pkgcore-0.7.7.8-fix-resolver-assert.patch b/sys-apps/pkgcore/files/pkgcore-0.7.7.8-fix-resolver-assert.patch
new file mode 100644
index 000000000000..fa165a8b1137
--- /dev/null
+++ b/sys-apps/pkgcore/files/pkgcore-0.7.7.8-fix-resolver-assert.patch
@@ -0,0 +1,113 @@
+From ac3e8f392ad61d8a3d455776a3df05e08e8d993c Mon Sep 17 00:00:00 2001
+From: Brian Harring <ferringb@gmail.com>
+Date: Wed, 11 Apr 2012 12:17:55 -0700
+Subject: [PATCH] Fix rollback support when reverting a replace affected by a
+ blocker.
+
+Specifically, if the state is blocker !a:1 w/ a replace operation of
+a-1:1 -> a-2:2, that replace is fine. Reverting the replace however
+would fail w/ an assertion error due to !a:1 catching a-1:1 during
+revert.
+
+Thus track the state, and only through the error if the blocker state
+for that package has somehow changed since we last looked (unlikely).
+---
+ pkgcore/resolver/pigeonholes.py | 11 ++++++++---
+ pkgcore/resolver/state.py | 14 ++++++++++----
+ 2 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/pkgcore/resolver/pigeonholes.py b/pkgcore/resolver/pigeonholes.py
+index 112d53b..fc010e9 100644
+--- a/pkgcore/resolver/pigeonholes.py
++++ b/pkgcore/resolver/pigeonholes.py
+@@ -22,9 +22,10 @@ class PigeonHoledSlots(object):
+
+ :return: any conflicting objs (empty list if inserted successfully).
+ """
+- key = obj.key
+- l = [x for x in self.limiters.get(key, ()) if x.match(obj)]
+
++ l = self.check_limiters(obj)
++
++ key = obj.key
+ dslot = obj.slot
+ l.extend(x for x in self.slot_dict.get(key, ()) if x.slot == dslot)
+
+@@ -32,7 +33,6 @@ class PigeonHoledSlots(object):
+ self.slot_dict.setdefault(key, []).append(obj)
+ return l
+
+-
+ def get_conflicting_slot(self, pkg):
+ for x in self.slot_dict.get(pkg.key, ()):
+ if pkg.slot == x.slot:
+@@ -56,6 +56,11 @@ class PigeonHoledSlots(object):
+ self.limiters.setdefault(key, []).append(atom)
+ return self.find_atom_matches(atom, key=key)
+
++ def check_limiters(self, obj):
++ """return any limiters conflicting w/ the psased in obj"""
++ key = obj.key
++ return [x for x in self.limiters.get(key, ()) if x.match(obj)]
++
+ def remove_slotting(self, obj):
+ key = obj.key
+ # let the key error be thrown if they screwed up.
+diff --git a/pkgcore/resolver/state.py b/pkgcore/resolver/state.py
+index f4ad3c4..c14d9f9 100644
+--- a/pkgcore/resolver/state.py
++++ b/pkgcore/resolver/state.py
+@@ -198,24 +198,26 @@ class remove_op(base_op_state):
+ plan.vdb_filter.add(self.pkg)
+
+ def revert(self, plan):
+- plan.state.fill_slotting(self.pkg, force=self.force)
++ plan.state.fill_slotting(self.pkg, force=True)
+ plan.pkg_choices[self.pkg] = self.choices
+ plan.vdb_filter.remove(self.pkg)
+
+
+ class replace_op(base_op_state):
+
+- __slots__ = ("old_pkg", "old_choices")
++ __slots__ = ("old_pkg", "old_choices", "force_old")
+ desc = "replace"
+
+ def __init__(self, *args, **kwds):
+ base_op_state.__init__(self, *args, **kwds)
+ self.old_pkg, self.old_choices = None, None
++ self.force_old = False
+
+ def apply(self, plan):
+ revert_point = plan.current_state
+ old = plan.state.get_conflicting_slot(self.pkg)
+ # probably should just convert to an add...
++ force_old = bool(plan.state.check_limiters(old))
+ assert old is not None
+ plan.state.remove_slotting(old)
+ old_choices = plan.pkg_choices[old]
+@@ -233,6 +235,7 @@ class replace_op(base_op_state):
+ # wipe olds blockers.
+
+ self.old_pkg = old
++ self.force_old = force_old
+ self.old_choices = old_choices
+ del plan.pkg_choices[old]
+ plan.pkg_choices[self.pkg] = self.choices
+@@ -243,8 +246,11 @@ class replace_op(base_op_state):
+ # far simpler, since the apply op generates multiple ops on it's own.
+ # all we have to care about is swap.
+ plan.state.remove_slotting(self.pkg)
+- l = plan.state.fill_slotting(self.old_pkg, force=self.force)
+- assert not l, "reverting a replace op %r, got %r from slotting" % (self, l)
++ l = plan.state.fill_slotting(self.old_pkg, force=self.force_old)
++ if bool(l) != self.force_old:
++ raise AssertionError(
++ "Internal error detected, unable to revert %s; got %s, "
++ "force_old=%s " % (self, l, self.force_old))
+ del plan.pkg_choices[self.pkg]
+ plan.pkg_choices[self.old_pkg] = self.old_choices
+ plan.vdb_filter.remove(self.old_pkg)
+--
+1.7.8.5
+
diff --git a/sys-apps/pkgcore/pkgcore-0.7.7.8-r1.ebuild b/sys-apps/pkgcore/pkgcore-0.7.7.8-r1.ebuild
new file mode 100644
index 000000000000..b8e7c15939b9
--- /dev/null
+++ b/sys-apps/pkgcore/pkgcore-0.7.7.8-r1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pkgcore/pkgcore-0.7.7.8-r1.ebuild,v 1.1 2012/04/11 19:44:50 ferringb Exp $
+
+EAPI="3"
+DISTUTILS_SRC_TEST="setup.py"
+
+inherit distutils eutils
+
+DESCRIPTION="pkgcore package manager"
+HOMEPAGE="http://pkgcore.googlecode.com/"
+SRC_URI="http://pkgcore.googlecode.com/files/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="-doc build"
+
+RDEPEND=">=dev-lang/python-2.4
+ >=dev-python/snakeoil-0.4.5
+ || ( >=dev-lang/python-2.5 dev-python/pycrypto )"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx dev-python/pyparsing )"
+
+DOCS="AUTHORS NEWS"
+
+pkg_setup() {
+ # disable snakeoil 2to3 caching...
+ unset PY2TO3_CACHEDIR
+ python_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-${PV}"-fix-resolver-assert.patch
+}
+
+src_compile() {
+ distutils_src_compile
+
+ if use doc; then
+ python setup.py build_docs || die "doc building failed"
+ fi
+}
+
+src_install() {
+ distutils_src_install
+
+ if use doc; then
+ dohtml -r build/sphinx/html/*
+ fi
+}
+
+pkg_postinst() {
+ distutils_pkg_postinst
+ pplugincache
+}