pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_comp Update to 1.17:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/32e04b4b3e00
branches:  trunk
changeset: 469274:32e04b4b3e00
user:      jmmv <jmmv%pkgsrc.org@localhost>
date:      Sat Feb 21 13:08:31 2004 +0000

description:
Update to 1.17:
- Recognize the PKGSRC_COMPILER variable and set it automatically in mk.conf.
- Add the REAL_CCACHE variable: if set, the directory pointed by it will be
  null-mounted inside the chroot in a place known by ccache to store the
  cache.  This is useful to keep it across rebuilds of the sandbox.
  Idea suggested by gavan@.

diffstat:

 pkgtools/pkg_comp/Makefile          |   4 +-
 pkgtools/pkg_comp/files/pkg_comp.8  |  20 ++++++++++++++-
 pkgtools/pkg_comp/files/pkg_comp.sh |  45 ++++++++++++++++++++++++++++++++++--
 3 files changed, 62 insertions(+), 7 deletions(-)

diffs (190 lines):

diff -r cf137d4da207 -r 32e04b4b3e00 pkgtools/pkg_comp/Makefile
--- a/pkgtools/pkg_comp/Makefile        Sat Feb 21 12:31:38 2004 +0000
+++ b/pkgtools/pkg_comp/Makefile        Sat Feb 21 13:08:31 2004 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.22 2004/02/11 22:53:18 jmmv Exp $
+# $NetBSD: Makefile,v 1.23 2004/02/21 13:08:31 jmmv Exp $
 
-DISTNAME=      pkg_comp-1.16
+DISTNAME=      pkg_comp-1.17
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r cf137d4da207 -r 32e04b4b3e00 pkgtools/pkg_comp/files/pkg_comp.8
--- a/pkgtools/pkg_comp/files/pkg_comp.8        Sat Feb 21 12:31:38 2004 +0000
+++ b/pkgtools/pkg_comp/files/pkg_comp.8        Sat Feb 21 13:08:31 2004 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_comp.8,v 1.19 2004/01/23 09:48:53 jmmv Exp $
+.\" $NetBSD: pkg_comp.8,v 1.20 2004/02/21 13:08:31 jmmv Exp $
 .\"
 .\" pkg_comp - Build packages inside a clean chroot environment
 .\" Copyright (c) 2002, 2003, 2004 Julio M. Merino Vidal <jmmv%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 23, 2004
+.Dd February 21, 2004
 .Dt PKG_COMP 8
 .Os
 .Sh NAME
@@ -240,6 +240,16 @@
 Base directory of configuration files.
 Defaults to
 .Pa /usr/pkg/etc .
+.It PKGSRC_COMPILER
+List of values specifying the chain of compilers to invoke when building
+packages.
+Defaults to
+.Ql gcc .
+If you are defining
+.Va REAL_CCACHE ,
+remember to prepend
+.Ql ccache
+to this variable's value.
 .It PKGVULNDIR
 Directory where the
 .Pa vulnerabilities
@@ -346,6 +356,12 @@
 Be sure to check that NO file systems are mounted when issuing a
 .Sy removeroot .
 .Bl -tag -width indent
+.It REAL_CCACHE
+Specifies where a global ccache directory resides in the real system.
+Defaults to nothing, which disables the global cache.
+Keep in mind that this is specially useful to keep the cache across
+rebuilds of the sandbox, but be very careful if you plan to share a
+cache directory between different sandboxes, as this can lead to problems.
 .It REAL_DISTFILES
 Specifies where distfiles reside in the real system.
 Defaults to
diff -r cf137d4da207 -r 32e04b4b3e00 pkgtools/pkg_comp/files/pkg_comp.sh
--- a/pkgtools/pkg_comp/files/pkg_comp.sh       Sat Feb 21 12:31:38 2004 +0000
+++ b/pkgtools/pkg_comp/files/pkg_comp.sh       Sat Feb 21 13:08:31 2004 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: pkg_comp.sh,v 1.18 2004/02/13 23:52:07 snj Exp $
+# $NetBSD: pkg_comp.sh,v 1.19 2004/02/21 13:08:31 jmmv Exp $
 #
 # pkg_comp - Build packages inside a clean chroot environment
 # Copyright (c) 2002, 2003, 2004 Julio M. Merino Vidal <jmmv%NetBSD.org@localhost>
@@ -42,14 +42,14 @@
 _MKCONF_VARS="WRKDIR_BASENAME MKOBJDIRS BSDSRCDIR WRKOBJDIR DISTDIR PACKAGES \
               PKG_DEVELOPER CLEANDEPENDS LOCALBASE PKG_SYSCONFBASE \
               CFLAGS CPPFLAGS CXXFLAGS USE_AUDIT_PACKAGES PKGVULNDIR \
-              USE_XPKGWEDGE"
+              USE_XPKGWEDGE PKGSRC_COMPILER"
 
 _TEMPLATE_VARS="DESTDIR ROOTSHELL COPYROOTCFG BUILD_TARGET DISTRIBDIR SETS \
                 SETS_X11 REAL_SRC REAL_SRC_OPTS REAL_PKGSRC \
                 REAL_PKGSRC_OPTS REAL_DISTFILES REAL_DISTFILES_OPTS \
                 REAL_PACKAGES REAL_PACKAGES_OPTS REAL_PKGVULNDIR \
                 NETBSD_RELEASE MOUNT_HOOKS UMOUNT_HOOKS SYNC_UMOUNT \
-                AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES"
+                AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES REAL_CCACHE"
 
 _BUILD_RESUME=
 
