summaryrefslogtreecommitdiffstats
path: root/pym/portage
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2008-05-02 02:53:14 +0000
committerMarius Mauch <genone@gentoo.org>2008-05-02 02:53:14 +0000
commit43d6b99d539af8da7cb786b9a6d13911ccff8659 (patch)
treec2219a42020437f2f693c1f9b3ae6aff877c7a8f /pym/portage
parent1250021e6cc58cb63869f3c84da4c8ce9d9eaf60 (diff)
downloadportage-43d6b99d539af8da7cb786b9a6d13911ccff8659.tar.gz
portage-43d6b99d539af8da7cb786b9a6d13911ccff8659.tar.bz2
portage-43d6b99d539af8da7cb786b9a6d13911ccff8659.zip
check if PORTAGE_TMPDIR is mounted readonly/noexec (bug #219957)
svn path=/main/trunk/; revision=10069
Diffstat (limited to 'pym/portage')
-rw-r--r--pym/portage/__init__.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index c98fee116..db580c470 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -4723,6 +4723,34 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
writemsg("does not exist. Please create this directory or " + \
"correct your PORTAGE_TMPDIR setting.\n", noiselevel=-1)
return 1
+
+ # as some people use a separate PORTAGE_TMPDIR mount
+ # we prefer that as the checks below would otherwise be pointless
+ # for those people.
+ if os.path.exists(os.path.join(mysettings["PORTAGE_TMPDIR"], "portage")):
+ checkdir = os.path.join(mysettings["PORTAGE_TMPDIR"], "portage")
+ else:
+ checkdir = mysettings["PORTAGE_TMPDIR"]
+
+ if not os.access(checkdir, os.W_OK):
+ writemsg("%s is not writable.\n" % checkdir + \
+ "Likely cause is that you've mounted it as readonly.\n" \
+ , noiselevel=-1)
+ return 1
+ else:
+ from tempfile import NamedTemporaryFile
+ fd = NamedTemporaryFile(prefix="exectest-", dir=checkdir)
+ os.chmod(fd.name, 0755)
+ if not os.access(fd.name, os.X_OK):
+ writemsg("Can not execute files in %s\n" % checkdir + \
+ "Likely cause is that you've mounted it with one of the\n" + \
+ "following mount options: 'noexec', 'user', 'users'\n\n" + \
+ "Please make sure that portage can execute files in this direxctory.\n" \
+ , noiselevel=-1)
+ fd.close()
+ return 1
+ fd.close()
+ del checkdir
if mydo == "unmerge":
return unmerge(mysettings["CATEGORY"],