# 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:
# 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
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)
# 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)