summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarien Zwart <marienz@gentoo.org>2006-10-01 00:42:59 +0000
committerMarien Zwart <marienz@gentoo.org>2006-10-01 00:42:59 +0000
commit1316b69a0cac4247ff667365632e2f42afbcfb19 (patch)
treec357cc0e334072ab0aaca5be50db54a007277512 /sys-apps/pkgcore
parentNeeds autoconf 2.60. Bug #148684 (diff)
downloadgentoo-2-1316b69a0cac4247ff667365632e2f42afbcfb19.tar.gz
gentoo-2-1316b69a0cac4247ff667365632e2f42afbcfb19.tar.bz2
gentoo-2-1316b69a0cac4247ff667365632e2f42afbcfb19.zip
Deal with running ebd from a deleted directory.
(Portage version: 2.1.2_pre1-r4)
Diffstat (limited to 'sys-apps/pkgcore')
-rw-r--r--sys-apps/pkgcore/ChangeLog8
-rw-r--r--sys-apps/pkgcore/files/digest-pkgcore-0.1-r13
-rw-r--r--sys-apps/pkgcore/files/pkgcore-0.1-sandbox-in-deleted-dir.patch163
-rw-r--r--sys-apps/pkgcore/pkgcore-0.1-r1.ebuild75
4 files changed, 248 insertions, 1 deletions
diff --git a/sys-apps/pkgcore/ChangeLog b/sys-apps/pkgcore/ChangeLog
index b25ec7af37c9..cda3c0169706 100644
--- a/sys-apps/pkgcore/ChangeLog
+++ b/sys-apps/pkgcore/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-apps/pkgcore
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/pkgcore/ChangeLog,v 1.1 2006/09/30 22:12:52 marienz Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pkgcore/ChangeLog,v 1.2 2006/10/01 00:42:59 marienz Exp $
+
+*pkgcore-0.1-r1 (01 Oct 2006)
+
+ 01 Oct 2006; Marien Zwart <marienz@gentoo.org>
+ +files/pkgcore-0.1-sandbox-in-deleted-dir.patch, +pkgcore-0.1-r1.ebuild:
+ Deal with running ebd from a deleted directory.
*pkgcore-0.1 (30 Sep 2006)
diff --git a/sys-apps/pkgcore/files/digest-pkgcore-0.1-r1 b/sys-apps/pkgcore/files/digest-pkgcore-0.1-r1
new file mode 100644
index 000000000000..9740cb113e3e
--- /dev/null
+++ b/sys-apps/pkgcore/files/digest-pkgcore-0.1-r1
@@ -0,0 +1,3 @@
+MD5 c0b918f3ce670aa4ec28d29c339146a1 pkgcore-0.1.tar.bz2 386019
+RMD160 49907cac4b83a0d00afaf41773e457886c1e054f pkgcore-0.1.tar.bz2 386019
+SHA256 66f88ae7d181d182a02f1a99db222bd82d583c2de06a9ad6d5e6bc4701a3ec30 pkgcore-0.1.tar.bz2 386019
diff --git a/sys-apps/pkgcore/files/pkgcore-0.1-sandbox-in-deleted-dir.patch b/sys-apps/pkgcore/files/pkgcore-0.1-sandbox-in-deleted-dir.patch
new file mode 100644
index 000000000000..e9a3600ec6f6
--- /dev/null
+++ b/sys-apps/pkgcore/files/pkgcore-0.1-sandbox-in-deleted-dir.patch
@@ -0,0 +1,163 @@
+# Bazaar revision bundle v0.8
+#
+# message:
+# test for sandbox + nonexistant cwd.
+#
+# committer: Brian Harring <ferringb@gentoo.org>
+# date: Sat 2006-09-30 17:38:28.315999985 -0700
+
+=== modified file pkgcore/ebuild/processor.py // last-changed:ferringb@gentoo.o
+... rg-20061001002928-e3ad5eb445bb7f3a
+--- pkgcore/ebuild/processor.py
++++ pkgcore/ebuild/processor.py
+@@ -206,6 +206,9 @@
+ else:
+ spawn_func = pkgcore.spawn.spawn
+
++ # force to a neutral dir so that sandbox/fakeroot won't explode if
++ # ran from a nonexistant dir
++ spawn_opts["chdir"] = "/tmp"
+ # little trick. we force the pipes to be high up fd wise so
+ # nobody stupidly hits 'em.
+ max_fd = min(pkgcore.spawn.max_fd_limit, 1024)
+
+=== modified file pkgcore/spawn.py // last-changed:ferringb@gentoo.org-20061001
+... 002928-e3ad5eb445bb7f3a
+--- pkgcore/spawn.py
++++ pkgcore/spawn.py
+@@ -130,7 +130,7 @@
+
+ def spawn(mycommand, env=None, opt_name=None, fd_pipes=None, returnpid=False,
+ uid=None, gid=None, groups=None, umask=None, logfile=None,
+- path_lookup=True):
++ chdir=None, path_lookup=True):
+
+ """wrapper around execve
+
+@@ -195,7 +195,7 @@
+ # pylint: disable-msg=W0703
+ try:
+ _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups,
+- uid, umask)
++ uid, umask, chdir)
+ except Exception, e:
+ # We need to catch _any_ exception so that it doesn't
+ # propogate out of this function and cause exiting
+@@ -249,7 +249,8 @@
+ # Everything succeeded
+ return 0
+
+-def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask):
++def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
++ chdir):
+ """internal function to handle exec'ing the child process.
+
+ If it succeeds this function does not return. It might raise an
+@@ -286,6 +287,9 @@
+ except OSError:
+ pass
+
++ if chdir is not None:
++ os.chdir(chdir)
++
+ # Set requested process permissions.
+ if gid:
+ os.setgid(gid)
+
+=== modified file pkgcore/test/test_spawn.py
+--- pkgcore/test/test_spawn.py
++++ pkgcore/test/test_spawn.py
+@@ -76,6 +76,33 @@
+ fp, spawn_type=spawn.spawn_sandbox)[1][0].split(":")])
+ os.unlink(fp)
+
++
++ @capability_based(spawn.sandbox_capable, "sandbox binary wasn't found")
++ def test_sandbox_empty_dir(self):
++ """
++ sandbox gets pissy if it's ran from a nonexistant dir
++
++ this verifies our fix works.
++ """
++ fp = self.generate_script(
++ "pkgcore-spawn-sandbox.sh", "echo $LD_PRELOAD")
++ dpath = os.path.join(self.dir, "dar")
++ os.mkdir(dpath)
++ try:
++ cwd = os.getcwd()
++ except OSError:
++ cwd = None
++ try:
++ os.chdir(dpath)
++ os.rmdir(dpath)
++ self.assertIn("libsandbox.so", [os.path.basename(x.strip()) for x in
++ spawn.spawn_get_output(
++ fp, spawn_type=spawn.spawn_sandbox, chdir='/')[1][0].split(":")])
++ os.unlink(fp)
++ finally:
++ if cwd is not None:
++ os.chdir(cwd)
++
+ @capability_based(spawn.fakeroot_capable, "fakeroot binary wasn't found")
+ def test_fakeroot(self):
+ try:
+
+# revision id: ferringb@gentoo.org-20061001003828-74aa66b080d128bf
+# sha1: 79dcf8b726e7596560bb1f1d1dd5b5489baacb65
+# inventory sha1: 2035b787956ee5082dd5ed878ec7db4f490b7278
+# parent ids:
+# ferringb@gentoo.org-20061001002928-e3ad5eb445bb7f3a
+# base id: ferringb@gentoo.org-20060930215710-1f00848a64fa7930
+# properties:
+# branch-nick: integration
+
+# message:
+# add chdir resetting option for spawn, use it for sandbox (sandbox sucks) when ran from a non existant dir
+#
+# committer: Brian Harring <ferringb@gentoo.org>
+# date: Sat 2006-09-30 17:29:28.269999981 -0700
+
+=== modified file pkgcore/ebuild/processor.py // encoding:base64
+LS0tIHBrZ2NvcmUvZWJ1aWxkL3Byb2Nlc3Nvci5weQorKysgcGtnY29yZS9lYnVpbGQvcHJvY2Vz
+c29yLnB5CkBAIC0yMDYsNiArMjA2LDkgQEAKICAgICAgICAgZWxzZToKICAgICAgICAgICAgIHNw
+YXduX2Z1bmMgPSBwa2djb3JlLnNwYXduLnNwYXduCiAKKyAgICAgICAgIyBmb3JjZSB0byBhIG5l
+dXRyYWwgZGlyIHNvIHRoYXQgc2FuZGJveC9mYWtlcm9vdCB3b24ndCBleHBsb2RlIGlmCisgICAg
+ICAgICMgcmFuIGZyb20gYSBub25leGlzdGFudCBkaXIKKyAgICAgICAgc3Bhd25fb3B0c1siY2hk
+aXIiXSA9ICIvdG1wIgogICAgICAgICAjIGxpdHRsZSB0cmljay4gd2UgZm9yY2UgdGhlIHBpcGVz
+IHRvIGJlIGhpZ2ggdXAgZmQgd2lzZSBzbwogICAgICAgICAjIG5vYm9keSBzdHVwaWRseSBoaXRz
+ICdlbS4KICAgICAgICAgbWF4X2ZkID0gbWluKHBrZ2NvcmUuc3Bhd24ubWF4X2ZkX2xpbWl0LCAx
+MDI0KQoK
+
+=== modified file pkgcore/spawn.py // encoding:base64
+LS0tIHB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1l
+LCBmZF9waXBlcywgZW52LCBnaWQsIGdyb3VwcywgdWlkLCB1bWFzayk6CitkZWYgX2V4ZWMoYmlu
+YXJ5LCBteWNvbW1hbmQsIG9wdF9uYW1lLCBmZF9waXBlcywgZW52LCBnaWQsIGdyb3VwcywgdWlk
+LCB1bWFzaywKKyAgICBjaGRpcik6CiAgICAgIiIiaW50ZXJuYWwgZnVuY3Rpb24gdG8gaGFuZGxl
+IGV4ZWMnaW5nIHRoZSBjaGlsZCBwcm9jZXNzLgogCiAgICAgSWYgaXQgc3VjY2VlZHMgdGhpcyBm
+dW5jdGlvbiBkb2VzIG5vdCByZXR1cm4uIEl0IG1pZ2h0IHJhaXNlIGFuCkBAIC0yODYsNiArMjg3
+LDkgQEAKICAgICAgICAgICAgIGV4Y2VwdCBPU0Vycm9yOgogICAgICAgICAgICAgICAgIHBhc3MK
+IAorICAgIGlmIGNoZGlyIGlzIG5vdCBOb25lOgorICAgICAgICBvcy5jaGRpcihjaGRpcikKKwog
+ICAgICMgU2V0IHJlcXVlc3RlZCBwcm9jZXNzIHBlcm1pc3Npb25zLgogICAgIGlmIGdpZDoKICAg
+ICAgICAgb3Muc2V0Z2lkKGdpZCkKCg==
+
+# revision id: ferringb@gentoo.org-20061001002928-e3ad5eb445bb7f3a
+# sha1: b4ccfdb63ee142de540dd13229b45f005e66fe1a
+# inventory sha1: 75babaf4b20292a23aed08646032d6d20e8d5e8b
+# parent ids:
+# ferringb@gentoo.org-20060930215710-1f00848a64fa7930
+# properties:
+# branch-nick: integration
+
diff --git a/sys-apps/pkgcore/pkgcore-0.1-r1.ebuild b/sys-apps/pkgcore/pkgcore-0.1-r1.ebuild
new file mode 100644
index 000000000000..149d2bbb088b
--- /dev/null
+++ b/sys-apps/pkgcore/pkgcore-0.1-r1.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/pkgcore/pkgcore-0.1-r1.ebuild,v 1.1 2006/10/01 00:42:59 marienz Exp $
+
+inherit distutils eutils
+
+DESCRIPTION="pkgcore package manager"
+HOMEPAGE="http://dev.gentooexperimental.org/pkgcore-trac/"
+SRC_URI="http://dev.gentooexperimental.org/~${PN}/releases/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="doc"
+
+DEPEND=">=dev-lang/python-2.4"
+RDEPEND=">=dev-lang/python-2.4
+ || ( >=dev-lang/python-2.5 dev-python/pycrypto )
+ >=app-shells/bash-3.0
+ doc? ( >=dev-python/docutils-0.4 )"
+
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}/${P}-sandbox-in-deleted-dir.patch"
+}
+
+
+src_compile() {
+ distutils_src_compile
+
+ if use doc; then
+ ./build_docs.py || die "doc building failed"
+ fi
+}
+
+src_install() {
+ distutils_src_install
+
+ # This wrapper is not useful when called directly.
+ rm "${D}/usr/bin/pwrapper"
+
+ if use doc; then
+ dohtml -r doc dev-notes
+ fi
+
+ dodoc doc/*.rst
+ docinto dev-notes
+ dodoc dev-notes/*.rst
+
+}
+
+pkg_postinst() {
+ einfo "Registering plugins..."
+ register_plugin.py -s fs_ops copyfile 1 pkgcore.fs.ops.default_copyfile
+ register_plugin.py -s fs_ops ensure_perms 1 \
+ pkgcore.fs.ops.default_ensure_perms
+ register_plugin.py -s fs_ops mkdir 1 pkgcore.fs.ops.default_mkdir
+ register_plugin.py -s fs_ops merge_contents 1 \
+ pkgcore.fs.ops.merge_contents
+ register_plugin.py -s fs_ops unmerge_contents 1 \
+ pkgcore.fs.ops.unmerge_contents
+ register_plugin.py -s format ebuild_built 0.0 \
+ pkgcore.ebuild.ebuild_built.generate_new_factory
+ register_plugin.py -s format ebuild_src 0.0 \
+ pkgcore.ebuild.ebuild_src.generate_new_factory
+}
+
+src_test() {
+ "${python}" setup.py build_ext --force --inplace || \
+ die "failed building extensions in src dir for testing"
+ "${python}" ./sandbox/test.py || die "tested returned non zero"
+}