Merged from trunk 4915:4929
authorFabian Groffen <grobian@gentoo.org>
Sat, 4 Nov 2006 18:18:02 +0000 (18:18 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 4 Nov 2006 18:18:02 +0000 (18:18 -0000)
For bug #153951, fail with a simple "Permission denied" error if the
merge phase doesn't have write access to $ROOT.

Silently omit info_pkgs that aren't installed.  Thanks to solar.

When transferring cache after sync, compare all metadata to make sure it
is identical (don't trust _mtime_ and _eclasses_ alone).  Local tests
show that this can add approximately 15% more time to the metadata
update, but it's needed for things like bug #153591.

Make sure trg is defined.

Fix --ignore-default-opts for bug #153980.

Revert implicit rdepend behavior back to the way it was in
portage-2.0.51.  Thanks to vapier for the patch.  The original change
seems to have been an  accidentally hunk (referencing bug #58819) that
was committed to cvs along with another patch in revision 1.201.2.32 of
ebuild.sh.

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

bin/ebuild.sh
bin/emerge
pym/cache/util.py
pym/portage.py

index 072a7e1694cbfd5012cf2fe0b23950d7ab3bd8e0..03fa09cd702d6f032e70bf3cd6ebe693fc484f72 100755 (executable)
@@ -1533,7 +1533,7 @@ if [[ ${EBUILD_SH_ARGS} != "depend" ]] && [[ ${EBUILD_SH_ARGS}  != "clean" ]] &&
                fi
        fi
 
-       if hasq ccache ${FEATURES} &>/dev/null; then
+       if hasq ccache ${FEATURES} ; then
                #We can enable compiler cache support
                if [ -z "${PATH/*ccache*/}" ]; then
                        # Remove the other reference.
@@ -1659,8 +1659,8 @@ export TMPDIR="${T}"
 #syntax from getting expanded :)
 #check eclass rdepends also.
 set -f
-if [ "${RDEPEND-unset}" == "unset" ] && [ "${E_RDEPEND-unset}" == "unset" ] ; then
-       export RDEPEND="${DEPEND} ${E_DEPEND}"
+if [ "${RDEPEND-unset}" == "unset" ] ; then
+       export RDEPEND=${DEPEND}
        debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
 fi
 
index 405b22ea0b97c2a220d326856b620079c39ab70c..f83f0f51e7e750b7e21508297eabb4c01935615d 100755 (executable)
@@ -3598,11 +3598,9 @@ def action_info(settings, trees, myopts, myfiles):
                                        pkgs += [mycpv[2] + "-" + mycpv[3]]
                                else:
                                        pkgs += [mycpv[2]]
-                       if not pkgs:
-                               pkgs = "[Not Present]"
-                       else:
+                       if pkgs:
                                pkgs = ", ".join(sorted_versions(pkgs))
-                       print "%-20s %s" % (x+":", pkgs)
+                               print "%-20s %s" % (x+":", pkgs)
                else:
                        print "%-20s %s" % (x+":", "[NOT VALID]")
 
@@ -4282,7 +4280,7 @@ def emerge_main():
                nocolor()
 
        tmpcmdline = []
-       if "--ignore-default-opts" not in tmpcmdline:
+       if "--ignore-default-opts" not in sys.argv:
                tmpcmdline.extend(settings["EMERGE_DEFAULT_OPTS"].split())
        tmpcmdline.extend(sys.argv[1:])
        myaction, myopts, myfiles = parse_opts(tmpcmdline)
index fdd732fe07b0bf111a905937770eb1ac7664d7e6..df97bcfa5cf4201fdaf31928a647ce0cbc21254b 100644 (file)
@@ -3,6 +3,9 @@
 # License: GPL2
 # $Id: util.py 1911 2005-08-25 03:44:21Z ferringb $
 
+if not hasattr(__builtins__, "set"):
+       from sets import Set as set
+from itertools import chain
 from cache import cache_errors
 
 def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, verbose_instance=None):
@@ -33,6 +36,7 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
                        del e
                        continue
                write_it = True
+               trg = None
                try:
                        trg = trg_cache[x]
                        if long(trg["_mtime_"]) == long(entry["_mtime_"]) and eclass_cache.is_eclass_data_valid(trg["_eclasses_"]):
@@ -40,6 +44,19 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None,
                except (cache_errors.CacheError, KeyError):
                        pass
 
+               if trg and not write_it:
+                       """ We don't want to skip the write unless we're really sure that
+                       the existing cache is identical, so don't trust _mtime_ and
+                       _eclasses_ alone."""
+                       for d in (entry, trg):
+                               if "EAPI" in d and d["EAPI"] in ("", "0"):
+                                       del d["EAPI"]
+                       for k in set(chain(entry, trg)).difference(
+                               ("_mtime_", "_eclasses_")):
+                               if trg.get(k, "") != entry.get(k, ""):
+                                       write_it = True
+                                       break
+
                if write_it:
                        if entry.get("INHERITED",""):
                                if src_cache.complete_eclass_entries:
index 48df18b5707cb6af9ed597cd291f74fb1a787d58..01ad817b82be55d9bb66c687898e1b2abd60e8f4 100644 (file)
@@ -3416,6 +3416,10 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
 
 def merge(mycat, mypkg, pkgloc, infloc, myroot, mysettings, myebuild=None,
        mytree=None, mydbapi=None, vartree=None, prev_mtimes=None):
+       if not os.access(myroot, os.W_OK):
+               writemsg("Permission denied: access('%s', W_OK)\n" % myroot,
+                       noiselevel=-1)
+               return errno.EACCES
        mylink = dblink(mycat, mypkg, myroot, mysettings, treetype=mytree,
                vartree=vartree)
        return mylink.merge(pkgloc, infloc, myroot, myebuild,