Source-Changes-HG archive

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

[src/trunk]: src/distrib/sets makesrctars:



details:   https://anonhg.NetBSD.org/src/rev/5f08954b2376
branches:  trunk
changeset: 565767:5f08954b2376
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Apr 20 06:36:34 2004 +0000

description:
makesrctars:
* 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

Makefile
* if ${MKX11} != no, call makesrctars with '-x ${X11SRCDIR}'

diffstat:

 distrib/sets/Makefile    |   7 +++-
 distrib/sets/makesrctars |  63 +++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 60 insertions(+), 10 deletions(-)

diffs (139 lines):

diff -r a4301b305709 -r 5f08954b2376 distrib/sets/Makefile
--- a/distrib/sets/Makefile     Tue Apr 20 05:37:15 2004 +0000
+++ b/distrib/sets/Makefile     Tue Apr 20 06:36:34 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.44 2004/03/06 16:12:06 heas Exp $
+#      $NetBSD: Makefile,v 1.45 2004/04/20 06:36:34 lukem Exp $
 
 # The `all' target must appear before bsd.own.mk is pulled in.
 all:
@@ -17,8 +17,10 @@
 
 .if ${MKX11} != "no"
 MAKEFLIST_FLAGS=       -b
+MAKESRCTARS_FLAGS=     -x ${X11SRCDIR}
 .else
 MAKEFLIST_FLAGS=
+MAKESRCTARS_FLAGS=
 .endif
 
 .if !defined(MAKETARSETS)
@@ -104,7 +106,8 @@
 
 makesrctars: .PRECIOUS .PHONY check_RELEASEDIR
        mkdir -p ${SOURCETARDIR}
-       ${SETSCMD} ./makesrctars ${NETBSDSRCDIR} ${SOURCETARDIR}
+       ${SETSCMD} ./makesrctars ${MAKESRCTARS_FLAGS} \
+           ${NETBSDSRCDIR} ${SOURCETARDIR}
 
 
 makesums: .PRECIOUS .PHONY check_RELEASEDIR .WAIT \
diff -r a4301b305709 -r 5f08954b2376 distrib/sets/makesrctars
--- a/distrib/sets/makesrctars  Tue Apr 20 05:37:15 2004 +0000
+++ b/distrib/sets/makesrctars  Tue Apr 20 06:36:34 2004 +0000
@@ -1,16 +1,46 @@
 #! /bin/sh
 #
-#      $NetBSD: makesrctars,v 1.16 2004/04/20 03:40:45 lukem Exp $
+#      $NetBSD: makesrctars,v 1.17 2004/04/20 06:36:35 lukem 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