public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r15118 - in main/branches/prefix: bin bin/ebuild-helpers pym/_emerge pym/portage
@ 2009-12-18  8:32 Fabian Groffen (grobian)
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2009-12-18  8:32 UTC (permalink / raw
  To: gentoo-commits

Author: grobian
Date: 2009-12-18 08:32:44 +0000 (Fri, 18 Dec 2009)
New Revision: 15118

Modified:
   main/branches/prefix/bin/ebuild-helpers/ecompress
   main/branches/prefix/bin/ebuild.sh
   main/branches/prefix/bin/isolated-functions.sh
   main/branches/prefix/pym/_emerge/main.py
   main/branches/prefix/pym/portage/_selinux.py
Log:
   Merged from trunk -r15057:15110

   | 15058    | Bug #296554 - Add decompression support to ecompress        |
   | zmedico  | (similar to ecompressdir behavior) since dodoc can call     |
   |          | ecompress with stuff that's already compressed in some way. |
   
   | 15059    | Combine 2 shift calls into one.                             |
   | zmedico  |                                                             |
   
   | 15096    | Bug #296870 - Allow locale related LANG and LC_* variables  |
   | zmedico  | to persist between ebuild phases, and only filter them for  |
   |          | binary and installed packages.                              |
   
   | 15097    | Warn if /proc is not mounted.                               |
   | zmedico  |                                                             |
   
   | 15098    | Bug #296710 - Add equery to QA_INTERCEPTORS since it can    |
   | zmedico  | trigger a fork bomb.                                        |
   
   | 15099    | Fix typo.                                                   |
   | arfrever |                                                             |
   
   | 15100    | Bug #286497 - Make setexec() warn/nonfatal in permissive    |
   | zmedico  | mode. Thanks to Chris PeBenito <pebenito@gentoo.org> for    |
   |          | this patch.                                                 |
   
   | 15106    | Convert bytes to unicode for exception messages.            |
   | zmedico  |                                                             |
   
   | 15108    | Use portage.writemsg for lazy portage.util import.          |
   | zmedico  |                                                             |


Modified: main/branches/prefix/bin/ebuild-helpers/ecompress
===================================================================
--- main/branches/prefix/bin/ebuild-helpers/ecompress	2009-12-18 08:30:03 UTC (rev 15117)
+++ main/branches/prefix/bin/ebuild-helpers/ecompress	2009-12-18 08:32:44 UTC (rev 15118)
@@ -20,6 +20,53 @@
 	esac
 fi
 
+# decompress_args(suffix, binary)
+#	- suffix: the compression suffix to work with
+#	- binary: the program to execute that'll compress/decompress
+# new_args: global array used to return revised arguments
+decompress_args() {
+	local suffix=$1 binary=$2
+	shift 2
+
+	# Initialize the global new_args array.
+	new_args=()
+	declare -a decompress_args=()
+	local x i=0 decompress_count=0
+	for x in "$@" ; do
+		if [[ ${x%$suffix} = $x ]] ; then
+			new_args[$i]=$x
+		else
+			new_args[$i]=${x%$suffix}
+			decompress_args[$decompress_count]=$x
+			((decompress_count++))
+		fi
+		((i++))
+	done
+
+	if [ $decompress_count -gt 0 ] ; then
+		${binary} "${decompress_args[@]}"
+		if [ $? -ne 0 ] ; then
+			# Apparently decompression failed for one or more files, so
+			# drop those since we don't want to compress them twice.
+			new_args=()
+			local x i=0
+			for x in "$@" ; do
+				if [[ ${x%$suffix} = $x ]] ; then
+					new_args[$i]=$x
+					((i++))
+				elif [[ -f ${x%$suffix} ]] ; then
+					new_args[$i]=${x%$suffix}
+					((i++))
+				else
+					# Apparently decompression failed for this one, so drop
+					# it since we don't want to compress it twice.
+					true
+				fi
+			done
+		fi
+	fi
+}
+
 case $1 in
 	--suffix)
 		[[ -n $2 ]] && vecho "${0##*/}: --suffix takes no additional arguments" 1>&2
@@ -63,6 +110,15 @@
 		exit 1
 		;;
 	*)
