Restructure how makesrctars works so it spits out source balls that look like
they would from a release (files owned by root:wsrc, perms set, etc)
This commit is contained in:
parent
d63acabb28
commit
4afc9e5b49
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.47 2005/10/06 02:22:11 jmc Exp $
|
||||
# $NetBSD: Makefile,v 1.48 2005/10/07 20:00:54 jmc Exp $
|
||||
|
||||
# The `all' target must appear before bsd.own.mk is pulled in.
|
||||
all:
|
||||
|
@ -17,10 +17,10 @@ SETSCMD= cd ${.CURDIR} && \
|
|||
|
||||
.if ${MKX11} != "no"
|
||||
MAKEFLIST_FLAGS= -b
|
||||
MAKESRCTARS_FLAGS= -x ${X11SRCDIR}
|
||||
MAKESRCTARS_FLAGS= -x ${X11SRCDIR} -N ${NETBSDSRCDIR}/etc
|
||||
.else
|
||||
MAKEFLIST_FLAGS=
|
||||
MAKESRCTARS_FLAGS=
|
||||
MAKESRCTARS_FLAGS= -N ${NETBSDSRCDIR}/etc
|
||||
.endif
|
||||
|
||||
.if !defined(MAKETARSETS)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# $NetBSD: makesrctars,v 1.21 2005/10/07 03:42:47 jmc Exp $
|
||||
# $NetBSD: makesrctars,v 1.22 2005/10/07 20:00:54 jmc Exp $
|
||||
#
|
||||
# makesrctars srcdir setdir
|
||||
# Create source tarballs in setdir from the source under srcdir.
|
||||
|
@ -10,6 +10,7 @@ prog=${0##*/}
|
|||
|
||||
# set defaults
|
||||
: ${CKSUM=cksum}
|
||||
: ${MTREE=mtree}
|
||||
: ${PAX=pax}
|
||||
|
||||
xsrcdir=
|
||||
|
@ -20,7 +21,9 @@ export GZIP
|
|||
usage()
|
||||
{
|
||||
cat 1>&2 <<USAGE
|
||||
Usage: ${prog} [-x xsrcdir] srcdir setdir
|
||||
Usage: ${prog} [-N password/group dir] [-x xsrcdir] srcdir setdir
|
||||
-N dir location which contains master.passwd and group files
|
||||
(defaults to ${srcdir}/etc)
|
||||
-x xsrcdir build xsrc.tgz from xsrcdir
|
||||
srcdir location of sources
|
||||
setdir where to write the .tgz files to
|
||||
|
@ -28,12 +31,16 @@ USAGE
|
|||
exit 1
|
||||
}
|
||||
|
||||
PASSWD=
|
||||
# handle args
|
||||
while getopts x: ch; do
|
||||
while getopts N:x: ch; do
|
||||
case ${ch} in
|
||||
x)
|
||||
xsrcdir=${OPTARG}
|
||||
;;
|
||||
N)
|
||||
PASSWD=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
|
@ -42,11 +49,11 @@ done
|
|||
shift $((${OPTIND} - 1))
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 srcdir setdir"
|
||||
exit 1
|
||||
usage
|
||||
fi
|
||||
srcdir=$1
|
||||
setdir=$2
|
||||
: ${PASSWD:=${srcdir}/etc}
|
||||
|
||||
if [ ! -d "${setdir}" ]; then
|
||||
echo "${setdir} is not a directory"
|
||||
|
@ -54,20 +61,32 @@ if [ ! -d "${setdir}" ]; then
|
|||
fi
|
||||
|
||||
makeset()
|
||||
{
|
||||
{(
|
||||
set=$1.tgz
|
||||
shift
|
||||
dir=$1
|
||||
shift
|
||||
echo "Creating ${set}"
|
||||
if [ "${dir}" != "." ]; then
|
||||
cd $dir
|
||||
srcprefix="${srcprefix}/${dir}"
|
||||
fi
|
||||
# Gets rid of any obj dirs and things below it
|
||||
echo "obj" > /tmp/in$$
|
||||
egrep=$*
|
||||
if [ "$egrep" = "" ]; then
|
||||
egrep='.'
|
||||
fi
|
||||
set -f
|
||||
find $* \
|
||||
! \( \( -name obj -o -name 'obj.*' \) \( -type l -o -type d \) -prune \) \
|
||||
-print \
|
||||
| sort \
|
||||
| ${PAX} -w -d -s'|^\.|'${srcprefix}'|' \
|
||||
| gzip \
|
||||
> "${setdir}/${set}"
|
||||
set +f
|
||||
}
|
||||
${MTREE} -c -X /tmp/in$$ | ${MTREE} -C -k type | \
|
||||
egrep -v 'type=link' | egrep $egrep |
|
||||
sed -e 's:type=file:& mode=0664:' \
|
||||
-e 's:type=dir:& mode=0775:' \
|
||||
-e 's:$: uname=root gname=wsrc:' | \
|
||||
${PAX} -M -N ${PASSWD} -w -d -s'|^\.|'${srcprefix}'|' | \
|
||||
gzip > "${setdir}/${set}"
|
||||
rm -f /tmp/in$$
|
||||
)}
|
||||
|
||||
|
||||
# create (base)src sets
|
||||
|
@ -79,21 +98,15 @@ if ! cd "${srcdir}"; then
|
|||
fi
|
||||
|
||||
srcprefix=usr/src
|
||||
export setdir MTREE PAX CKSUM GZIP PASSWD srcprefix
|
||||
|
||||
makeset src . \
|
||||
! \( \( -path ./gnu \
|
||||
-o -path ./share \
|
||||
-o -path ./sys \
|
||||
-o -path ./usr.bin/config \
|
||||
\) -prune \)
|
||||
makeset src . -v '^.\/gnu|^.\/share|^.\/sys|^.\/usr\.bin\/config'
|
||||
|
||||
makeset gnusrc ./gnu
|
||||
makeset gnusrc gnu
|
||||
|
||||
makeset syssrc ./sys ./usr.bin/config \
|
||||
! \( -path ./sys/arch/\*/compile/\* -type d \
|
||||
! -name CVS -prune \)
|
||||
makeset syssrc . -e '^\..type=dir|^.\/sys|^\.\/usr\.bin.type=dir|^.\/usr\.bin\/config'
|
||||
|
||||
makeset sharesrc ./share
|
||||
makeset sharesrc share
|
||||
|
||||
|
||||
# create xsrc sets
|
||||
|
|
Loading…
Reference in New Issue