mirror of
https://github.com/AdaCore/PolyORB.git
synced 2026-02-12 13:01:15 -08:00
[Imported from Perforce change 8598 at 2006-12-01 20:36:06] Subversion-branch: /trunk/polyorb Subversion-revision: 36175
209 lines
4.8 KiB
Bash
209 lines
4.8 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $Id: //droopi/main/utils/make_distrib#23 $
|
|
#
|
|
# This script builds a compressed archive suitable for distribution.
|
|
#
|
|
# Usage: make_distrib [-s] [-k?|-prcs|-n|-c] tag dir
|
|
#
|
|
# -s : suppress automatic version numbering and get info from VERSION.INFO
|
|
# -k? : override CVS keywords expansion
|
|
# -prcs : use prcs to extract files
|
|
# -p4 : use Perforce to extract files
|
|
# -n : assume a checkout has already been done in dir
|
|
# -c : assume current directory can be used as source
|
|
# -b branch : use that Perforce branch
|
|
# tag : CVS or prcs tag or branch
|
|
# dir : the distribution will unpack in directory <dir> and will be
|
|
# named <dir>.tar.gz
|
|
#
|
|
# The VERSION.INFO file will be used to substitute some variables in files
|
|
# such as README, etc.
|
|
#
|
|
# The file MANIFEST contains the list of files to be included in this
|
|
# archive, one file per line.
|
|
#
|
|
|
|
prcs=false
|
|
perforce=false
|
|
kk=
|
|
nocheckout=false
|
|
no_implicit_version=false
|
|
|
|
###################################################
|
|
# Usage information
|
|
###################################################
|
|
|
|
usage() {
|
|
echo "Usage: $0 [-kK] [-prcs|-p4] [-bBRANCH] -[ncs] tag dir"
|
|
exit 1
|
|
}
|
|
|
|
set -e
|
|
|
|
###################################################
|
|
# Parse commande line
|
|
###################################################
|
|
|
|
while getopts k:p:nscb: opt; do
|
|
case "$opt" in
|
|
k) kk="-k$OPTARG" ;;
|
|
p)
|
|
case "$OPTARG" in
|
|
4) perforce=true ;;
|
|
rcs) prcs=true ;;
|
|
*) usage ;;
|
|
esac
|
|
;;
|
|
s) no_implicit_version=true ;;
|
|
b) branch="$OPTARG" ;;
|
|
n) nocheckout=true;;
|
|
c) nocheckout=true;;
|
|
*) usage ;;
|
|
esac
|
|
done
|
|
|
|
shift `expr $OPTIND - 1`
|
|
|
|
if [ $# != 2 ]; then
|
|
usage
|
|
fi
|
|
|
|
tag=$1
|
|
dir=$2
|
|
|
|
###################################################
|
|
# Delete previous temporary files
|
|
###################################################
|
|
|
|
prev=`pwd`
|
|
tmp=${TMPDIR-/var/tmp}/make_distrib.$$
|
|
mkdir -p ${tmp}/${dir}
|
|
trap "cd /; rm -fr ${tmp}" 0
|
|
|
|
###################################################
|
|
# Retrieve all files in repository
|
|
###################################################
|
|
|
|
# pcrs
|
|
|
|
if $prcs; then
|
|
name=`echo *.prj | sed -e 's/\.prj//'`
|
|
echo Extracting module ${name} from prcs using tag ${tag}
|
|
cd ${tmp}/${dir}
|
|
prcs checkout -r${tag} ${name}
|
|
|
|
# Perforce
|
|
|
|
elif $perforce; then
|
|
if [ -n "${P4CONFIG}" -a -r "./${P4CONFIG}" ]; then
|
|
. "./${P4CONFIG}"
|
|
export P4USER P4PASSWD P4PORT
|
|
fi
|
|
if [ "${branch}" = "" ]; then
|
|
view_root=`p4 files MANIFEST | sed 's,/MANIFEST#.*$,,'`
|
|
else
|
|
view_root=//droopi/${branch}
|
|
fi
|
|
cd ${tmp}/${dir}
|
|
tmp=`/bin/pwd`
|
|
client=make_distrib_$$
|
|
(cat <<__EOF__
|
|
Client: $client
|
|
Root: ${tmp}
|
|
Options: allwrite clobber compress
|
|
View:
|
|
__EOF__
|
|
p4 print -q ${view_root}/MANIFEST | \
|
|
sed "s,.*, ${view_root}/& //${client}/&,") | \
|
|
p4 client -i
|
|
P4CLIENT=${client}; export P4CLIENT
|
|
set +e
|
|
case "${tag}" in
|
|
head|HEAD) tagsep=# ;;
|
|
*) tagsep=@ ;;
|
|
esac
|
|
(unset PWD; p4 sync ...${tagsep}${tag})
|
|
rc=$?
|
|
set -e
|
|
p4 client -d ${client}
|
|
if [ $rc != 0 ]; then
|
|
exit $rc
|
|
fi
|
|
|
|
# Use current directory
|
|
|
|
elif $usercurrent; then
|
|
tar cf - . | (cd $tmp/$dir && tar xpBf -)
|
|
cd $tmp/$dir
|
|
|
|
# Do no checkout
|
|
|
|
elif $nocheckout; then
|
|
cd ${dir}
|
|
|
|
# CVS
|
|
|
|
else
|
|
root=`cat CVS/Root`
|
|
trunc_root=`echo ${root} | sed -e 's/^.*://'`
|
|
name=`sed -e "s,${trunc_root}/,," < CVS/Repository`
|
|
echo Extracting module ${name} from ${root} using tag ${tag}
|
|
cd ${tmp}
|
|
cvs -d ${root} co ${kk} -r ${tag} -d ${dir} ${name}
|
|
cd ${dir}
|
|
fi
|
|
|
|
###################################################
|
|
# Update VERSION in all files
|
|
###################################################
|
|
|
|
if [ -f utils/VERSION.INFO ]; then
|
|
echo "Calling version file, then deleting it"
|
|
if $no_implicit_version; then
|
|
echo "(with no implicit version information)"
|
|
sh utils/VERSION.INFO
|
|
else
|
|
echo "(with version information derived from ${dir})"
|
|
sh utils/VERSION.INFO ${dir}
|
|
fi
|
|
rm -f utils/VERSION.INFO
|
|
else
|
|
echo "WARNING: unable to locate VERSION.INFO in directory utils"
|
|
fi
|
|
|
|
###################################################
|
|
# Generating *.in files
|
|
###################################################
|
|
|
|
echo Generating auto-generated files
|
|
if [ -f support/reconfig ]
|
|
then
|
|
sh support/reconfig -w
|
|
fi
|
|
|
|
###################################################
|
|
# Packaging
|
|
###################################################
|
|
|
|
echo "Adapting modes"
|
|
chmod -R og=u-w .
|
|
|
|
echo Packaging
|
|
cd ..
|
|
for f in `cat ${dir}/MANIFEST`; do
|
|
if [ ! -f ${dir}/${f} ]; then
|
|
echo "FATAL: ${dir}/${f} is not a regular file."
|
|
exit 1
|
|
fi
|
|
echo ${dir}/${f} >> MANIFEST.local
|
|
done
|
|
tar --version 2> /dev/null | grep "GNU tar" > /dev/null && \
|
|
GTAR_OPTS=--portability
|
|
tar ${GTAR_OPTS} -cf ${dir}.tar -T MANIFEST.local
|
|
gzip --best ${dir}.tar
|
|
ls -l ${dir}.tar.gz
|
|
mv ${dir}.tar.gz ${prev}
|
|
cd ${prev}
|
|
rm -rf ${tmp}
|