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.4 2014/12/02 15:56:07 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 |
|
25 |
. $HOME/bin/ccflib.cfg |
26 |
|
27 |
builtdir=${CCFLIB_HOME}/deliveries/built |
28 |
mkdir -p $builtdir |
29 |
|
30 |
trap cleanup SIGINT |
31 |
|
32 |
me=`basename $0` |
33 |
echo $me running on `date` |
34 |
|
35 |
export PATH=${CCFLIB_HOME}/bin:$PATH |
36 |
|
37 |
plist=`findlatest` |
38 |
|
39 |
if [ -z "$plist" ] ; then |
40 |
## echo Nothing to build. |
41 |
exit -1 |
42 |
fi |
43 |
|
44 |
saslatest |
45 |
deceit -v 2>&1 || (echo ERROR: deceit missing; exit 2) |
46 |
ccfextseq -v 2>&1 || (echo ERROR: ccfextseq missing; exit 2) |
47 |
|
48 |
builddir=${CCFLIB_HOME}/builds/tmp |
49 |
mv $builddir ${builddir}.old |
50 |
rm -fr ${builddir}.old & |
51 |
mkdir -p $builddir |
52 |
cd $builddir || exit 1 |
53 |
echo -n Removing the contents of $builddir ... |
54 |
rm -fr * |
55 |
echo "" |
56 |
|
57 |
mkdir packages || exit 1 |
58 |
|
59 |
for p in $plist; do |
60 |
|
61 |
echo -n Unpacking `basename $p` ... |
62 |
tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
63 |
echo " done." |
64 |
mkdir tmplog || exit 1 |
65 |
tar -C tmplog -xzf $p || (echo FAILED, aborting ; exit 1) |
66 |
chmod -R a+w tmplog |
67 |
tmpdir=`ls -1 tmplog` |
68 |
echo "ChangeLog says:" |
69 |
last_version tmplog/$tmpdir/ChangeLog |
70 |
rm -fr tmplog |
71 |
|
72 |
done |
73 |
|
74 |
|
75 |
export CCFDEV=${CCFLIB_HOME}/ccfdev |
76 |
cd $CCFDEV |
77 |
cvs update 2> /dev/null |
78 |
cd ~- |
79 |
. $CCFDEV/setup.sh |
80 |
|
81 |
cd packages |
82 |
|
83 |
for p in $plist; do |
84 |
thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
85 |
buildpkg $thisp && (echo ok; mv $p $builtdir) || (echo FAILED ; cat $builddir/build.log) |
86 |
done |
87 |
|
88 |
###emptypkgdir |