_flush_elog_mod_echo()
+ counter_hash = settings.get("PORTAGE_COUNTER_HASH")
+ if counter_hash is not None and \
+ counter_hash == vardbapi._counter_hash():
+ # If vdb state has not changed then there's nothing else to do.
+ sys.exit(retval)
+
vdb_path = os.path.join(target_root, portage.VDB_PATH)
portage.util.ensure_dirs(vdb_path)
vdb_lock = None
mysettings = trees[myroot]["vartree"].settings
mysettings.unlock()
adjust_config(myopts, mysettings)
+ mysettings["PORTAGE_COUNTER_HASH"] = \
+ trees[myroot]["vartree"].dbapi._counter_hash()
+ mysettings.backup_changes("PORTAGE_COUNTER_HASH")
mysettings.lock()
del myroot, mysettings
"GENTOO_MIRRORS", "NOCONFMEM", "O",
"PORTAGE_BACKGROUND",
"PORTAGE_BINHOST_CHUNKSIZE", "PORTAGE_CALLER",
+ "PORTAGE_COUNTER_HASH",
"PORTAGE_ECLASS_WARNING_ENABLE", "PORTAGE_ELOG_CLASSES",
"PORTAGE_ELOG_MAILFROM", "PORTAGE_ELOG_MAILSUBJECT",
"PORTAGE_ELOG_MAILURI", "PORTAGE_ELOG_SYSTEM",
level=logging.ERROR, noiselevel=-1)
return 0
+ def _counter_hash(self):
+ try:
+ from hashlib import md5 as new_hash
+ except ImportError:
+ from md5 import new as new_hash
+ h = new_hash()
+ aux_keys = ["COUNTER"]
+ for cpv in self.cpv_all():
+ try:
+ counter, = self.aux_get(cpv, aux_keys)
+ except KeyError:
+ continue
+ h.update(counter)
+ return h.hexdigest()
+
def cpv_inject(self, mycpv):
"injects a real package into our on-disk database; assumes mycpv is valid and doesn't already exist"
os.makedirs(self.getpath(mycpv))
self.invalidentry(self.getpath(subpath))
continue
returnme.append(subpath)
+ returnme.sort()
return returnme
def cp_all(self, use_cache=1):