From 4f691625e4094e4cbcc3e832597a1a230c2a5419 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 17 Mar 2007 14:22:40 +0000 Subject: [PATCH] Merged from trunk 6209:6217 Automatically convert ROOT and PORTAGE_CONFIGROOT to absolute paths when necessary since relative paths lead to problems. Thanks to Christian Heim for reporting. Add back rstrip(os.path.sep) from the previous commit since it's needed when ROOT="/". For bug #163262 and conformance with section 7.2 of the PMS, make the export attribute of variables persist between ebuild phases. For bug #171117, ensure that the new and old config have different timestamps (for the benefit of programs like rsync that need distiguishable timestamps to detect file changes). Thanks to Ben Bennett for reporting. Fix a utime call to prevent a timestamp collision for bug #171117. svn path=/main/branches/prefix/; revision=6235 --- bin/ebuild.sh | 1 + pym/portage/__init__.py | 8 ++++---- pym/portage/dbapi/vartree.py | 12 +++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 620e47e04..5f4b1777b 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1773,6 +1773,7 @@ if [ -n "${myarg}" ] && \ # Save current environment and touch a success file. (echo for success) umask 002 set | @EGREP@ -v "^SANDBOX_" > "${T}/environment" 2>/dev/null + export | @EGREP@ -v "^declare -x SANDBOX_" >> "${T}/environment" 2>/dev/null chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/environment" &>/dev/null chmod g+w "${T}/environment" &>/dev/null fi diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index c7affe743..4b5f7d819 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -927,8 +927,8 @@ class config: if config_root is None: config_root = "/" - config_root = \ - normalize_path(config_root).rstrip(os.path.sep) + os.path.sep + config_root = normalize_path(os.path.abspath( + config_root)).rstrip(os.path.sep) + os.path.sep check_var_directory("PORTAGE_CONFIGROOT", config_root + EPREFIX) @@ -1179,8 +1179,8 @@ class config: if target_root is None: target_root = "/" - target_root = \ - normalize_path(target_root).rstrip(os.path.sep) + os.path.sep + target_root = normalize_path(os.path.abspath( + target_root)).rstrip(os.path.sep) + os.path.sep check_var_directory("ROOT", target_root + EPREFIX) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index e28938027..e37f1e6a4 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1494,8 +1494,14 @@ class dblink(object): else: cfgfiledict["IGNORE"]=0 + # Timestamp for files being merged. Use time() - 1 in order to prevent + # a collision with timestamps that are bumped by the utime() call + # inside isprotected(). This ensures that the new and old config have + # different timestamps (for the benefit of programs like rsync that + # that need distiguishable timestamps to detect file changes). + mymtime = long(time.time() - 1) + # set umask to 0 for merging; back up umask, save old one in prevmask (since this is a global change) - mymtime = long(time.time()) prevmask = os.umask(0) secondhand = [] @@ -1838,10 +1844,10 @@ class dblink(object): sys.exit(1) zing = ">>>" else: - mymtime = thismtime + mymtime = long(time.time()) # We need to touch the destination so that on --update the # old package won't yank the file with it. (non-cfgprot related) - os.utime(mydest, (thismtime,thismtime)) + os.utime(mydest, (mymtime, mymtime)) zing = "---" if self.settings["USERLAND"] == "Darwin" and myrealdest[-2:] == ".a": -- 2.26.2