Hola.

Continuing the tradition of being a lazy bugger and raiding from my 
previous work instead of doing something new, attached is a patch that 
forces unpack to go through a level of indirection.

Essentially... rather then direct access to $DISTDIR, we create a 
tmpdir, symlink in the _known_ files that portage believes that ebuild 
uses, and the unpack function looks in that directory.

Can be defeated by a unpack ${DISTDIR}/file call, but that's invalid 
anyways.

Why do this?  Well, mainly it's a catch for ebuilds that aren't 
listing files in their src_uri when fetch restricted.  No file in uri, 
no file in accessed distdir essentially.

It also has the nice side affect that if we have ever screw up src_uri 
parsing, the ebuild will puke rather then the internal portage error 
sliding by- that's not really the intention of the patch however, just 
a nice assert of sorts.

Either way, it's attached.  Comments?
~harring
Index: pym/portage.py
===================================================================
--- pym/portage.py      (revision 2472)
+++ pym/portage.py      (working copy)
@@ -2791,6 +2791,29 @@
           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") or 
"noauto" in features:
+               edpath = mysettings["EBUILD_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(mysettings["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
 
Index: bin/ebuild.sh
===================================================================
--- bin/ebuild.sh       (revision 2472)
+++ bin/ebuild.sh       (working copy)
@@ -348,7 +348,7 @@
                if [ "${x:0:2}" = "./" ] ; then
                        srcdir=""
                else
-                       srcdir="${DISTDIR}/"
+                       srcdir="${EBUILD_DISTDIR}/"
                fi
                [ ! -s "${srcdir}${x}" ] && die "$myfail"
 

Attachment: pgp83PrZpKrg1.pgp
Description: PGP signature

Reply via email to