1 |
ccflib |
1.1 |
#! /usr/local/bin/bash |
2 |
|
|
# |
3 |
ccflib |
1.6 |
# $Id: buildagain,v 1.5 2005/11/11 15:40:06 ccflib Exp $ |
4 |
ccflib |
1.1 |
# |
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 |
ccflib |
1.5 |
if [ -z $1 ] ; then |
13 |
ccflib |
1.2 |
echo "Abort: No package to process defined" |
14 |
ccflib |
1.4 |
exit -1 |
15 |
ccflib |
1.1 |
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 |
ccflib |
1.6 |
plist=`find ${builtdir} -name "*${pkg}*" -print` |
43 |
ccflib |
1.1 |
|
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 -n 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 |
ccflib |
1.3 |
# tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
67 |
ccflib |
1.1 |
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 |
ccflib |
1.3 |
echo "making package $p" |
84 |
|
|
# thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
85 |
ccflib |
1.4 |
# buildpkg $thisp && (echo ok) || (echo FAILED ; cat $builddir/build.log) |
86 |
ccflib |
1.1 |
done |