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
|
#! /bin/sh
#
# NAME
# make-rel -- make a software release
#
# SYNOPSIS
usage="make-rel SYMBOLIC_TAG MODULE"
#
# DESCRIPTION
#
# `make-rel' exports MODULE from CVS using SYMBOLIC_TAG and
# creates a distribution from it.
#
# `make-rel' can tell the difference between `autoconf' style
# packages, Perl, and Python packages and create them accordingly.
#
# For `autoconf' packages, `make-rel' edits the SYMBOLIC_TAG into
# `configure.in', runs `autoconf', `./configure', and then
# performs a `make dist'.
#
# For Perl packages, `make-rel' edits the SYMBOLIC_TAG into the
# file identified in `Makefile.PL' as the `VERSION_FROM' file,
# runs `perl Makefile.pl' and `make dist'.
#
# For Python packages, `make-rel' edits the SYMBOLIC_TAG into
# `setup.py'.
#
# SYMBOLIC_TAGs of the form ``r([0-9]+)m([0-9]+)(.*)'' are
# reformatted to ``\1.\2\3'' to translate between CVS/RCSs
# requirement against using `.' in a tag name. For example, a
# symbolic tag `r0m1b1' is reformatted to `0.1b1'.
#
# The leading `r' of a SYMBOLIC_TAG is removed. Underscores (`_')
# are translated to periods (`.').
#
# $Id: make-rel,v 1.1 2002/08/02 14:54:50 kmacleod Exp $
#
AUTOCONF="/usr/bin/autoconf"
GREP="/usr/bin/grep"
PERL="/usr/bin/perl"
AWK="/usr/bin/awk"
CVS="/usr/bin/cvs"
PWD_CMD="/bin/pwd"
SED="/bin/sed"
TR="/usr/bin/tr"
if [ $# != 2 ]; then
echo "$usage"
exit 0
fi
SYMBOLIC_TAG="$1"
MODULE="$2"
set -e
set -x
original_dir="`$PWD_CMD`"
release="`echo \"$SYMBOLIC_TAG\" | $SED -e 's/r\([0-9]\{1,\}\)m\([0-9]\{1,\}\)\(.*\)/\1.\2\3/'`"
release="`echo \"$release\" | $SED -e 's/^r//' | $TR '_' '.'`"
mkdir /tmp/dist-$$
cd /tmp/dist-$$
$CVS export -r $SYMBOLIC_TAG -d dist $MODULE
cd dist
if [ -f configure.in ]; then
mv configure.in ..
# edit the SYMBOLIC_TAG into `configure.in', translating to a
# ``cleaner'' release number
$SED <../configure.in >configure.in \
-e 's/^VERSION=.*$/VERSION='"$release"'/'
echo "$release" >.release
$AUTOCONF
./configure
make dist
cd ..
elif [ -f Makefile.PL ]; then
perl <<'EOF'
use ExtUtils::Manifest;
($missfile, $missentry) = ExtUtils::Manifest::fullcheck;
die "make-rel: release does not check against manifest\n"
if ($#{$missfile} != -1 || $#{$missentry} != -1);
EOF
if [ $? != 0 ]; then
exit 1;
fi
VERSION_FROM="`$SED -n -e \"/VERSION_FROM/s/.*'\(.*\)',/\1/p\" Makefile.PL`"
mv $VERSION_FROM ..
$SED <../`basename $VERSION_FROM` >$VERSION_FROM \
-e '/VERSION = /s/0\.00/'"$release"'/'
for ii in `find . -name \*.pm`; do
mv $ii ..
$SED <../`basename $ii` >$ii \
-e '/VERSION = /s/0\.00/'"$release"'/'
done
if [ -f $MODULE.spec ]; then
$SED <$MODULE.spec >$MODULE-$release.spec \
-e 's/@VERSION@/'"$release"'/g'
mv MANIFEST ..
$SED <../MANIFEST >MANIFEST \
-e "/^$MODULE.spec$/a\\
$MODULE-$release.spec
"
fi
perl Makefile.PL
make dist
mv $MODULE-$release.tar.gz ..
cd ..
elif [ -f setup.py ]; then
mv setup.py ..
$SED <../setup.py >setup.py \
-e '/version = /s/0\.0\.0/'"$release"'/'
python setup.py sdist
mv dist/$MODULE-$release.tar.gz ..
cd ..
else
echo "Unknown package type"
cd ..
rm -rf dist-$$
exit 1
fi
chmod a-w *.tar.gz
mv *.tar.gz $original_dir
cd ..
rm -rf dist-$$
|