Source-Changes-HG archive

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

[src/netbsd-2-0]: src/distrib/sets Pullup rev 1.17 (requested by lukem in tic...



details:   https://anonhg.NetBSD.org/src/rev/16833fcc6413
branches:  netbsd-2-0
changeset: 560475:16833fcc6413
user:      jmc <jmc%NetBSD.org@localhost>
date:      Wed Apr 21 03:22:28 2004 +0000

description:
Pullup rev 1.17 (requested by lukem in ticket #166)

* Support '-x xsrcdir' to tar up xsrcdir as xsrc.tgz, with the
  contents of the tarfile being relative to xsrcdir and
  prefixed with 'usr/xsrc'
* Convert to getopts a la the other scripts in this directory
* if ${MKX11} != no, call makesrctars with '-x ${X11SRCDIR}'

diffstat:

 distrib/sets/makesrctars |  63 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 55 insertions(+), 8 deletions(-)

diffs (109 lines):

diff -r 9c9b48f728b7 -r 16833fcc6413 distrib/sets/makesrctars
--- a/distrib/sets/makesrctars  Wed Apr 21 03:20:34 2004 +0000
+++ b/distrib/sets/makesrctars  Wed Apr 21 03:22:28 2004 +0000
@@ -1,16 +1,46 @@
 #! /bin/sh
 #
-#      $NetBSD: makesrctars,v 1.15.2.1 2004/04/21 03:20:00 jmc Exp $
+#      $NetBSD: makesrctars,v 1.15.2.2 2004/04/21 03:22:28 jmc Exp $
 #
 # makesrctars srcdir setdir
 #      Create source tarballs in setdir from the source under srcdir.
 #
 
+prog=${0##*/}
+
+# set defaults
 : ${CKSUM=cksum}
+: ${PAX=pax}
+
+xsrcdir=
 
 GZIP=-9
 export GZIP
 
+usage()
+{
+       cat 1>&2 <<USAGE
+Usage: ${prog} [-x xsrcdir] srcdir setdir
+       -x xsrcdir      build xsrc.tgz from xsrcdir
+       srcdir          location of sources
+       setdir          where to write the .tgz files to
+USAGE
+       exit 1
+}
+
+# handle args
+while getopts x: ch; do
+       case ${ch} in
+       x)      
+               xsrcdir=${OPTARG}
+               ;;
+       *)
+               usage
+               ;;
+       esac
+done
+shift $((${OPTIND} - 1))
+
 if [ $# -ne 2 ]; then
        echo "Usage: $0 srcdir setdir"
        exit 1
@@ -23,12 +53,6 @@
        exit 1
 fi
 
-if ! cd "${srcdir}"; then
-       echo "Can't chdir to ${srcdir}"
-       exit 1
-fi
-
-
 makeset()
 {
        set=$1.tgz
@@ -38,13 +62,23 @@
        find -s $* \
            ! \( \( -name obj -o -name 'obj.*' \) \( -type l -o -type d \) \) \
            -print \
-           | pax -w -d -s'|^\.|usr/src|' \
+           | ${PAX} -w -d -s'|^\.|'${srcprefix}'|' \
            | gzip \
            > "${setdir}/${set}"
        set +f
 }
 
 
+# create (base)src sets
+#
+
+if ! cd "${srcdir}"; then
+       echo "Can't chdir to ${srcdir}"
+       exit 1
+fi
+
+srcprefix=usr/src
+
 makeset src .                                          \
                ! \( \( -path ./gnu                     \
                     -o -path ./share                   \
@@ -61,6 +95,19 @@
 
 makeset sharesrc ./share
 
+
+# create xsrc sets
+#
+if [ -n "${xsrcdir}" ]; then
+       if ! cd "${xsrcdir}"; then
+               echo "Can't chdir to ${xsrcdir}"
+               exit 1
+       fi
+       srcprefix=usr/xsrc
+       makeset xsrc .
+fi
+
+
 echo "Creating checksum files"
 (cd ${setdir}
        ${CKSUM} -o1 *.tgz > BSDSUM



Home | Main Index | Thread Index | Old Index