From 7c17de14d42f6b352899879f367ec3b95de8ba57 Mon Sep 17 00:00:00 2001 From: Kito Date: Sun, 5 Feb 2006 04:07:14 +0000 Subject: [PATCH] Merge with trunk - r2616:2636 svn path=/main/branches/prefix/; revision=2661 --- NEWS | 2 ++ bin/ebuild.sh | 45 ++++++++++++++++++++++++++++++++++++++++----- bin/emerge | 3 +-- bin/emerge-webrsync | 44 ++++++++++++++++++++++++++++++-------------- bin/prepallinfo | 4 ++-- bin/prepallman | 8 ++++++-- bin/prepallstrip | 7 +++++-- cnf/make.conf | 2 ++ cnf/make.conf.alpha | 2 ++ cnf/make.conf.amd64 | 2 ++ cnf/make.conf.arm | 2 ++ cnf/make.conf.hppa | 2 ++ cnf/make.conf.ia64 | 2 ++ cnf/make.conf.mips | 2 ++ cnf/make.conf.ppc | 2 ++ cnf/make.conf.ppc64 | 2 ++ cnf/make.conf.s390 | 2 ++ cnf/make.conf.sparc | 2 ++ cnf/make.conf.x86 | 2 ++ man/make.conf.5 | 4 ++++ pym/portage.py | 35 +++++++++++++++++++++++++++++++++-- 21 files changed, 147 insertions(+), 29 deletions(-) diff --git a/NEWS b/NEWS index ca85bd313..7503e007b 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ News (mainly features/major bug fixes) portage-2.1 (ongoing via pre releases) ------------ +* FEATURES="confcache" integration; global caching to speed up configure calls, + requires dev-util/confcache * elog framework and accompanying modules for logging ebuild warnings, errors and general notices. Collects eerror/ewarn/elog/einfo messages. * New elog function (should replace einfo in many cases) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 2f649acd4..3041eab80 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -627,7 +627,32 @@ econf() { LOCAL_EXTRA_ECONF="--libdir=${CONF_LIBDIR_RESULT} ${LOCAL_EXTRA_ECONF}" fi - echo "${ECONF_SOURCE}/configure" \ + local TMP_CONFCACHE_DIR CONFCACHE_ARG + if hasq confcache $FEATURES && ! hasq confcache $RESTRICT; then + CONFCACHE="$(type -p confcache)" + if [ -z "${CONFCACHE}" ]; then + ewarn "disabling confcache, binary cannot be found" + else + CONFCACHE="${CONFCACHE/ /\ }" + TMP_CONFCACHE_DIR="${CONFCACHE:+${CONFCACHE_DIR:-${PORTAGE_TMPDIR}/confcache}}" + TMP_CONFCACHE_DIR="${TMP_CONFCACHE_DIR/ /\ }" + CONFCACHE_ARG="--confcache-dir" + local s + if [ -n "$CCACHE_DIR" ]; then + s="$CCACHE_DIR" + fi + if [ -n "$DISTCC_DIR" ]; then + s="${s:+${s}:}$DISTCC_DIR" + fi + if [ -n "$s" ]; then + CONFCACHE_ARG="--confcache-ignore $s $CONFCACHE_ARG" + fi + fi + else + CONFCACHE= + fi + + echo ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \ --prefix=${PREFIX}/usr \ --host=${CHOST} \ --mandir=${PREFIX}/usr/share/man \ @@ -638,7 +663,7 @@ econf() { "$@" \ ${LOCAL_EXTRA_ECONF} - if ! "${ECONF_SOURCE}/configure" \ + if ! ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \ --prefix=${PREFIX}/usr \ --host=${CHOST} \ --mandir=${PREFIX}/usr/share/man \ @@ -1284,6 +1309,16 @@ dyn_install() { die "There are ${UNSAFE} unsafe files. Portage will not install them." fi + if [[ -d ${D}/${D} ]] ; then + declare -i INSTALLTOD=0 + for i in $(find "${D}/${D}/"); do + echo "QA Notice: /${i##${D}/${D}} installed in \${D}/\${D}" + ((INSTALLTOD++)) + done + die "Aborting due to QA concerns: ${INSTALLTOD} files installed in ${D}/${D}" + unset INSTALLTOD + fi + # dumps perms to stdout. if error, no perms dumped. function stat_perms() { local f @@ -1363,11 +1398,11 @@ dyn_install() { if hasq multilib-strict ${FEATURES} && [ -x file -a -x find -a \ -n "${MULTILIB_STRICT_DIRS}" -a -n "${MULTILIB_STRICT_DENY}" ]; then - MULTILIB_STRICT_EXEMPT=${MULTILIB_STRICT_EXEMPT:-"(perl5|gcc|gcc-lib|debug)"} + MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT:-"(perl5|gcc|gcc-lib|debug)"} | sed -e 's:\([(|)]\):\\\1:g') for dir in ${MULTILIB_STRICT_DIRS}; do [ -d "${D}/${dir}" ] || continue - for file in $(find ${D}/${dir} -type f | @EGREP@ -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do - file ${file} | @EGREP@ -q "${MULTILIB_STRICT_DENY}" && die "File ${file} matches a file type that is not allowed in ${dir}" + for file in $(find ${D}/${dir} -type f | grep -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do + file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" && die "File ${file} matches a file type that is not allowed in ${dir}" done done fi diff --git a/bin/emerge b/bin/emerge index 9a943ca67..946f67624 100755 --- a/bin/emerge +++ b/bin/emerge @@ -3322,8 +3322,7 @@ else: if ("--pretend" in myopts) and not ("--fetchonly" in myopts or "--fetch-all-uri" in myopts): if ("--resume" in myopts): - ### Cut off the first element, since we aren't merging it #121106 - mydepgraph.display(portage.mtimedb["resume"]["mergelist"][1:]) + mydepgraph.display(portage.mtimedb["resume"]["mergelist"]) else: mydepgraph.display(mydepgraph.altlist()) else: diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 49034d007..fb9a89397 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -5,6 +5,14 @@ # Author: Karl Trygve Kalleberg # Rewritten from the old, Perl-based emerge-webrsync script +if [ -z "$PULLED_NICENESS" ]; then + PULLED_NICENESS="$(@PORTAGE_BASE@/bin/portageq envvar PORTAGE_NICENESS)" + if [ -n "$PULLED_NICENESS" ]; then + export PULLED_NICENESS + exec nice -n $PORTAGE_NICENESS "$0" "$@" + echo "failed pulling PORTAGE_NICENESS, disabling" + fi +fi GENTOO_MIRRORS="${GENTOO_MIRRORS} $(@PORTAGE_BASE@/bin/portageq gentoo_mirrors)" PORTDIR="$(@PORTAGE_BASE@/bin/portageq portdir)" FETCHCOMMAND="$(@PORTAGE_BASE@/bin/portageq envvar FETCHCOMMAND)" @@ -42,21 +50,29 @@ fi sync_local() { echo Syncing local tree... - if ! tar jxf $FILE; then - echo "Tar failed to extract the image. Please review the output." - echo "Executed command: tar jxf $FILE" - exit 1 + if type -p tarsync &> /dev/null; then + if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o root -g root -e /distfiles -e /packages -e /local; then + echo "tarsync failed; tarball is corrupt?" + exit 1; + fi + rm "${FILE}" + else + if ! tar jxf $FILE; then + echo "Tar failed to extract the image. Please review the output." + echo "Executed command: tar jxf $FILE" + exit 1 + fi + rm -f $FILE + # Make sure user and group file ownership is root + chown -R 0:0 portage + cd portage + rsync -av --progress --stats --delete --delete-after \ + --exclude='/distfiles' --exclude='/packages' \ + --exclude='/local' . ${PORTDIR%%/} + cd .. + echo "cleaning up" + rm -rf portage fi - rm -f $FILE - # Make sure user and group file ownership is root - chown -R 0:0 portage - cd portage - rsync -av --progress --stats --delete --delete-after \ - --exclude='/distfiles' --exclude='/packages' \ - --exclude='/local' . ${PORTDIR%%/} - cd .. - echo "cleaning up" - rm -rf portage echo "transferring metadata/cache" emerge metadata } diff --git a/bin/prepallinfo b/bin/prepallinfo index 7f587334b..f7787ea7a 100755 --- a/bin/prepallinfo +++ b/bin/prepallinfo @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallinfo,v 1.6 2004/10/04 13:56:50 vapier Exp $ -[ ! -d "${D}/usr/share/info" ] && exit 0 +[[ ! -d ${D}/usr/share/info ]] && exit 0 echo "info:" -prepinfo +exec prepinfo diff --git a/bin/prepallman b/bin/prepallman index 418cc5f6f..f9235ce68 100755 --- a/bin/prepallman +++ b/bin/prepallman @@ -3,10 +3,14 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallman,v 1.10 2004/10/04 13:56:50 vapier Exp $ +ret=0 + echo "man:" for x in "${D}"/opt/*/man "${D}"/usr/share/man "${D}"/usr/local/man "${D}"/usr/X11R6/man ; do - if [ -d "${x}" ] - then + if [[ -d ${x} ]] ; then prepman "`echo "${x}" | sed -e "s:${D}::" -e "s:/man[/]*$::"`" + ((ret+=$?)) fi done + +exit ${ret} diff --git a/bin/prepallstrip b/bin/prepallstrip index 3be06084e..e1958a58c 100755 --- a/bin/prepallstrip +++ b/bin/prepallstrip @@ -3,9 +3,12 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/prepallstrip,v 1.12 2004/10/04 13:56:50 vapier Exp $ -if [ "${FEATURES//*nostrip*/true}" == "true" ] || [ "${RESTRICT//*nostrip*/true}" == "true" ] ; then +if [[ " ${FEATURES} " == *" nostrip "* ]] || \ + [[ " ${RESTRICT} " == *" nostrip "* ]] || \ + [[ " ${RESTRICT} " == *" strip "* ]] +then exit 0 fi echo "prepallstrip:" -prepstrip "${D}" +exec prepstrip "${D}" diff --git a/cnf/make.conf b/cnf/make.conf index 9c23f09d0..0e9388fe0 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -265,6 +265,8 @@ CHOST="i686-pc-linux-gnu" # 'buildpkg' causes binary packages to be created of all packages that # are being merged. # 'ccache' enables ccache support via CC. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. diff --git a/cnf/make.conf.alpha b/cnf/make.conf.alpha index b08342ba2..ece799831 100644 --- a/cnf/make.conf.alpha +++ b/cnf/make.conf.alpha @@ -254,6 +254,8 @@ CFLAGS="-mcpu=ev5 -O3 -pipe " # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.amd64 b/cnf/make.conf.amd64 index caff3c59e..f5ee4b048 100644 --- a/cnf/make.conf.amd64 +++ b/cnf/make.conf.amd64 @@ -265,6 +265,8 @@ CHOST="x86_64-pc-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.arm b/cnf/make.conf.arm index 34ca3990a..1c1c6c20f 100644 --- a/cnf/make.conf.arm +++ b/cnf/make.conf.arm @@ -262,6 +262,8 @@ CHOST="armv4l-unknown-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.hppa b/cnf/make.conf.hppa index 9241bcc3b..eb526e65f 100644 --- a/cnf/make.conf.hppa +++ b/cnf/make.conf.hppa @@ -271,6 +271,8 @@ CHOST="hppa-unknown-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.ia64 b/cnf/make.conf.ia64 index 7de834833..3f6808b83 100644 --- a/cnf/make.conf.ia64 +++ b/cnf/make.conf.ia64 @@ -233,6 +233,8 @@ CHOST="ia64-unknown-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.mips b/cnf/make.conf.mips index c0834b019..dc71e3309 100644 --- a/cnf/make.conf.mips +++ b/cnf/make.conf.mips @@ -251,6 +251,8 @@ CHOST="mips-unknown-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.ppc b/cnf/make.conf.ppc index 922536f6d..6c38b1028 100644 --- a/cnf/make.conf.ppc +++ b/cnf/make.conf.ppc @@ -291,6 +291,8 @@ CHOST="powerpc-unknown-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.ppc64 b/cnf/make.conf.ppc64 index 2da0e6049..a636928a7 100644 --- a/cnf/make.conf.ppc64 +++ b/cnf/make.conf.ppc64 @@ -269,6 +269,8 @@ CHOST="powerpc64-unknown-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.s390 b/cnf/make.conf.s390 index ad8097d2e..fe2f8bcce 100644 --- a/cnf/make.conf.s390 +++ b/cnf/make.conf.s390 @@ -233,6 +233,8 @@ CHOST="s390-ibm-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.sparc b/cnf/make.conf.sparc index e1ab499d6..f58ba4bb6 100644 --- a/cnf/make.conf.sparc +++ b/cnf/make.conf.sparc @@ -269,6 +269,8 @@ # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/cnf/make.conf.x86 b/cnf/make.conf.x86 index d98231eda..98ba6a957 100644 --- a/cnf/make.conf.x86 +++ b/cnf/make.conf.x86 @@ -268,6 +268,8 @@ CHOST="i686-pc-linux-gnu" # 'collision-protect' # prevents packages from overwriting files that are owned by # another package or by no package at all. +# 'confcache' enable confcache support; speeds up autotool based configure +# calls # 'cvs' causes portage to enable all cvs features (commits, adds), # and to apply all USE flags in SRC_URI for digests -- for # developers only. diff --git a/man/make.conf.5 b/man/make.conf.5 index f955d2b8e..fdcbd2d8c 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -129,6 +129,10 @@ Enable portage support for the ccache package. If the ccache dir is not present in the user's environment, then portage will default to ${PORTAGE_TMPDIR}/ccache (with \fIuserpriv\fR) and to /root/.ccache otherwise. .TP +.B confcache +Enable confcache support; global configure caching, speeds up autotool based configure +calls. +.TP .B collision\-protect A QA\-feature to ensure that a package doesn't overwrite files it doesn't own. .TP diff --git a/pym/portage.py b/pym/portage.py index 25ae6334a..f12209525 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -462,7 +462,7 @@ def elog_process(cpv, mysettings): # shortcut for packages without any messages if len(mylogfiles) == 0: return - # exploit listdir() file order so we process log entries in cronological order + # exploit listdir() file order so we process log entries in chronological order mylogfiles.reverse() mylogentries = {} for f in mylogfiles: @@ -2669,7 +2669,38 @@ def doebuild(myebuild,mydo,myroot,mysettings,debug=0,listonly=0,fetchonly=0,clea print "!!! Perhaps: rm -Rf",mysettings["BUILD_PREFIX"] print "!!!",str(e) return 1 - + try: + if "confcache" in features: + if not mysettings.has_key("CONFCACHE_DIR"): + mysettings["CONFCACHE_DIR"] = os.path.join(mysettings["PORTAGE_TMPDIR"], "confcache") + if not os.path.exists(mysettings["CONFCACHE_DIR"]): + if not os.getuid() == 0: + # we're boned. + features.remove("confcache") + mysettings["FEATURES"] = " ".join(features) + else: + os.makedirs(mysettings["CONFCACHE_DIR"], mode=0775) + os.chown(mysettings["CONFCACHE_DIR"], -1, portage_gid) + else: + st = os.stat(mysettings["CONFCACHE_DIR"]) + if not (st.st_mode & 07777) == 0775: + os.chmod(mysettings["CONFCACHE_DIR"], 0775) + if not st.st_gid == portage_gid: + os.chown(mysettings["CONFCACHE_DIR"], -1, portage_gid) + + # check again, since it may have been disabled. + if "confcache" in features: + for x in listdir(mysettings["CONFCACHE_DIR"]): + p = os.path.join(mysettings["CONFCACHE_DIR"], x) + st = os.stat(p) + if not (st.st_mode & 07777) & 07600 == 0600: + os.chmod(p, (st.st_mode & 0777) | 0600) + if not st.st_gid == portage_gid: + os.chown(p, -1, portage_gid) + + except OSError, e: + print "!!! Failed resetting perms on confcachedir %s" % mysettings["CONFCACHE_DIR"] + return 1 #try: # mystat=os.stat(mysettings["CCACHE_DIR"]) # if (mystat[stat.ST_GID]!=portage_gid) or ((mystat[stat.ST_MODE]&02070)!=02070): -- 2.26.2