1 |
#! /usr/local/bin/bash |
2 |
# |
3 |
# $Id$ |
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: Enter the package to process" |
14 |
exit |
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 |
|
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 |
|
67 |
echo -n Unpacking `basename $p` ... |
68 |
tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
69 |
echo " done." |
70 |
|
71 |
done |
72 |
|
73 |
# updating the dev directory for any possible change in its files |
74 |
|
75 |
CCFDEV=$HOME/ccfdev ; export CCFDEV |
76 |
cd $CCFDEV |
77 |
cvs update 2> /dev/null |
78 |
|
79 |
# back to $builddir/packages |
80 |
|
81 |
cd ~- ; cd packages |
82 |
. $CCFDEV/setup.sh |
83 |
|
84 |
|
85 |
for p in $plist; do |
86 |
thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
87 |
buildpkg $thisp && (echo ok; mv $p $builtdir) || (echo FAILED ; cat $builddir/build.log) |
88 |
done |
89 |
|
90 |
###emptypkgdir |