From: Fabian Groffen Date: Thu, 8 Jan 2009 20:09:55 +0000 (-0000) Subject: Merged from trunk -r12380:12384 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=011e917f5960497b583b5a8f46798fb80b54169b;p=portage.git Merged from trunk -r12380:12384 | 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 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 8a9b1c848..fb25365b4 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -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: diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index b602f62bc..8f7992472 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -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) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 2a6cd5d46..47bc31851 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -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)