confcache, baby.
authorBrian Harring <ferringb@gentoo.org>
Fri, 3 Feb 2006 05:08:20 +0000 (05:08 -0000)
committerBrian Harring <ferringb@gentoo.org>
Fri, 3 Feb 2006 05:08:20 +0000 (05:08 -0000)
svn path=/main/trunk/; revision=2632

NEWS
bin/ebuild.sh
pym/portage.py

diff --git a/NEWS b/NEWS
index ca85bd313d13f2779b19accee54c8937a0024a16..7503e007ba9ae16a64cbbbb53ccbe46d4b6794bd 100644 (file)
--- 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)
index 1d5c6f90c47724f49eabda03834d93368ba87bda..a89b530c99beb0ee0adb0f35576dc0e0bdb77b84 100755 (executable)
@@ -493,7 +493,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=/usr \
                        --host=${CHOST} \
                        --mandir=/usr/share/man \
@@ -504,7 +529,7 @@ econf() {
                        "$@" \
                        ${LOCAL_EXTRA_ECONF}
 
-               if ! "${ECONF_SOURCE}/configure" \
+               if ! ${CONFCACHE} ${CONFCACHE_ARG} ${TMP_CONFCACHE_DIR} "${ECONF_SOURCE}/configure" \
                        --prefix=/usr \
                        --host=${CHOST} \
                        --mandir=/usr/share/man \
index b717fe0090b4c4bec2071a164adb10a328e115e3..49fc4413c9254fd1835c19696276f95424a06674 100644 (file)
@@ -2666,7 +2666,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):