summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-03-11 13:02:31 -0800
committerZac Medico <zmedico@gentoo.org>2011-03-14 09:24:16 -0700
commit33b0aad6c747f410e63f3ccd5c5a9239a2f89729 (patch)
tree05e77dd30a1b998dd0b338a8dc4085b43ab65975
parentd57e5baf22dccb5160249299e6db039f69a4214d (diff)
downloadportage-33b0aad6c747f410e63f3ccd5c5a9239a2f89729.tar.gz
portage-33b0aad6c747f410e63f3ccd5c5a9239a2f89729.tar.bz2
portage-33b0aad6c747f410e63f3ccd5c5a9239a2f89729.zip
Make all temp dirs under $PORTAGE_TMPDIR/portage.
Before, some temporary directories would be created directly in $PORTAGE_TMPDIR. Now, all are subdirectories of $PORTAGE_TMPDIR/portage since it's common for people to assume that this is the case anyway. With the default PORTAGE_TMPDIR setting of /var/tmp, this allows /var/tmp to be mounted with the "noexec" option, as long as the /var/tmp/portage subdirectory is a separate mount (people have already tended to assume that they can do this, so we're making it a reality in order to avoid any more bug reports). This will fix bug #346899.
-rw-r--r--pym/portage/dbapi/vartree.py18
-rw-r--r--pym/portage/package/ebuild/doebuild.py7
2 files changed, 14 insertions, 11 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 7395d5dd5..217033593 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -3864,15 +3864,15 @@ class dblink(object):
# so imports won't fail during portage upgrade/downgrade.
portage.proxy.lazyimport._preload_portage_submodules()
settings = self.settings
- base_path_orig = os.path.dirname(settings["PORTAGE_BIN_PATH"])
- from tempfile import mkdtemp
-
- # Make the temp directory inside PORTAGE_TMPDIR since, unlike
- # /tmp, it can't be mounted with the "noexec" option.
- base_path_tmp = mkdtemp("", "._portage_reinstall_.",
- settings["PORTAGE_TMPDIR"])
- from portage.process import atexit_register
- atexit_register(shutil.rmtree, base_path_tmp)
+
+ # Make the temp directory inside $PORTAGE_TMPDIR/portage, since
+ # it's common for /tmp and /var/tmp to be mounted with the
+ # "noexec" option (see bug #346899).
+ build_prefix = os.path.join(settings["PORTAGE_TMPDIR"], "portage")
+ ensure_dirs(build_prefix)
+ base_path_tmp = tempfile.mkdtemp(
+ "", "._portage_reinstall_.", build_prefix)
+ portage.process.atexit_register(shutil.rmtree, base_path_tmp)
dir_perms = 0o755
for subdir in "bin", "pym":
var_name = "PORTAGE_%s_PATH" % subdir.upper()
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 5272f234c..3d0317160 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -281,9 +281,12 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
if portage_bin_path not in mysplit:
mysettings["PATH"] = portage_bin_path + ":" + mysettings["PATH"]
+ # All temporary directories should be subdirectories of
+ # $PORTAGE_TMPDIR/portage, since it's common for /tmp and /var/tmp
+ # to be mounted with the "noexec" option (see bug #346899).
mysettings["BUILD_PREFIX"] = mysettings["PORTAGE_TMPDIR"]+"/portage"
- mysettings["PKG_TMPDIR"] = mysettings["PORTAGE_TMPDIR"]+"/binpkgs"
-
+ mysettings["PKG_TMPDIR"] = mysettings["BUILD_PREFIX"]+"/._unmerge_"
+
# Package {pre,post}inst and {pre,post}rm may overlap, so they must have separate
# locations in order to prevent interference.
if mydo in ("unmerge", "prerm", "postrm", "cleanrm"):