merge with trunk rev 2936:2947
authorKito <kito@gentoo.org>
Sun, 19 Mar 2006 01:27:57 +0000 (01:27 -0000)
committerKito <kito@gentoo.org>
Sun, 19 Mar 2006 01:27:57 +0000 (01:27 -0000)
svn path=/main/branches/prefix/; revision=2948

bin/dobin
bin/dosbin
bin/ebuild.sh
bin/emerge-webrsync
bin/misc-functions.sh
pym/cache/flat_hash.py
pym/cache/flat_list.py
pym/emergehelp.py
pym/portage.py

index 65ca298afdc9fcde82d4e1b445d2f5839273a8de..331cec7fe3546bc6024ec0b5299cfc388811b2a4 100755 (executable)
--- a/bin/dobin
+++ b/bin/dobin
@@ -16,7 +16,7 @@ ret=0
 
 for x in "$@" ; do
        if [[ -e ${x} ]] ; then
-               install -m 0755 -o ${PORTAGE_INST_UID} -g ${PORTAGE_INST_GID} "${x}" "${D}${DESTTREE}/bin"
+               install -m 0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin"
        else
                echo "!!! ${0##*/}: ${x} does not exist" 1>&2
                false
index 0c3d52639055484529b4c141a59a1f0e5cae2cf8..46c1ce2f47f39e0ece66d1cf4610cd4e976db3f5 100755 (executable)
@@ -16,7 +16,7 @@ ret=0
 
 for x in "$@" ; do
        if [[ -e ${x} ]] ; then
-               install -m 0755 -o ${PORTAGE_INST_UID} -g ${PORTAGE_INST_GID} "${x}" "${D}${DESTTREE}/sbin"
+               install -m 0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin"
        else
                echo "!!! ${0##*/}: ${x} does not exist" 1>&2
                false
index 10479ded8565770fef915226d04a6a2588b1f888..5b597671244d9b57467bf25f278f1a1cf0b00d1a 100755 (executable)
@@ -1351,7 +1351,8 @@ inherit() {
 
                shift
        done
-       ((--ECLASS_DEPTH))
+       ((--ECLASS_DEPTH)) # Returns 1 when ECLASS_DEPTH reaches 0.
+       return 0
 }
 
 # Exports stub functions that call the eclass's functions, thereby making them default.
index 3c1f1d50bc75c6aa50bc326a113ab4bd46c0aa39..882f66061bb3607d2d268185898428ac4ecc59c5 100755 (executable)
@@ -52,7 +52,7 @@ fi
 sync_local() {
        echo Syncing local tree...
        if type -p tarsync &> /dev/null; then
-               if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${PORTAGE_INST_UID} -g ${PORTAGE_INST_GID} -e /distfiles -e /packages -e /local; then
+               if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} -e /distfiles -e /packages -e /local; then
                        echo "tarsync failed; tarball is corrupt?"
                        exit 1;
                fi
@@ -65,7 +65,7 @@ sync_local() {
                fi
                rm -f $FILE
                # Make sure user and group file ownership is ${PORTAGE_INST_UID}:${PORTAGE_INST_GID}
-               chown -R ${PORTAGE_INST_UID}:${PORTAGE_INST_GID} portage
+               chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} portage
                cd portage
                rsync -av --progress --stats --delete --delete-after \
                --exclude='/distfiles' --exclude='/packages' \
@@ -124,7 +124,7 @@ while (( $attempts <  40 )) ; do
                        echo " === snapshot $FILE is correct, using it"
                        sync_local
                        echo
-                       echo " === Snapshot has beed sync'd"
+                       echo " === Snapshot has been sync'd"
                        echo
                        exit 0
                else
