tmpsettings["EBUILD_FORCE_TEST"] = "1"
tmpsettings.backup_changes("EBUILD_FORCE_TEST")
if "test" not in tmpsettings.features:
- tmpsettings.features.append("test")
- tmpsettings.features.sort()
- tmpsettings["FEATURES"] = " ".join(tmpsettings.features)
+ tmpsettings.features.add("test")
+ tmpsettings["FEATURES"] = " ".join(sorted(tmpsettings.features))
tmpsettings.backup_changes("FEATURES")
if opts.skip_manifest:
self.call_update_mine = 0
def update(self, *arg):
- try: self.pstr = int(self.pstr) + 1
- except ValueError: self.pstr = 1
+ try:
+ self.pstr = int(self.pstr) + 1
+ except ValueError:
+ self.pstr = 1
sys.stdout.write("%s%i%%" % \
("\b" * (len(str(self.pstr))+1), self.pstr))
sys.stdout.flush()
if "usersandbox" in self.features:
self.features.remove("usersandbox")
- self.features.sort()
- self["FEATURES"] = " ".join(self.features)
+ self["FEATURES"] = " ".join(sorted(self.features))
self.backup_changes("FEATURES")
# inject EPREFIX as it's in no single config file (I hope),
myflags.add(var_lower + "_" + x)
if not hasattr(self, "features"):
- self.features = sorted(set(
- self.configlist[-1].get("FEATURES","").split()))
+ self.features = set(
+ self.configlist[-1].get("FEATURES","").split())
self["FEATURES"] = " ".join(self.features)
myflags.update(self.useforce)
# so that the caller can override it.
tmpdir = mysettings["PORTAGE_TMPDIR"]
- if mydo != "depend" and mycpv != mysettings.mycpv:
- """For performance reasons, setcpv only triggers reset when it
- detects a package-specific change in config. For the ebuild
- environment, a reset call is forced in order to ensure that the
- latest env.d variables are used."""
+ if mycpv != mysettings.mycpv:
+ # Reload env.d variables and reset any previous settings.
mysettings.reload()
- mysettings.reset(use_cache=use_cache)
- mysettings.setcpv(mycpv, use_cache=use_cache, mydb=mydbapi)
+ mysettings.reset()
+ if mydo == 'depend':
+ # Don't pass in mydbapi here since the resulting aux_get
+ # call would lead to infinite 'depend' phase recursion.
+ mysettings.setcpv(mycpv)
+ else:
+ mysettings.setcpv(mycpv, mydb=mydbapi)
# config.reset() might have reverted a change made by the caller,
# so restore it to it's original value.
@type vartree: vartree instance
@param prev_mtimes: A dict of { filename:mtime } keys used by merge() to do config_protection
@type prev_mtimes: dictionary
+ @param fd_pipes: A dict of mapping for pipes, { '0': stdin, '1': stdout }
+ for example.
+ @type fd_pipes: Dictionary
+ @param returnpid: Return a list of process IDs for a successful spawn, or
+ in integer value if spawn is unsuccessful. NOTE: This requires the
+ caller clean up all returned PIDs.
+ @type returnpid: Boolean
@rtype: Boolean
@returns:
1. 0 for success
return 1
# qmerge is a special phase that implies noclean.
if "noclean" not in mysettings.features:
- mysettings.features.append("noclean")
+ mysettings.features.add("noclean")
#qmerge is specifically not supposed to do a runtime dep check
retval = merge(
mysettings["CATEGORY"], mysettings["PF"], mysettings["D"],
def _setitem(self, cpv, values):
s = cpv.rfind("/")
fp=os.path.join(self._base,cpv[:s],".update.%i.%s" % (os.getpid(), cpv[s+1:]))
- try: myf=open(fp, "w")
+ try:
+ myf = open(fp, "w")
except (OSError, IOError), e:
if errno.ENOENT == e.errno:
try:
self._ensure_access(fp, mtime=values["_mtime_"])
#update written. now we move it.
new_fp = os.path.join(self._base,cpv)
- try: os.rename(fp, new_fp)
+ try:
+ os.rename(fp, new_fp)
except (OSError, IOError), e:
os.remove(fp)
raise cache_errors.CacheCorruption(cpv, e)
if self.readonly:
raise cache_errors.ReadOnlyRestriction("table %s doesn't exist" % \
self.SCHEMA_PACKAGE_NAME)
- try: self.con.execute(self.SCHEMA_PACKAGE_CREATE)
+ try:
+ self.con.execute(self.SCHEMA_PACKAGE_CREATE)
except self._BaseError, e:
raise cache_errors.InitializationError(self.__class__, e)
if self.readonly:
raise cache_errors.ReadOnlyRestriction("table %s doesn't exist" % \
self.SCHEMA_VALUES_NAME)
- try: self.con.execute(self.SCHEMA_VALUES_CREATE)
+ try:
+ self.con.execute(self.SCHEMA_VALUES_CREATE)
except self._BaseError, e:
raise cache_errors.InitializationError(self.__class__, e)
def _getitem(self, cpv):
- try: self.con.execute("SELECT key, value FROM %s NATURAL JOIN %s "
+ try:
+ self.con.execute("SELECT key, value FROM %s NATURAL JOIN %s "
"WHERE label=%s AND cpv=%s" % (self.SCHEMA_PACKAGE_NAME, self.SCHEMA_VALUES_NAME,
self.label, self._sfilter(cpv)))
except self._BaseError, e:
try:
# insert.
- try: pkgid = self._insert_cpv(cpv)
+ try:
+ pkgid = self._insert_cpv(cpv)
except self._BaseError, e:
raise cache_errors.CacheCorruption(cpv, e)
db_values.append({"key":key, "value":values[key]})
if len(db_values) > 0:
- try: self.con.executemany("INSERT INTO %s (pkgid, key, value) VALUES(\"%s\", %%(key)s, %%(value)s)" % \
+ try:
+ self.con.executemany("INSERT INTO %s (pkgid, key, value) VALUES(\"%s\", %%(key)s, %%(value)s)" % \
(self.SCHEMA_VALUES_NAME, str(pkgid)), db_values)
except self._BaseError, e:
raise cache_errors.CacheCorruption(cpv, e)
except Exception:
if not self.autocommits:
- try: self.db.rollback()
- except self._BaseError: pass
+ try:
+ self.db.rollback()
+ except self._BaseError:
+ pass
raise
query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE.replace("INSERT","REPLACE",1)
else:
# just delete it.
- try: del self[cpv]
- except (cache_errors.CacheCorruption, KeyError): pass
+ try:
+ del self[cpv]
+ except (cache_errors.CacheCorruption, KeyError):
+ pass
query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE
try:
self.con.execute(query_str % (self.label, cpv))
def __contains__(self, cpv):
if not self.autocommits:
- try: self.commit()
+ try:
+ self.commit()
except self._BaseError, e:
raise cache_errors.GeneralCacheCorruption(e)
- try: self.con.execute("SELECT cpv FROM %s WHERE label=%s AND cpv=%s" % \
+ try:
+ self.con.execute("SELECT cpv FROM %s WHERE label=%s AND cpv=%s" % \
(self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv)))
except self._BaseError, e:
raise cache_errors.GeneralCacheCorruption(e)
def __iter__(self):
if not self.autocommits:
- try: self.commit()
+ try:
+ self.commit()
except self._BaseError, e:
raise cache_errors.GeneralCacheCorruption(e)
- try: self.con.execute("SELECT cpv FROM %s WHERE label=%s" %
+ try:
+ self.con.execute("SELECT cpv FROM %s WHERE label=%s" %
(self.SCHEMA_PACKAGE_NAME, self.label))
except self._BaseError, e:
raise cache_errors.GeneralCacheCorruption(e)
yield x[0]
def iteritems(self):
- try: self.con.execute("SELECT cpv, key, value FROM %s NATURAL JOIN %s "
+ try:
+ self.con.execute("SELECT cpv, key, value FROM %s NATURAL JOIN %s "
"WHERE label=%s" % (self.SCHEMA_PACKAGE_NAME, self.SCHEMA_VALUES_NAME,
self.label))
except self._BaseError, e:
query = ''
print "query = SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % (self.label, query)
- try: self.con.execute("SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % \
+ try:
+ self.con.execute("SELECT cpv from package_cache natural join values_cache WHERE label=%s %s" % \
(self.label, query))
except self._BaseError, e:
raise cache_errors.GeneralCacheCorruption(e)
# print "processing x=",x
count+=1
dead_nodes.discard(x)
- try: entry = src_cache[x]
+ try:
+ entry = src_cache[x]
except KeyError, e:
noise.missing_entry(x)
del e
# by this time, if it reaches here, the eclass has been validated, and the entry has
# been updated/translated (if needs be, for metadata/cache mainly)
- try: trg_cache[x] = entry
+ try:
+ trg_cache[x] = entry
except cache_errors.CacheError, ce:
noise.exception(x, ce)
del ce
if s1[1] != s2[1]:
# it's possible that the s(1|2)[1] == ''
# in such a case, fudge it.
- try: r1 = int(s1[1])
- except ValueError: r1 = 0
- try: r2 = int(s2[1])
- except ValueError: r2 = 0
+ try:
+ r1 = int(s1[1])
+ except ValueError:
+ r1 = 0
+ try:
+ r2 = int(s2[1])
+ except ValueError:
+ r2 = 0
if r1 - r2:
return r1 - r2