Merged from trunk -r12380:12384
authorFabian Groffen <grobian@gentoo.org>
Thu, 8 Jan 2009 20:09:55 +0000 (20:09 -0000)
committerFabian Groffen <grobian@gentoo.org>
Thu, 8 Jan 2009 20:09:55 +0000 (20:09 -0000)
   | 12381   | Do not hardlink files unless they are in the same directory, |
   | zmedico | since otherwise tar may not be able to extract a tarball of  |
   |         | the resulting hardlinks due to 'Invalid cross-device link'   |
   |         | errors (depends on layout of mount points). Also, don't      |
   |         | hardlink zero-byte files since it doesn't save any space.    |
   |         | Thanks to Daniel Robbins for reporting these issues which    |
   |         | were noticed by funtoo users when attempting to extract      |
   |         | stage tarballs.                                              |

   | 12382   | Remove print statement from previous commit.                 |
   | zmedico |                                                              |

   | 12383   | Fix _setitem() to write the same format that's currently     |
   | zmedico | distributed in the rsync tree.                               |

   | 12384   | When the set configuration is incomplete, notify the user    |
   | zmedico | that this usually means /usr/share/portage/config/sets.conf  |
   |         | is missing or corrupt.                                       |

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

pym/_emerge/__init__.py
pym/portage/cache/metadata.py
pym/portage/dbapi/vartree.py

index 8a9b1c8480802e1fb72b902225d048ea1ff7357a..fb25365b462f5af72756f3a963bc89bfa505b392 100644 (file)
@@ -14416,15 +14416,29 @@ def expand_set_arguments(myfiles, myaction, root_config):
        
        # emerge relies on the existance of sets with names "world" and "system"
        required_sets = ("world", "system")
+       missing_sets = []
 
        for s in required_sets:
                if s not in sets:
-                       msg = ["emerge: incomplete set configuration, " + \
-                               "no \"%s\" set defined" % s]
+                       missing_sets.append(s)
+       if missing_sets:
+               if len(missing_sets) > 2:
+                       missing_sets_str = ", ".join('"%s"' % s for s in missing_sets[:-1])
+                       missing_sets_str += ', and "%s"' % missing_sets[-1]
+               elif len(missing_sets) == 2:
+                       missing_sets_str = '"%s" and "%s"' % tuple(missing_sets)
+               else:
+                       missing_sets_str = '"%s"' % missing_sets[-1]
+               msg = ["emerge: incomplete set configuration, " + \
+                       "missing set(s): %s" % missing_sets_str]
+               if sets:
                        msg.append("        sets defined: %s" % ", ".join(sets))
-                       for line in msg:
-                               sys.stderr.write(line + "\n")
-                       retval = 1
+               msg.append("        This usually means that '%s'" % \
+                       (os.path.join(portage.const.GLOBAL_CONFIG_PATH, "sets.conf"),))
+               msg.append("        is missing or corrupt.")
+               for line in msg:
+                       writemsg_level(line + "\n", level=logging.ERROR, noiselevel=-1)
+               return (None, 1)
        unmerge_actions = ("unmerge", "prune", "clean", "depclean")
 
        for a in myfiles:
index b602f62bc8cc7682fc2636630a53f472ffbf4e9e..8f7992472c2ac65cbd389addf7acc936b1c35bad 100644 (file)
@@ -3,9 +3,9 @@
 # License: GPL2
 # $Id$
 
-import os, re, stat, types
+import errno, os, re
 from portage.cache import cache_errors, flat_hash
-import portage.eclass_cache 
+import portage.eclass_cache
 from portage.cache.template import reconstruct_eclasses
 from portage.cache.mappings import ProtectedDict
 
@@ -74,7 +74,42 @@ class database(flat_hash.database):
 
                return d
 
-
-               
        def _setitem(self, cpv, values):
-               flat_hash.database._setitem(self, cpv, values)
+               if "_eclasses_" in values:
+                       values = ProtectedDict(values)
+                       values["INHERITED"] = ' '.join(sorted(
+                               reconstruct_eclasses(cpv, values["_eclasses_"])))
+
+               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 EnvironmentError, e:
+                       if errno.ENOENT == e.errno:
+                               try:
+                                       self._ensure_dirs(cpv)
+                                       myf = open(fp, "w")
+                               except EnvironmentError, e:
+                                       raise cache_errors.CacheCorruption(cpv, e)
+                       else:
+                               raise cache_errors.CacheCorruption(cpv, e)
+
+               try:
+                       for k in self.auxdbkey_order:
+                               myf.write(values.get(k, "") + "\n")
+                       for i in xrange(magic_line_count - len(self.auxdbkey_order)):
+                               myf.write("\n")
+               finally:
+                       myf.close()
+               self._ensure_access(fp, mtime=values["_mtime_"])
+
+               new_fp = os.path.join(self.location, cpv)
+               try:
+                       os.rename(fp, new_fp)
+               except EnvironmentError, e:
+                       try:
+                               os.unlink(fp)
+                       except EnvironmentError:
+                               pass
+                       raise cache_errors.CacheCorruption(cpv, e)
index 2a6cd5d46d94e211b92adace2694c987874ba6cd..47bc318516d182b1a7689fce99feafed88768592 100644 (file)
@@ -4327,12 +4327,20 @@ class dblink(object):
                                # whether config protection or not, we merge the new file the
                                # same way.  Unless moveme=0 (blocking directory)
                                if moveme:
-                                       hardlink_key = (mymd5, mystat.st_size,
+                                       # Do not hardlink files unless they are in the same
+                                       # directory, since otherwise tar may not be able to
+                                       # extract a tarball of the resulting hardlinks due to
+                                       # 'Invalid cross-device link' errors (depends on layout of
+                                       # mount points). Also, don't hardlink zero-byte files since
+                                       # it doesn't save any space.
+                                       parent_dir = os.path.dirname(myrealdest)
+                                       hardlink_key = (parent_dir, mymd5, mystat.st_size,
                                                mystat.st_mode, mystat.st_uid, mystat.st_gid)
                                        hardlink_candidates = self._md5_merge_map.get(hardlink_key)
                                        if hardlink_candidates is None:
                                                hardlink_candidates = []
-                                               self._md5_merge_map[hardlink_key] = hardlink_candidates
+                                               if mystat.st_size != 0:
+                                                       self._md5_merge_map[hardlink_key] = hardlink_candidates
                                        mymtime = movefile(mysrc, mydest, newmtime=thismtime,
                                                sstat=mystat, mysettings=self.settings,
                                                hardlink_candidates=hardlink_candidates)