@@ -96,6 +96,7 @@
     : ${USE_AUDIT_PACKAGES:=yes}
     : ${PKGVULNDIR:=/usr/pkg/share}
     : ${USE_XPKGWEDGE:=yes}
+    : ${PKGSRC_COMPILER:=gcc}
 
     # Default values for global variables used in the script.
     : ${DESTDIR:=/var/chroot/pkg_comp/default}
@@ -119,6 +120,7 @@
     : ${MOUNT_HOOKS:=}
     : ${UMOUNT_HOOKS:=}
     : ${SYNC_UMOUNT:=no}
+    : ${REAL_CCACHE:=}
 
     if [ -n "${MAKE_PACKAGES}" ]; then
         warn "MAKE_PACKAGES is deprecated; use {AUTO,BUILD}_PACKAGES instead."
@@ -264,6 +266,15 @@
         mount $REAL_PACKAGES_OPTS $REAL_PACKAGES $DESTDIR/pkg_comp/packages
     fi
 
+    if [ -n "${REAL_CCACHE}" ]; then
+        if [ ! -d "${REAL_CCACHE}" ]; then
+            echo " failed."
+            fsumount
+            err "REAL_CCACHE ${REAL_CCACHE} disappeared"
+        fi
+        mount -t null -o rw ${REAL_CCACHE} ${DESTDIR}/pkg_comp/ccache
+    fi
+
     touch $fsstate
 
     for h in ${MOUNT_HOOKS}; do
@@ -314,6 +325,10 @@
         umount $DESTDIR/pkg_comp/packages || fsfailed=yes
     fi
 
+    if [ -n "${REAL_CCACHE}" -a -d "${REAL_CCACHE}" ]; then
+        umount ${DESTDIR}/pkg_comp/ccache || fsfailed=yes
+    fi
+
     if [ "$SYNC_UMOUNT" != "no" ]; then
         printf "Syncing: 1"
         sync ; sleep 1
@@ -416,6 +431,13 @@
         err "REAL_PACKAGES $REAL_PACKAGES does not exist"
     fi
 
+    if echo ${PKGSRC_COMPILER} | grep ccache >/dev/null 2>&1 && \
+        [ -z "${REAL_CCACHE}" ]; then
+        warn "PKGSRC_COMPILER contains 'ccache' but REAL_CCACHE is unset"
+    elif [ -n "${REAL_CCACHE}" -a ! -d "${REAL_CCACHE}" ]; then
+        err "REAL_CCACHE ${REAL_CCACHE} does not exist"
+    fi
+
     # Check for required directories.
     if [ ! -d $DISTRIBDIR ]; then
         err "DISTRIBDIR $DISTRIBDIR does not exist"
@@ -457,6 +479,11 @@
     if [ "$COPYROOTCFG" = "yes" ]; then
         cp /root/.* $DESTDIR/root >/dev/null 2>&1
     fi
+    if [ -n "${REAL_CCACHE}" ]; then
+        # This is a workaround for older versions of ccache.mk that do not
+        # pass the CCACHE_DIR variable down to ccache.
+        ( cd ${DESTDIR}/root && ln -fs ../pkg_comp/ccache .ccache )
+    fi
 
     echo "Setting up initial configuration..."
 
@@ -466,6 +493,7 @@
     mkdir -p $DESTDIR/pkg_comp/packages
     mkdir -p $DESTDIR/pkg_comp/tmp
     mkdir -p $DESTDIR/pkg_comp/obj/pkgsrc
+    [ -n "${REAL_CCACHE}" ] && mkdir -p ${DESTDIR}/pkg_comp/ccache
     ( cd $DESTDIR && ln -s pkg_comp p )
 
     # Set sh configuration
@@ -487,6 +515,7 @@
     # signals to umount them.
     trap "echo \"*** Process aborted ***\" ; fsumount ; exit 1" INT QUIT
 
+    makeroot_digest
     makeroot_libkver
 
     if [ "$USE_GCC3" = "yes" ]; then
@@ -556,6 +585,16 @@
     fi
 }
 
+# makeroot_digest
+#
+#   Ensure digest is always installed, specially because PKGSRC_COMPILER
+#   may contain 'ccache' or 'distcc'.
+#
+makeroot_digest()
+{
+    ( PKGSRC_COMPILER=; export PKGSRC_COMPILER; pkg_build pkgtools/digest )
+}
+
 # makeroot_libkver
 #
 #   If NETBSD_RELEASE is set to a version string, installs libkver



Home | Main Index | Thread Index | Old Index