1 |
ccflib |
1.4 |
#! /bin/bash |
2 |
ccflib |
1.1 |
# |
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 |
ccflib |
1.6 |
# $Id: buildlatest,v 1.5 2014/12/12 10:30:51 ccflib Exp $ |
11 |
ccflib |
1.1 |
|
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 |
ccflib |
1.5 |
|
25 |
ccflib |
1.1 |
. $HOME/bin/ccflib.cfg |
26 |
|
|
|
27 |
ccflib |
1.5 |
builtdir=${CCFLIB_HOME}/deliveries/built |
28 |
ccflib |
1.1 |
mkdir -p $builtdir |
29 |
|
|
|
30 |
|
|
trap cleanup SIGINT |
31 |
|
|
|
32 |
|
|
me=`basename $0` |
33 |
ccflib |
1.4 |
echo $me running on `date` |
34 |
ccflib |
1.1 |
|
35 |
ccflib |
1.5 |
export PATH=${CCFLIB_HOME}/bin:$PATH |
36 |
ccflib |
1.1 |
|
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 |
ccflib |
1.5 |
builddir=${CCFLIB_HOME}/builds/tmp |
49 |
ccflib |
1.1 |
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 |
ccflib |
1.3 |
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 |
ccflib |
1.1 |
|
72 |
|
|
done |
73 |
|
|
|
74 |
|
|
|
75 |
ccflib |
1.5 |
export CCFDEV=${CCFLIB_HOME}/ccfdev |
76 |
ccflib |
1.1 |
cd $CCFDEV |
77 |
|
|
cvs update 2> /dev/null |
78 |
ccflib |
1.6 |
# now we return back to $builddir |
79 |
ccflib |
1.1 |
cd ~- |
80 |
|
|
. $CCFDEV/setup.sh |
81 |
|
|
|
82 |
|
|
cd packages |
83 |
|
|
|
84 |
|
|
for p in $plist; do |
85 |
|
|
thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
86 |
|
|
buildpkg $thisp && (echo ok; mv $p $builtdir) || (echo FAILED ; cat $builddir/build.log) |
87 |
|
|
done |
88 |
|
|
|
89 |
|
|
###emptypkgdir |