+		# Since dodoc calls ecompress on files that are already compressed,
+		# perform decompression here (similar to ecompressdir behavior).
+		decompress_args ".Z" "gunzip -f" "$@"
+		set -- "${new_args[@]}"
+		decompress_args ".gz" "gunzip -f" "$@"
+		set -- "${new_args[@]}"
+		decompress_args ".bz2" "bunzip2 -f" "$@"
+		set -- "${new_args[@]}"
+
 		mask_ext_re=""
 		set -f
 		for x in $PORTAGE_COMPRESS_EXCLUDE_SUFFIXES ; do

Modified: main/branches/prefix/bin/ebuild.sh
===================================================================
--- main/branches/prefix/bin/ebuild.sh	2009-12-18 08:30:03 UTC (rev 15117)
+++ main/branches/prefix/bin/ebuild.sh	2009-12-18 08:32:44 UTC (rev 15118)
@@ -1641,6 +1641,12 @@
 # phase. However, if FEATURES exist inside environment.bz2 then they
 # should be overridden by current settings.
 #
+# --filter-locale causes locale related variables such as LANG and LC_*
+# variables to be filtered. These variables should persist between phases,
+# in case they are modified by the ebuild. However, the current user
+# settings should be used when loading the environment from a binary or
+# installed package.
+#
 # ---allow-extra-vars causes some extra vars to be allowd through, such
 # as ${PORTAGE_SAVED_READONLY_VARS} and ${PORTAGE_MUTABLE_FILTERED_VARS}.
 #
@@ -1669,6 +1675,11 @@
 	if hasq --filter-features $* ; then
 		filtered_vars="${filtered_vars} FEATURES"
 	fi
+	if hasq --filter-locale $* ; then
+		filtered_vars+=" LANG LC_ALL LC_COLLATE
+			LC_CTYPE LC_MESSAGES LC_MONETARY
+			LC_NUMERIC LC_PAPER LC_TIME"
+	fi
 	if ! hasq --allow-extra-vars $* ; then
 		filtered_vars="
 			${filtered_vars}
@@ -1694,7 +1705,7 @@
 		# environment may contain stale SANDBOX_{DENY,PREDICT,READ,WRITE}
 		# and FEATURES variables that should be filtered out. Between
 		# phases, these variables are normally preserved.
-		filter_opts="--filter-sandbox --filter-features ${filter_opts}"
+		filter_opts+=" --filter-sandbox --filter-features --filter-locale"
 	fi
 	filter_readonly_variables ${filter_opts} < "${T}"/environment \
 		> "${T}"/environment.filtered || return $?
@@ -1752,7 +1763,7 @@
 shopt -u extglob
 
 if [[ ${EBUILD_PHASE} == depend ]] ; then
-	QA_INTERCEPTORS="awk bash cc egrep fgrep g++
+	QA_INTERCEPTORS="awk bash cc egrep equery fgrep g++
 		gawk gcc grep javac java-config nawk perl
 		pkg-config python python-config sed"
 elif [[ ${EBUILD_PHASE} == clean* ]] ; then

Modified: main/branches/prefix/bin/isolated-functions.sh
===================================================================
--- main/branches/prefix/bin/isolated-functions.sh	2009-12-18 08:30:03 UTC (rev 15117)
+++ main/branches/prefix/bin/isolated-functions.sh	2009-12-18 08:32:44 UTC (rev 15118)
@@ -514,11 +514,6 @@
 		unset ECHANGELOG_USER GPG_AGENT_INFO \
 		SSH_AGENT_PID SSH_AUTH_SOCK STY WINDOW XAUTHORITY
 
-		# localization settings
-		unset LANG LC_COLLATE LC_CTYPE LC_MESSAGES \
-			LC_MONETARY LC_NUMERIC LC_TIME LC_PAPER \
-			LC_ALL
-
 		# CCACHE and DISTCC config
 		unset ${!CCACHE_*} ${!DISTCC_*}
 

Modified: main/branches/prefix/pym/_emerge/main.py
===================================================================
--- main/branches/prefix/pym/_emerge/main.py	2009-12-18 08:30:03 UTC (rev 15117)
+++ main/branches/prefix/pym/_emerge/main.py	2009-12-18 08:32:44 UTC (rev 15118)
@@ -1131,6 +1131,16 @@
 		return 1
 	return os.EX_OK
 
