1 |
#! /bin/bash |
2 |
# |
3 |
# + Build the latest set of CCF packages |
4 |
# |
5 |
# Exit code: |
6 |
# + -1 (255): nothing to build |
7 |
# + 1: shell errors (cd mkdir ...) |
8 |
# + 2: SAS set up cannot find deceit |
9 |
# |
10 |
# $Id: buildlatest,v 1.3 2013/02/14 14:26:13 ccflib Exp $ |
11 |
|
12 |
cleanup () { |
13 |
cd ~ |
14 |
rm -fr $builddir/* |
15 |
exit |
16 |
} |
17 |
|
18 |
buildpkg () { |
19 |
pkg=$1 |
20 |
echo Attempting to build $pkg ... |
21 |
(make -s -C $pkg clobber 2>&1 && make -s -C $pkg depend 2>&1 && make -s -C $pkg 2>&1) >> $builddir/build.log |
22 |
} |
23 |
|
24 |
. $HOME/bin/ccflib.cfg |
25 |
|
26 |
builtdir=~/deliveries/built |
27 |
mkdir -p $builtdir |
28 |
|
29 |
trap cleanup SIGINT |
30 |
|
31 |
me=`basename $0` |
32 |
echo $me running on `date` |
33 |
|
34 |
PATH=$HOME/bin:$PATH |
35 |
export PATH |
36 |
|
37 |
|
38 |
plist=`findlatest` |
39 |
|
40 |
if [ -z "$plist" ] ; then |
41 |
## echo Nothing to build. |
42 |
exit -1 |
43 |
fi |
44 |
|
45 |
saslatest |
46 |
deceit -v 2>&1 || (echo ERROR: deceit missing; exit 2) |
47 |
ccfextseq -v 2>&1 || (echo ERROR: ccfextseq missing; exit 2) |
48 |
|
49 |
builddir=$HOME/builds/tmp |
50 |
mv $builddir ${builddir}.old |
51 |
rm -fr ${builddir}.old & |
52 |
mkdir -p $builddir |
53 |
cd $builddir || exit 1 |
54 |
echo -n Removing the contents of $builddir ... |
55 |
rm -fr * |
56 |
echo "" |
57 |
|
58 |
mkdir packages || exit 1 |
59 |
|
60 |
for p in $plist; do |
61 |
|
62 |
echo -n Unpacking `basename $p` ... |
63 |
tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
64 |
echo " done." |
65 |
mkdir tmplog || exit 1 |
66 |
tar -C tmplog -xzf $p || (echo FAILED, aborting ; exit 1) |
67 |
chmod -R a+w tmplog |
68 |
tmpdir=`ls -1 tmplog` |
69 |
echo "ChangeLog says:" |
70 |
last_version tmplog/$tmpdir/ChangeLog |
71 |
rm -fr tmplog |
72 |
|
73 |
done |
74 |
|
75 |
|
76 |
CCFDEV=$HOME/ccfdev |
77 |
cd $CCFDEV |
78 |
cvs update 2> /dev/null |
79 |
cd ~- |
80 |
export CCFDEV |
81 |
. $CCFDEV/setup.sh |
82 |
|
83 |
cd packages |
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 |