index 88d81dbc5599650873f30ee4a0eb5b5d8b7eaa45..21983f4ae69260bd3409fdf15d9a5a5c65612f63 100644 (file)
@@ -220,14 +220,14 @@ install_qa_check() {
        find "${D}/" -user  @portageuser@ | while read file; do
                count=$(( $count + 1 ))
                if [ -L "${file}" ]; then
-                       lchown ${PORTAGE_INST_UID} "${file}"
+                       lchown ${PORTAGE_INST_UID:-0} "${file}"
                else
                        s=$(stat_perms "$file")
                        if [ -z "${s}" ]; then
                                ewarn "failed stat_perm'ing $file.  User intervention during install isn't wise..."
                                continue
                        fi
-                       chown ${PORTAGE_INST_UID} "$file"
+                       chown ${PORTAGE_INST_UID:-0} "$file"
                        chmod "$s" "$file"
                fi
        done
@@ -239,14 +239,14 @@ install_qa_check() {
        find "${D}/" -group @portagegroup@ | while read file; do
                count=$(( $count + 1 ))
                if [ -L "${file}" ]; then
-                       lchgrp ${PORTAGE_INST_GID} "${file}"
+                       lchgrp ${PORTAGE_INST_GID:-0} "${file}"
                else
                        s=$(stat_perms "$file")
                        if [ -z "${s}" ]; then
                                echo "failed stat_perm'ing '$file' . User intervention during install isn't wise..."
                                continue
                        fi
-                       chgrp ${PORTAGE_INST_GID} "$file"
+                       chgrp ${PORTAGE_INST_GID:-0} "$file"
                        chmod "$s" "$file"
                fi
        done
index 1bdc7cd5b439f9a788a772e277940f01535e6a13..8ebd70f7dc02fe2f201f9303670af945c7dc7ddc 100644 (file)
@@ -5,7 +5,7 @@
 
 import fs_template
 import cache_errors
-import os, stat
+import errno, os, stat
 from mappings import LazyLoad, ProtectedDict
 from template import reconstruct_eclasses
 # store the current key order *here*.
@@ -70,16 +70,16 @@ class database(fs_template.FsBased):
                s = cpv.rfind("/")
                fp = os.path.join(self.location,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
                try:    myf=open(fp, "w")
-               except IOError, ie:
-                       if ie.errno == 2:
+               except (IOError, OSError), e:
+                       if errno.ENOENT == e.errno:
                                try:
                                        self._ensure_dirs(cpv)
                                        myf=open(fp,"w")
                                except (OSError, IOError),e:
                                        raise cache_errors.CacheCorruption(cpv, e)
-               except OSError, e:
-                       raise cache_errors.CacheCorruption(cpv, e)
-               
+                       else:
+                               raise cache_errors.CacheCorruption(cpv, e)
+
                for k, v in values.items():
                        if k != "_mtime_" and (k == "_eclasses_" or k in self._known_keys):
                                myf.writelines("%s=%s\n" % (k, v))
@@ -101,7 +101,7 @@ class database(fs_template.FsBased):
                try:
                        os.remove(os.path.join(self.location,cpv))
                except OSError, e:
-                       if e.errno == 2:
+                       if errno.ENOENT == e.errno:
                                raise KeyError(cpv)
                        else:
                                raise cache_errors.CacheCorruption(cpv, e)
index 944f7406d84ffac7160c2d518a80b9a8318119a7..135b31e39947a07937154cfa23004c6aade54817 100644 (file)
@@ -1,6 +1,6 @@
 import fs_template
 import cache_errors
-import os, stat
+import errno, os, stat
 
 # store the current key order *here*.
 class database(fs_template.FsBased):
@@ -31,11 +31,7 @@ class database(fs_template.FsBased):
                        for k,v in zip(self.auxdbkey_order, myf):
                                d[k] = v.rstrip("\n")
                except (OSError, IOError),e:
-                       if isinstance(e,IOError) and e.errno == 2:
-#                              print "caught for %s" % cpv, e
-#                              l=os.listdir(os.path.dirname(os.path.join(self._base,cpv)))
-#                              l.sort()
-#                              print l
+                       if errno.ENOENT == e.errno:
                                raise KeyError(cpv)
                        raise cache_errors.CacheCorruption(cpv, e)
 
@@ -52,7 +48,7 @@ class database(fs_template.FsBased):
                fp=os.path.join(self._base,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
                try:    myf=open(fp, "w")
                except (OSError, IOError), e:
-                       if e.errno == 2:
+                       if errno.ENOENT == e.errno:
                                try:
                                        self._ensure_dirs(cpv)
                                        myf=open(fp,"w")
@@ -79,7 +75,7 @@ class database(fs_template.FsBased):
                try:
                        os.remove(os.path.join(self._base,cpv))
                except OSError, e:
-                       if e.errno == 2:
+                       if errno.ENOENT == e.errno:
                                raise KeyError(cpv)
                        else:
                                raise cache_errors.CacheCorruption(cpv, e)
index 2936dd628ef7374f3ec596003b2a7e1600ce7d2c..bab788fe6939dc12b32ea0c7593e10cfe6b1abd9 100644 (file)
@@ -180,7 +180,7 @@ def help(myaction,myopts,havecolor=1):
                print "              used in combination with --pretend all the SRC_URIs will be"
                print "              displayed multiple mirrors per line, one line per file."
                print
-               print "       "+green("--fetch-all-uri")
+               print "       "+green("--fetch-all-uri")+" ("+green("-F")+" short option)"
                print "              Same as --fetchonly except that all package files, including those"
                print "              not required to build the package, will be processed."
                print
@@ -222,7 +222,7 @@ def help(myaction,myopts,havecolor=1):
                print "       "+green("--nospinner")
                print "              Disables the spinner regardless of terminal type."
                print
-               print "       "+green("--oneshot")
+               print "       "+green("--oneshot")+" ("+green("-1")+" short option)"
                print "              Emerge as normal, but don't add packages to the world profile."
                print "              This package will only be updated if it is depended upon by"
                print "              another package."
index d931e967d1de92371c15dec2bf93685b4d0a81c2..0d71ec03e09c10e180f91950881441f60e00d8cb 100644 (file)
@@ -1642,21 +1642,23 @@ def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,sesandbox=0,fd_pipes=Non
                free=((droppriv and "usersandbox" not in features) or \
                        (not droppriv and "sandbox" not in features and "usersandbox" not in features))
 
+       if free:
+               keywords["opt_name"] += " bash"
+       else:
+               keywords["opt_name"] += " sandbox"
+
        if sesandbox:
                con = selinux.getcontext()
                con = string.replace(con, mysettings["PORTAGE_T"], mysettings["PORTAGE_SANDBOX_T"])
                selinux.setexec(con)
 
-       if not free:
-               keywords["opt_name"] += " sandbox"
-               return portage_exec.spawn_sandbox(mystring,env=env,**keywords)
-       else:
-               keywords["opt_name"] += " bash"
-               return portage_exec.spawn_bash(mystring,env=env,**keywords)
-       
+       retval = portage_exec.spawn_bash(mystring, env=env, **keywords)
+
        if sesandbox:
                selinux.setexec(None)
 
+       return retval
+
 def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",use_locks=1, try_mirrors=1):
        "fetch files.  Will use digest file if available."
 
@@ -4738,23 +4740,25 @@ class portdbapi(dbapi):
                return self.findname2(mycpv)[0]
 
        def findname2(self,mycpv):
-               "returns file location for this particular package and in_overlay flag"
+               """ 
+               Returns the location of the CPV, and what overlay it was in.
+               Searches overlays first, then PORTDIR; this allows us to return the first
+               matching file.  As opposed to starting in portdir and then doing overlays
+               second, we would have to exhaustively search the overlays until we found
+               the file we wanted.
+               """
                if not mycpv:
                        return "",0
                mysplit=mycpv.split("/")
-
                psplit=pkgsplit(mysplit[1])
-               ret=None
+
+               mytrees = self.porttrees[:]
+               mytrees.reverse()
                if psplit:
-                       for x in self.porttrees:
+                       for x in mytrees:
                                file=x+"/"+mysplit[0]+"/"+psplit[0]+"/"+mysplit[1]+".ebuild"
                                if os.access(file, os.R_OK):
-                                       # when found
-                                       ret=[file, x]
-               if ret:
-                       return ret[0], ret[1]
-
-               # when not found
+                                       return[file, x]
                return None, 0
 
        def aux_get(self, mycpv, mylist):
@@ -5170,10 +5174,14 @@ class portdbapi(dbapi):
                for mycpv in mylist:
                        #we need to update this next line when we have fully integrated the new db api
                        auxerr=0
+                       keys = None
                        try:
                                keys, eapi = db["/"]["porttree"].dbapi.aux_get(mycpv, ["KEYWORDS", "EAPI"])
-                       except (KeyError,IOError,TypeError):
-                               continue
+                       except KeyError:
+                               pass
+                       except portage_exception.PortageException, e:
+                               writemsg("!!! Error: aux_get('%s', ['KEYWORDS', 'EAPI'])\n" % mycpv)
+                               writemsg("!!! %s\n" % str(e))
                        if not keys:
                                # KEYWORDS=""
                                #print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"