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.7 |
# $Id: buildlatest,v 1.6 2015/02/02 17:13:29 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.7 |
me=`basename $0` |
25 |
|
|
|
26 |
|
|
echo "-> $me runing on "`date` |
27 |
|
|
echo |
28 |
ccflib |
1.5 |
|
29 |
ccflib |
1.1 |
. $HOME/bin/ccflib.cfg |
30 |
|
|
|
31 |
ccflib |
1.5 |
builtdir=${CCFLIB_HOME}/deliveries/built |
32 |
ccflib |
1.1 |
mkdir -p $builtdir |
33 |
|
|
|
34 |
|
|
trap cleanup SIGINT |
35 |
|
|
|
36 |
ccflib |
1.5 |
export PATH=${CCFLIB_HOME}/bin:$PATH |
37 |
ccflib |
1.1 |
|
38 |
|
|
plist=`findlatest` |
39 |
|
|
|
40 |
|
|
if [ -z "$plist" ] ; then |
41 |
ccflib |
1.7 |
echo "$me: Nothing to build." |
42 |
|
|
echo |
43 |
ccflib |
1.1 |
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 |
ccflib |
1.5 |
builddir=${CCFLIB_HOME}/builds/tmp |
51 |
ccflib |
1.1 |
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 |
ccflib |
1.3 |
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 |
ccflib |
1.1 |
|
74 |
|
|
done |
75 |
|
|
|
76 |
|
|
|
77 |
ccflib |
1.5 |
export CCFDEV=${CCFLIB_HOME}/ccfdev |
78 |
ccflib |
1.1 |
cd $CCFDEV |
79 |
|
|
cvs update 2> /dev/null |
80 |
ccflib |
1.6 |
# now we return back to $builddir |
81 |
ccflib |
1.1 |
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 |