1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
#!/bin/sh
#
# $Id: //droopi/main/utils/make_distrib#27 $
#
# This script builds a compressed archive suitable for distribution.
#
# Usage: make_distrib [-Dn] [-svn] [-b branch] dir
#
# -D : build and package documentation
# -n : assume a checkout has already been done in dir
# -svn : use Subversion to extract files
# -b branch : use that CM branch
# dir : the distribution will unpack in directory <dir> and will be
# named <dir>.tar.gz
#
subversion=false
nocheckout=false
prepare_distrib_options=
###################################################
# Usage information
###################################################
usage() {
echo "Usage: $0 [-Dks] [-svn] [-bBRANCH] -[ncs] tag dir"
exit 1
}
set -e
###################################################
# Parse commande line
###################################################
while getopts Dns:b: opt; do
case "$opt" in
D) prepare_distrib_options="${prepare_distrib_options} -D" ;;
s)
case "s$OPTARG" in
svn) subversion=true ;;
esac
;;
n) nocheckout=true;;
b) branch="$OPTARG" ;;
*) usage ;;
esac
done
shift `expr $OPTIND - 1`
if [ $# != 1 ]; then
usage
fi
dir=$1
###################################################
# Prepare temporary directory
###################################################
prev=`pwd`
tmp=${TMPDIR-/var/tmp}/make_distrib.$$
mkdir -p ${tmp}/${dir}
trap "cd /; rm -fr ${tmp}" 0
###################################################
# Checkout from repository, if required
###################################################
# Subversion
if $subversion; then
# Tag is always ignored
if [ "${branch}" != "" ]; then
case ${branch} in
*/global/*)
view_root=${branch}/polyorb
;;
*)
view_root=${branch}
;;
esac
else
view_root=/trunk/polyorb
fi
cd ${tmp}/${dir}
tmp=`/bin/pwd`
set +e
svn checkout svn+ssh://svn.eu.adacore.com/Dev${view_root} .
rc=$?
set -e
if [ $rc != 0 ]; then
exit $rc
fi
# Get last change for this tree
prepare_distrib_options="${prepare_distrib_options} -c "`svn log --limit 1 | sed -n '2s/^r\([0-9]*\) .*$/\1/p'`
cd ..
# Do no checkout
elif $nocheckout; then
# Edits will be done in place directly in this case
# Note that this assumes that the specified directory contains a
# clean checkout of the repository.
: Nothing to do
else
echo "Specify either -svn or -n"
exit 1
fi
${dir}/utils/prepare_distrib $prepare_distrib_options $dir
###################################################
# Packaging
###################################################
echo Packaging
local_filelist=${tmp}/filelist
rm -f ${local_filelist}
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} >> ${local_filelist}
done
# Check for GNU tar
tar --version 2> /dev/null | grep "GNU tar" > /dev/null && \
GTAR_OPTS=--portability
# Create package
tar ${GTAR_OPTS} -cf ${dir}.tar -T ${local_filelist}
gzip --best ${dir}.tar
ls -l ${dir}.tar.gz
if [ "`pwd`" != "${prev}" ]; then
mv ${dir}.tar.gz ${prev}
cd ${prev}
fi
rm -fr ${tmp}
|