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