Merged from trunk 9274:9279
authorFabian Groffen <grobian@gentoo.org>
Wed, 6 Feb 2008 22:26:20 +0000 (22:26 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 6 Feb 2008 22:26:20 +0000 (22:26 -0000)
   | 9275    | don't record internal providers in NEEDED records as they    |
   | genone  | are pointless for all useful applications in portage and     |
   |         | complicate them instead (e.g. bug #205531)                   |

   | 9276    | display errors that occured during package set initalization |
   | genone  |                                                              |

   | 9277    | don't try to copy manually removed libraries (bug #208946)   |
   | genone  |                                                              |

   | 9278    | Make qa_source and qa_call save the return value and return  |
   | zmedico | it. Thanks to igli for suggesting.                           |

   | 9279    | For the useq() IUSE qa check, use [[ $u =~ $PORTAGE_IUSE ]]  |
   | zmedico | instead of egrep since apparently it's compatible in this    |
   |         | case. Thanks to igli for this.                               |

svn path=/main/branches/prefix/; revision=9280

bin/ebuild.sh
bin/misc-functions.sh
pym/_emerge/__init__.py
pym/portage/dbapi/vartree.py
pym/portage/util.py

index d90b6f4076cc0cad48705e626e574baac9ac3a84..1e17a602c60ed61f1ed0db9af0ea4be21590a523 100755 (executable)
@@ -33,22 +33,26 @@ fi
 
 qa_source() {
        local shopts=$(shopt) OLDIFS="$IFS"
-       source "$@" || return 1
+       local retval
+       source "$@"
+       retval=$?
        [[ $shopts != $(shopt) ]] &&
                eqawarn "QA Notice: Global shell options changed and were not restored while sourcing '$*'"
        [[ "$IFS" != "$OLDIFS" ]] &&
                eqawarn "QA Notice: Global IFS changed and was not restored while sourcing '$*'"
-       return 0
+       return $retval
 }
 
 qa_call() {
        local shopts=$(shopt) OLDIFS="$IFS"
-       "$@" || return 1
+       local retval
+       "$@"
+       retval=$?
        [[ $shopts != $(shopt) ]] &&
                eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
        [[ "$IFS" != "$OLDIFS" ]] &&
                eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'"
-       return 0
+       return $retval
 }
 
 # subshell die support
@@ -144,7 +148,7 @@ useq() {
                [[ ${EMERGE_FROM} != binary ]] ; then
                # TODO: Implement PORTAGE_IUSE for binary packages. Currently,
                # it is only valid for build time phases.
-               echo "${u}" | egrep -q "${PORTAGE_IUSE}" || \
+               [[ $u =~ $PORTAGE_IUSE ]] || \
                        eqawarn "QA Notice: USE Flag '${u}' not" \
                                "in IUSE for ${CATEGORY}/${PF}"
        fi
index 2eec3579a069eb2c8fd1444dbcc97b5ccaf6ec81..197f79be3859bdfc87151bafae5482d9b9a789c0 100644 (file)
@@ -159,8 +159,27 @@ install_qa_check() {
                        sleep 1
                fi
 
-               # Save NEEDED information
-               scanelf -qyRF '%p %n' "${D}" | sed -e 's:^:/:' > "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+               # Save NEEDED information after removing self-contained providers
+               scanelf -qyRF '%p:%r %n' "${D}" | sed -e 's:^:/:' | { while read l; do
+                       obj=${l%%:*}
+                       rpath=${l##*:}; rpath=${rpath%% *}
+                       needed=${l##* }
+                       if [ -z "${rpath}" -o -n "${rpath//*ORIGIN*}" ]; then
+                               # object doesn't contain $ORIGIN in its runpath attribute
+                               echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+                       else
+                               dir=$(dirname ${obj})
+                               # replace $ORIGIN with the dirname of the current object for the lookup
+                               opath=$(echo :${rpath}: | sed -e "s#.*:\(.*\)\$ORIGIN\(.*\):.*#\1${dir}\2#")
+                               sneeded=$(echo ${needed} | tr , ' ')
+                               rneeded=""
+                               for lib in ${sneeded}; do
+                                       [ -e "${D}/${dir}/${lib}" ] || rneeded="${rneeded},${lib}"
+                               done
+                               rneeded=${rneeded:1}
+                               [ -n "${rneeded}" ] && echo "${obj} ${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+                       fi
+               done }
 
                if [[ ${insecure_rpath} -eq 1 ]] ; then
                        die "Aborting due to serious QA concerns with RUNPATH/RPATH"
index 00ab1cd22802cb899928f7aeea6c5dfdace75765..e26629215214eebdf28803dfdcdd31199dd147eb 100644 (file)
@@ -7144,6 +7144,10 @@ def emerge_main():
        if myaction in ("clean", "config", "depclean", "info", "prune", "unmerge", None):
                root_config = trees[settings["ROOT"]]["root_config"]
                setconfig = root_config.setconfig
+               # display errors that occured while loading the SetConfig instance
+               for e in setconfig.errors:
+                       print colorize("BAD", "Error during set creation: %s" % e)
+               
                sets = setconfig.getSets()
                # emerge relies on the existance of sets with names "world" and "system"
                required_sets = ("world", "system")
index 750193d2d6137980331885549af61f7a1401d06b..af726b54e891c40ea84e32df5274b0cc1f16d90d 100644 (file)
@@ -1594,11 +1594,16 @@ class dblink(object):
                # get the real paths for the libs
                preserve_paths = [x for x in old_contents if os.path.basename(x) in preserve_libs]
                del old_contents, old_libs, mylibs, preserve_libs
-                       
+
                # inject files that should be preserved into our image dir
                import shutil
+               missing_paths = []
                for x in preserve_paths:
                        print "injecting %s into %s" % (x, srcroot)
+                       if not os.path.exists(os.path.join(destroot, x.lstrip(os.sep))):
+                               print "%s does not exist so can't be preserved"
+                               missing_paths.append(x)
+                               continue
                        mydir = os.path.join(srcroot, os.path.dirname(x).lstrip(os.sep))
                        if not os.path.exists(mydir):
                                os.makedirs(mydir)
@@ -1616,6 +1621,10 @@ class dblink(object):
                                shutil.copy2(os.path.join(destroot, x.lstrip(os.sep)),
                                        os.path.join(srcroot, x.lstrip(os.sep)))
 
+               preserve_paths = [x for x in preserve_paths if x not in missing_paths]
+
+               del missing_paths
+
                # keep track of the libs we preserved
                self.vartree.dbapi.plib_registry.register(self.mycpv, self.settings["SLOT"], counter, preserve_paths)
 
index 79f3c2f5d3a39761dc42a659065c84de949910b3..ea16c5cffc92b9dcd7c9873be4163d563dd85a3f 100644 (file)
@@ -1059,3 +1059,21 @@ def new_protect_filename(mydest, newmd5=None):
                        os.path.join(real_dirname, last_pfile)) == newmd5:
                        return old_pfile
        return new_pfile
+
+def getlibpaths():
+       """ Return a list of paths that are used for library lookups """
+
+       # PREFIX HIJACK: if this function is used (it seems to be just added
+       # nothing more, then let us know, because then we need to fix this...
+       raise "This is not prefix-proof, and certainly not x-platform proof!"
+
+       # the following is based on the information from ld.so(8)
+       rval = os.environ.get("LD_LIBRARY_PATH", "").split(":")
+       rval.extend(grabfile("/etc/ld.so.conf"))
+       rval.append("/usr/lib")
+       rval.append("/lib")
+
+       rval = [normalize_path(x) for x in rval if x != ""]
+       
+       return rval
+