summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-11 00:37:20 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-11 00:37:20 +0000
commite5a3fdc093e03bcad70a026dd271c99c6f78965e (patch)
tree130181334453eb3e6c2b19eb487887386e5a7242
parentNest the DepcheckCompositeDB class inside the depgraph class since it's (diff)
downloadportage-multirepo-e5a3fdc093e03bcad70a026dd271c99c6f78965e.tar.gz
portage-multirepo-e5a3fdc093e03bcad70a026dd271c99c6f78965e.tar.bz2
portage-multirepo-e5a3fdc093e03bcad70a026dd271c99c6f78965e.zip
Tweak --buildpkgonly and fakeroot logic so that --buildpkgonly can be
used by a non-root user to build binary packages with fakeroot. svn path=/main/trunk/; revision=9825
-rw-r--r--pym/_emerge/__init__.py17
-rw-r--r--pym/portage/__init__.py6
2 files changed, 15 insertions, 8 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 060176d3..eae47628 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -4769,7 +4769,7 @@ class MergeTask(object):
try:
catdir_lock = portage.locks.lockdir(catdir)
portage.util.ensure_dirs(catdir,
- uid=portage.portage_uid, gid=portage.portage_gid,
+ gid=portage.portage_gid,
mode=070, mask=0)
builddir_lock = portage.locks.lockdir(
pkgsettings["PORTAGE_BUILDDIR"])
@@ -6959,6 +6959,7 @@ def action_build(settings, trees, mtimedb,
ldpath_mtimes = mtimedb["ldpath"]
favorites=[]
merge_count = 0
+ buildpkgonly = "--buildpkgonly" in myopts
pretend = "--pretend" in myopts
fetchonly = "--fetchonly" in myopts or "--fetch-all-uri" in myopts
ask = "--ask" in myopts
@@ -7260,7 +7261,7 @@ def action_build(settings, trees, mtimedb,
+ " AUTOCLEAN is disabled. This can cause serious"
+ " problems due to overlapping packages.\n")
- if merge_count and not (pretend or fetchonly):
+ if merge_count and not (buildpkgonly or fetchonly or pretend):
post_emerge(trees, mtimedb, retval)
return retval
@@ -7756,13 +7757,17 @@ def emerge_main():
_emerge.help.help(myaction, myopts, portage.output.havecolor)
return 1
+ pretend = "--pretend" in myopts
+ fetchonly = "--fetchonly" in myopts or "--fetch-all-uri" in myopts
+ buildpkgonly = "--buildpkgonly" in myopts
+
# check if root user is the current user for the actions where emerge needs this
if portage.secpass < 2:
# We've already allowed "--version" and "--help" above.
if "--pretend" not in myopts and myaction not in ("search","info"):
need_superuser = not \
- ("--fetchonly" in myopts or \
- "--fetch-all-uri" in myopts or \
+ (fetchonly or \
+ (buildpkgonly and secpass >= 1) or \
myaction in ("metadata", "regen") or \
(myaction == "sync" and os.access(settings["PORTDIR"], os.W_OK)))
if portage.secpass < 1 or \
@@ -7865,14 +7870,14 @@ def emerge_main():
root_config = trees[settings["ROOT"]]["root_config"]
if 1 == unmerge(root_config, myopts, myaction, myfiles,
mtimedb["ldpath"]):
- if "--pretend" not in myopts:
+ if not (buildpkgonly or fetchonly or pretend):
post_emerge(trees, mtimedb, os.EX_OK)
elif myaction in ("depclean", "prune"):
validate_ebuild_environment(trees)
action_depclean(settings, trees, mtimedb["ldpath"],
myopts, myaction, myfiles, spinner)
- if "--pretend" not in myopts:
+ if not (buildpkgonly or fetchonly or pretend):
post_emerge(trees, mtimedb, os.EX_OK)
# "update", "system", or just process files:
else:
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index a622439a..fa2d7930 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2900,7 +2900,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
if not free:
free=((droppriv and "usersandbox" not in features) or \
(not droppriv and "sandbox" not in features and \
- "usersandbox" not in features))
+ "usersandbox" not in features and not fakeroot))
if free or "SANDBOX_ACTIVE" in os.environ:
keywords["opt_name"] += " bash"
@@ -4468,6 +4468,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
vartree = db[myroot]["vartree"]
features = mysettings.features
+ from portage.data import secpass
validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
"config","info","setup","depend","fetch","digest",
@@ -4974,7 +4975,8 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
"sesandbox" in mysettings.features
droppriv = "userpriv" in mysettings.features and \
- "userpriv" not in restrict
+ "userpriv" not in restrict and \
+ secpass >= 2
fakeroot = "fakeroot" in mysettings.features