+def check_procfs():
+	procfs_path = '/proc'
+	if platform.system() not in ("Linux",) or \
+		os.path.ismount(procfs_path):
+		return os.EX_OK
+	msg = "It seems that %s is not mounted. You have been warned." % procfs_path
+	writemsg_level("".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
+		level=logging.ERROR, noiselevel=-1)
+	return 1
+
 def emerge_main():
 	global portage	# NFC why this is necessary now - genone
 	portage._disable_legacy_globals()
@@ -1194,6 +1204,7 @@
 		repo_name_check(trees)
 		repo_name_duplicate_check(trees)
 		config_protect_check(trees)
+	check_procfs()
 
 	for mytrees in trees.values():
 		mydb = mytrees["porttree"].dbapi

Modified: main/branches/prefix/pym/portage/_selinux.py
===================================================================
--- main/branches/prefix/pym/portage/_selinux.py	2009-12-18 08:30:03 UTC (rev 15117)
+++ main/branches/prefix/pym/portage/_selinux.py	2009-12-18 08:32:44 UTC (rev 15118)
@@ -7,7 +7,9 @@
 import os
 import shutil
 
+import portage
 from portage import _encodings
+from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.localization import _
 
@@ -19,6 +21,7 @@
 	dest = _unicode_encode(dest, encoding=_encodings['fs'], errors='strict')
 	(rc, ctx) = selinux.lgetfilecon(src)
 	if rc < 0:
+		src = _unicode_decode(src, encoding=_encodings['fs'], errors='replace')
 		raise OSError(_("copyfile: Failed getting context of \"%s\".") % src)
 
 	setfscreate(ctx)
@@ -39,6 +42,8 @@
 	refdir = _unicode_encode(refdir, encoding=_encodings['fs'], errors='strict')
 	(rc, ctx) = selinux.getfilecon(refdir)
 	if rc < 0:
+		refdir = _unicode_decode(refdir, encoding=_encodings['fs'],
+			errors='replace')
 		raise OSError(
 			_("mkdir: Failed getting context of reference directory \"%s\".") \
 			% refdir)
@@ -54,6 +59,7 @@
 	dest = _unicode_encode(dest, encoding=_encodings['fs'], errors='strict')
 	(rc, ctx) = selinux.lgetfilecon(src)
 	if rc < 0:
+		src = _unicode_decode(src, encoding=_encodings['fs'], errors='replace')
 		raise OSError(_("rename: Failed getting context of \"%s\".") % src)
 
 	setfscreate(ctx)
@@ -70,12 +76,21 @@
 def setexec(ctx="\n"):
 	ctx = _unicode_encode(ctx, encoding=_encodings['content'], errors='strict')
 	if selinux.setexeccon(ctx) < 0:
-		raise OSError(_("setexec: Failed setting exec() context \"%s\".") % ctx)
+		ctx = _unicode_decode(ctx, encoding=_encodings['content'],
+			errors='replace')
+		if selinux.security_getenforce() == 1:
+			raise OSError(_("Failed setting exec() context \"%s\".") % ctx)
+		else:
+			portage.writemsg("!!! " + \
+				_("Failed setting exec() context \"%s\".") % ctx, \
+				noiselevel=-1)
 
 def setfscreate(ctx="\n"):
 	ctx = _unicode_encode(ctx,
 		encoding=_encodings['content'], errors='strict')
 	if selinux.setfscreatecon(ctx) < 0:
+		ctx = _unicode_decode(ctx,
+			encoding=_encodings['content'], errors='replace')
 		raise OSError(
 			_("setfscreate: Failed setting fs create context \"%s\".") % ctx)
 
@@ -100,6 +115,8 @@
 	reflnk = _unicode_encode(reflnk, encoding=_encodings['fs'], errors='strict')
 	(rc, ctx) = selinux.lgetfilecon(reflnk)
 	if rc < 0:
+		reflnk = _unicode_decode(reflnk, encoding=_encodings['fs'],
+			errors='replace')
 		raise OSError(
 			_("symlink: Failed getting context of reference symlink \"%s\".") \
 			% reflnk)




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-18  8:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-18  8:32 [gentoo-commits] portage r15118 - in main/branches/prefix: bin bin/ebuild-helpers pym/_emerge pym/portage Fabian Groffen (grobian)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox