1 |
ccflib |
1.1 |
#! /usr/local/bin/bash |
2 |
|
|
# |
3 |
ccflib |
1.14 |
# $Id: buildagain,v 1.13 2007/05/11 11:47:38 ccflib Exp $ |
4 |
ccflib |
1.1 |
# |
5 |
|
|
# + Build again a specific set of CCF packages |
6 |
ccflib |
1.10 |
# + Moves the resulting CCF to final destination |
7 |
|
|
# (makes in part the same that acceptbuild) |
8 |
ccflib |
1.1 |
# |
9 |
|
|
# Exit code: |
10 |
|
|
# + -1 (255): nothing to build |
11 |
|
|
# + 1: shell errors (cd mkdir ...) |
12 |
|
|
# + 2: SAS set up cannot find deceit |
13 |
|
|
|
14 |
ccflib |
1.5 |
if [ -z $1 ] ; then |
15 |
ccflib |
1.8 |
echo "Abort: Undefined package to process again" |
16 |
ccflib |
1.4 |
exit -1 |
17 |
ccflib |
1.1 |
fi |
18 |
|
|
|
19 |
|
|
pkg=$1 |
20 |
|
|
|
21 |
|
|
cleanup () { |
22 |
|
|
cd ~ |
23 |
|
|
rm -fr $builddir/* |
24 |
|
|
exit |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
buildpkg () { |
28 |
|
|
pkg=$1 |
29 |
|
|
echo Attempting to build $pkg ... |
30 |
|
|
(make -s -C $pkg clobber 2>&1 && make -s -C $pkg depend 2>&1 && make -s -C $pkg 2>&1) >> $builddir/build.log |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
. $HOME/bin/ccflib.cfg |
34 |
|
|
|
35 |
|
|
builtdir=~/deliveries/built |
36 |
|
|
|
37 |
|
|
trap cleanup SIGINT |
38 |
|
|
|
39 |
|
|
me=`basename $0` |
40 |
|
|
|
41 |
|
|
PATH=$HOME/bin:$PATH |
42 |
|
|
export PATH |
43 |
|
|
|
44 |
ccflib |
1.6 |
plist=`find ${builtdir} -name "*${pkg}*" -print` |
45 |
ccflib |
1.1 |
|
46 |
|
|
if [ -z "$plist" ] ; then |
47 |
|
|
exit -1 |
48 |
|
|
fi |
49 |
|
|
|
50 |
|
|
saslatest |
51 |
|
|
deceit -v 2>&1 || (echo ERROR: deceit missing; exit 2) |
52 |
|
|
ccfextseq -v 2>&1 || (echo ERROR: ccfextseq missing; exit 2) |
53 |
|
|
|
54 |
|
|
builddir=$HOME/builds/again |
55 |
|
|
if [ -d $builddir ] ; then |
56 |
|
|
mv $builddir ${builddir}.old |
57 |
|
|
rm -rf ${builddir}.old & |
58 |
|
|
fi |
59 |
|
|
mkdir -p $builddir |
60 |
|
|
cd $builddir || exit 1 |
61 |
ccflib |
1.7 |
echo Removing the contents of $builddir ... |
62 |
ccflib |
1.1 |
rm -fr * |
63 |
|
|
|
64 |
|
|
mkdir packages || exit 1 |
65 |
|
|
|
66 |
|
|
for p in $plist; do |
67 |
|
|
echo -n Unpacking `basename $p` ... |
68 |
ccflib |
1.12 |
tar -C packages -xzf $p || (echo FAILED, aborting ; exit 1) |
69 |
ccflib |
1.1 |
echo " done." |
70 |
ccflib |
1.13 |
mkdir tmplog || exit 1 |
71 |
|
|
tar -C tmplog -xzf $p || (echo FAILED, aborting ; exit 1) |
72 |
|
|
chmod -R a+w tmplog |
73 |
|
|
tmpdir=`ls -1 tmplog` |
74 |
ccflib |
1.14 |
echo "ChangeLog says:" |
75 |
ccflib |
1.13 |
last_version tmplog/$tmpdir/ChangeLog |
76 |
|
|
rm -fr tmplog |
77 |
ccflib |
1.1 |
done |
78 |
|
|
|
79 |
|
|
# updating the dev directory for any possible change in its files |
80 |
|
|
|
81 |
|
|
CCFDEV=$HOME/ccfdev ; export CCFDEV |
82 |
|
|
cd $CCFDEV |
83 |
|
|
cvs update 2> /dev/null |
84 |
|
|
|
85 |
|
|
# back to $builddir/packages |
86 |
|
|
|
87 |
|
|
cd ~- ; cd packages |
88 |
|
|
. $CCFDEV/setup.sh |
89 |
|
|
|
90 |
|
|
|
91 |
|
|
for p in $plist; do |
92 |
ccflib |
1.3 |
echo "making package $p" |
93 |
ccflib |
1.8 |
thisp=`basename $p '.tgz' | sed -e 's/-[0-9]\{1,\}\.[0-9]\{1,\}$//'` |
94 |
ccflib |
1.12 |
buildpkg $thisp && (echo ok) || (echo FAILED ; cat $builddir/build.log) |
95 |
ccflib |
1.1 |
done |
96 |
ccflib |
1.10 |
|
97 |
|
|
# Now moves resulting CCF to final destinations |
98 |
|
|
|
99 |
|
|
cd $builddir || exit 1 |
100 |
|
|
|
101 |
ccflib |
1.11 |
# notice that this is different of the standard builddir which is |
102 |
|
|
# set to $HOME/builds/tmp, so the find command will not mess up |
103 |
|
|
# with it |
104 |
|
|
|
105 |
ccflib |
1.10 |
flist=`find . -name '*.CCF'` |
106 |
|
|
|
107 |
|
|
if [ -z "$flist" ] ; then |
108 |
|
|
exit 0 |
109 |
|
|
fi |
110 |
|
|
|
111 |
|
|
for f in $flist ; do |
112 |
|
|
b=`basename $f` |
113 |
|
|
echo Considering $b ... |
114 |
|
|
if [ -e $ccfdir/$b -o -e $ccfrel/$b -o -e $scisimdir/$b ] ; then |
115 |
|
|
echo " it already exists. REJECTED." |
116 |
|
|
else |
117 |
|
|
if [ -e $ccfdeveldir/$b ] ; then |
118 |
|
|
echo " it already exists in the development area and it will be overwritten." |
119 |
|
|
fi |
120 |
ccflib |
1.12 |
ccfextseq --sets=$f |
121 |
ccflib |
1.10 |
if [ $? -ne 0 ] ; then |
122 |
|
|
echo " validation stage failed. REJECTED." |
123 |
|
|
else |
124 |
ccflib |
1.12 |
cp $f $ccfdeveldir || exit 1 |
125 |
ccflib |
1.10 |
echo " accepted into $ccfdeveldir." |
126 |
|
|
fi |
127 |
|
|
fi |
128 |
|
|
done |