1 |
#! /usr/local/bin/bash |
2 |
# |
3 |
# $Id: buildagain,v 1.6 2005/11/11 15:42:25 ccflib Exp $ |
4 |
# |
5 |
# + Build again a specific set of CCF packages |
6 |
# |
7 |
# Exit code: |
8 |
# + -1 (255): nothing to build |
9 |
# + 1: shell errors (cd mkdir ...) |
10 |
# + 2: SAS set up cannot find deceit |
11 |
|
12 |
if [ -z $1 ] ; then |
13 |
echo "Abort: No package to process defined" |
14 |
exit -1 |
15 |
fi |
16 |
|
17 |
pkg=$1 |
18 |
|
19 |
cleanup () { |
20 |
cd ~ |
21 |
rm -fr $builddir/* |
22 |
exit |
23 |
} |
24 |
|
25 |
buildpkg () { |
26 |
pkg=$1 |
27 |
echo Attempting to build $pkg ... |
28 |
(make -s -C $pkg clobber 2>&1 && make -s -C $pkg depend 2>&1 && make -s -C $pkg 2>&1) >> $builddir/build.log |
29 |
} |
30 |
|
31 |
. $HOME/bin/ccflib.cfg |
32 |
|
33 |
builtdir=~/deliveries/built |
34 |
|
35 |
trap cleanup SIGINT |
36 |
|
37 |
me=`basename $0` |
38 |
|
39 |
PATH=$HOME/bin:$PATH |
40 |
export PATH |
41 |
|
42 |
plist=`find ${builtdir} -name "*${pkg}*" -print` |
43 |
|
44 |
if [ -z "$plist" ] ; then |
45 |
exit -1 |
46 |
fi |
47 |
|
48 |
saslatest |
49 |
deceit -v 2>&1 || (echo ERROR: deceit missing; exit 2) |
50 |
ccfextseq -v 2>&1 || (echo ERROR: ccfextseq missing; exit 2) |
51 |
|
52 |
builddir=$HOME/builds/again |
53 |
if [ -d $builddir ] ; then |
54 |
mv $builddir ${builddir}.old |
55 |
rm -rf ${builddir}.old & |
56 |
fi |
57 |
mkdir -p $builddir |
58 |
cd $builddir || exit 1 |
59 |
echo Removing the contents of $builddir ... |
60 |
rm -fr * |
61 |
|
62 |
mkdir packages || exit 1 |
63 |
|
64 |
for p in $plist; do |
65 |
echo -n Unpacking `basename $p` ... |
66 |
# tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
67 |
echo " done." |
68 |
done |
69 |
|
70 |
# updating the dev directory for any possible change in its files |
71 |
|
72 |
CCFDEV=$HOME/ccfdev ; export CCFDEV |
73 |
cd $CCFDEV |
74 |
cvs update 2> /dev/null |
75 |
|
76 |
# back to $builddir/packages |
77 |
|
78 |
cd ~- ; cd packages |
79 |
. $CCFDEV/setup.sh |
80 |
|
81 |
|
82 |
for p in $plist; do |
83 |
echo "making package $p" |
84 |
# thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
85 |
# buildpkg $thisp && (echo ok) || (echo FAILED ; cat $builddir/build.log) |
86 |
done |