'DISTFILES indirection; access $BUILDDIR/distdir instead of $DISTFILES , thus blockin...
authorBrian Harring <ferringb@gentoo.org>
Mon, 26 Dec 2005 06:29:50 +0000 (06:29 -0000)
committerBrian Harring <ferringb@gentoo.org>
Mon, 26 Dec 2005 06:29:50 +0000 (06:29 -0000)
svn path=/main/trunk/; revision=2474

NEWS
bin/ebuild.sh
pym/portage.py

diff --git a/NEWS b/NEWS
index fe6a4073f059a1b706f189dda29f849cdf217977..ef6ad80da71c24519701b8c051eff4227e46e8ab 100644 (file)
--- 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.
index bf785ae7ae266eb3f8bd29ca4ee2c814894332e1..5ea8f92a68b2e6b592039fd103376e62ce85a50a 100755 (executable)
@@ -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
 }
 
index 9129aa494f7443fc83bc61b495a1f558c58483ff..0711a947220864d8c72d61b1255709c00c0ad339 100644 (file)
@@ -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