1 |
ccflib |
1.1 |
#! /usr/local/bin/bash |
2 |
|
|
# |
3 |
ccflib |
1.4 |
# $Id: buildagain,v 1.3 2005/11/11 15:35:08 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 |
|
|
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 |
|
|
|
43 |
|
|
plist=`find ${builtdir} -name "*${pkg}* -print` |
44 |
|
|
|
45 |
|
|
if [ -z "$plist" ] ; then |
46 |
|
|
exit -1 |
47 |
|
|
fi |
48 |
|
|
|
49 |
|
|
saslatest |
50 |
|
|
deceit -v 2>&1 || (echo ERROR: deceit missing; exit 2) |
51 |
|
|
ccfextseq -v 2>&1 || (echo ERROR: ccfextseq missing; exit 2) |
52 |
|
|
|
53 |
|
|
builddir=$HOME/builds/again |
54 |
|
|
if [ -d $builddir ] ; then |
55 |
|
|
mv $builddir ${builddir}.old |
56 |
|
|
rm -rf ${builddir}.old & |
57 |
|
|
fi |
58 |
|
|
mkdir -p $builddir |
59 |
|
|
cd $builddir || exit 1 |
60 |
|
|
echo -n Removing the contents of $builddir ... |
61 |
|
|
rm -fr * |
62 |
|
|
|
63 |
|
|
mkdir packages || exit 1 |
64 |
|
|
|
65 |
|
|
for p in $plist; do |
66 |
|
|
echo -n Unpacking `basename $p` ... |
67 |
ccflib |
1.3 |
# tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
68 |
ccflib |
1.1 |
echo " done." |
69 |
|
|
done |
70 |
|
|
|
71 |
|
|
# updating the dev directory for any possible change in its files |
72 |
|
|
|
73 |
|
|
CCFDEV=$HOME/ccfdev ; export CCFDEV |
74 |
|
|
cd $CCFDEV |
75 |
|
|
cvs update 2> /dev/null |
76 |
|
|
|
77 |
|
|
# back to $builddir/packages |
78 |
|
|
|
79 |
|
|
cd ~- ; cd packages |
80 |
|
|
. $CCFDEV/setup.sh |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
for p in $plist; do |
84 |
ccflib |
1.3 |
echo "making package $p" |
85 |
|
|
# thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
86 |
ccflib |
1.4 |
# buildpkg $thisp && (echo ok) || (echo FAILED ; cat $builddir/build.log) |
87 |
ccflib |
1.1 |
done |