if not hasattr(__builtins__, "set"):
from sets import Set as set
exename=os.path.basename(sys.argv[0])
-os.environ["PORTAGE_CALLER"]="repoman"
sys.path = ["/usr/lib/portage/pym"]+sys.path
version="1.2"
# A sane umask is needed for files that portage creates.
os.umask(022)
-trees = portage.create_trees()
-settings = trees["/"]["porttree"].settings
-if settings.get("NOCOLOR", None) in ("yes", "true") or \
+repoman_settings = portage.config(local_config=False,
+ config_incrementals=portage_const.INCREMENTALS)
+repoman_settings.lock()
+
+if repoman_settings.get("NOCOLOR", "").upper() in ("yes", "true") or \
not sys.stdout.isatty():
nocolor()
valid_ebuild_name_re=re.compile(ven_string+'$', re.I)
valid_ebuild_filename_re=re.compile(ven_string+'\.ebuild$', re.I)
-repoman_settings = portage.config(clone=settings)
verbose=0
quiet=0
print "PORTDIR = \""+os.environ["PORTDIR"]+"\""
print "PORTDIR_OVERLAY = \""+os.environ["PORTDIR_OVERLAY"]+"\""
-trees = portage.create_trees(trees=trees)
-settings = trees["/"]["porttree"].settings
+# Now that PORTDIR_OVERLAY is properly overridden, create the portdb.
+repoman_settings = portage.config(local_config=False,
+ config_incrementals=portage_const.INCREMENTALS)
+repoman_settings.lock()
+trees = portage.create_trees()
+trees["/"]["porttree"].settings = repoman_settings
portdb = trees["/"]["porttree"].dbapi
+portdb.mysettings = repoman_settings
# dep_zapdeps looks at the vardbapi, but it shouldn't for repoman.
-trees["/"]["vartree"].dbapi = portage.fakedbapi(settings=settings)
-repoman_settings = portage.config(clone=settings)
+trees["/"]["vartree"].dbapi = portage.fakedbapi(settings=repoman_settings)
if not myreporoot:
myreporoot = os.path.basename(portdir_overlay)
else:
dep_settings = portage.config(
config_profile_path=profdir,
- config_incrementals=portage_const.INCREMENTALS)
+ config_incrementals=portage_const.INCREMENTALS,
+ local_config=False)
arch_caches[prof[0]] = dep_settings
while True:
try:
class config:
def __init__(self, clone=None, mycpv=None, config_profile_path=None,
- config_incrementals=None, config_root="/", target_root="/"):
+ config_incrementals=None, config_root="/", target_root="/",
+ local_config=True):
self.already_in_regenerate = 0
self.negVirtuals = {}
self.user_profile_dir = None
+ self.local_config = local_config
if clone:
self.incrementals = copy.deepcopy(clone.incrementals)
self.profile_path = copy.deepcopy(clone.profile_path)
self.user_profile_dir = copy.deepcopy(clone.user_profile_dir)
+ self.local_config = copy.deepcopy(clone.local_config)
self.module_priority = copy.deepcopy(clone.module_priority)
self.modules = copy.deepcopy(clone.modules)
(parentPath, parentsFile))
self.profiles.append(currentPath)
addProfile(os.path.realpath(self.profile_path))
- if os.environ.has_key("PORTAGE_CALLER") and os.environ["PORTAGE_CALLER"] == "repoman":
- pass
- else:
+ if local_config:
custom_prof = os.path.join(
config_root, CUSTOM_PROFILE_PATH.lstrip(os.path.sep))
if os.path.exists(custom_prof):
pmask_locations = [os.path.join(self["PORTDIR"], "profiles")]
pmask_locations.extend(self.profiles)
- if os.environ.get("PORTAGE_CALLER","") != "repoman" or \
- os.environ.get("PORTDIR_OVERLAY","") != "":
- overlay_profiles = []
- for ov in self["PORTDIR_OVERLAY"].split():
- ov = normalize_path(ov)
- profiles_dir = os.path.join(ov, "profiles")
- if os.path.isdir(profiles_dir):
- overlay_profiles.append(profiles_dir)
- locations += overlay_profiles
-
- pmask_locations.extend(overlay_profiles)
+ """ repoman controls PORTDIR_OVERLAY via the environment, so no
+ special cases are needed here."""
+ overlay_profiles = []
+ for ov in self["PORTDIR_OVERLAY"].split():
+ ov = normalize_path(ov)
+ profiles_dir = os.path.join(ov, "profiles")
+ if os.path.isdir(profiles_dir):
+ overlay_profiles.append(profiles_dir)
+ locations += overlay_profiles
+
+ pmask_locations.extend(overlay_profiles)
- if os.environ.get("PORTAGE_CALLER","") != "repoman":
+ if local_config:
locations.append(abs_user_config)
pmask_locations.append(abs_user_config)
pusedict = grabdict_package(
if not portage_exec.sandbox_capable and \
("sandbox" in self.features or "usersandbox" in self.features):
- if os.environ.get("PORTAGE_CALLER","") == "repoman" and \
- self.profile_path is not None and \
- os.path.realpath(self.profile_path) != \
+ if self.profile_path is not None and \
+ os.path.realpath(self.profile_path) == \
os.path.realpath(PROFILE_PATH):
- # This profile does not belong to the user running repoman.
- pass
- else:
+ """ Don't show this warning when running repoman and the
+ sandbox feature came from a profile that doesn't belong to
+ the user."""
writemsg(colorize("BAD", "!!! Problem with sandbox" + \
" binary. Disabling...\n\n"), noiselevel=-1)
if "sandbox" in self.features:
self.dirVirtuals + [self.negVirtuals], incremental=1)
# Repoman does not use user or tree virtuals.
- if os.environ.get("PORTAGE_CALLER","") != "repoman":
+ if self.local_config:
# XXX: vartree does not use virtuals, does user set matter?
temp_vartree = vartree(myroot, self.dirVirtuals,
categories=self.categories, settings=self)