summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2005-12-26 06:29:50 +0000
committerBrian Harring <ferringb@gentoo.org>2005-12-26 06:29:50 +0000
commit85e3299b684ca9e25c7e0e7c25981a7e255c42f0 (patch)
treef043fabd7b0b87465e29ea86ac6b05c6013f6915
parent82725294809a7100f87dad05f623b4ea00cfd44b (diff)
downloadportage-85e3299b684ca9e25c7e0e7c25981a7e255c42f0.tar.gz
portage-85e3299b684ca9e25c7e0e7c25981a7e255c42f0.tar.bz2
portage-85e3299b684ca9e25c7e0e7c25981a7e255c42f0.zip
'DISTFILES indirection; access $BUILDDIR/distdir instead of $DISTFILES , thus blocking unstated access.
svn path=/main/trunk/; revision=2474
-rw-r--r--NEWS3
-rwxr-xr-xbin/ebuild.sh3
-rw-r--r--pym/portage.py26
3 files changed, 31 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index fe6a4073f..ef6ad80da 100644
--- a/NEWS
+++ b/NEWS
@@ -24,4 +24,5 @@ portage-2.1 (ongoing via pre releases)
* Allow packages to be upgraded that are only depended on via a
"|| ( =cat/pkg-1* =cat/pkg-2* )" construct.
* Ebuild output is no longer cut off early when using PORT_LOGDIR.
-
+* Distfiles indirection- $DISTFILES access goes through a tmp dir to fail
+ access to files not listed in SRC_URI.
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index bf785ae7a..5ea8f92a6 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -702,6 +702,9 @@ dyn_clean() {
if [ -z "$(find "${BUILDDIR}" -mindepth 1 -maxdepth 1)" ]; then
rmdir "${BUILDDIR}"
fi
+ # do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll
+ # result in it wiping the users distfiles directory (bad).
+ rm -rf "${BUILDDIR}/distdir"
true
}
diff --git a/pym/portage.py b/pym/portage.py
index 9129aa494..0711a9472 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2570,6 +2570,7 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
os.chmod(mysettings["BUILD_PREFIX"],00775)
# Should be ok again to set $T, as sandbox does not depend on it
+ # XXX Bug. no way in hell this is valid for clean handling.
mysettings["T"]=mysettings["BUILDDIR"]+"/temp"
if cleanup or mydo=="clean":
if os.path.exists(mysettings["T"]):
@@ -2791,6 +2792,31 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea
not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
return 1
+ # inefficient. improve this logic via making actionmap easily searchable to see if we're in the chain of what
+ # will be executed, either that or forced N doebuild calls instead of a single set of phase calls.
+ if (mydo not in ("setup", "clean", "postinst", "preinst", "prerm") and "noauto" not in features) or \
+ mydo == "unpack":
+ orig_distdir = mysettings["DISTDIR"]
+ edpath = mysettings["DISTDIR"] = os.path.join(mysettings["BUILDDIR"], "distdir")
+ if os.path.exists(edpath):
+ try:
+ if os.path.isdir(edpath) and not os.path.islink(edpath):
+ shutil.rmtree(edpath)
+ else:
+ os.unlink(edpath)
+ except OSError:
+ print "!!! Failed reseting ebuild distdir path, " + edpath
+ raise
+ os.mkdir(edpath)
+ os.chown(edpath, -1, portage_gid)
+ os.chmod(edpath, 0775)
+ try:
+ for file in aalist:
+ os.symlink(os.path.join(orig_distdir, file), os.path.join(edpath, file))
+ except OSError:
+ print "!!! Failed symlinking in '%s' to ebuild distdir" % file
+ raise
+
if mydo=="fetch" and listonly:
return 0