/[CCFs]/bin/getdeliveries
ViewVC logotype

Contents of /bin/getdeliveries

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Mon Jan 15 09:58:17 2018 UTC (6 years, 10 months ago) by ccflib
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +11 -5 lines
refurbished version of getdeliveries to be in line with new version of autobuild

1 #!/bin/bash
2 #
3 # + fetch CCF deliveries from the ftp site
4 # + perform basic checks on the packages
5 # + move them to accept/reject directory
6 #
7 # Exit codes (<0 informational)
8 # -1 (255): no new CCF deliveries
9 #
10 # $Id: getdeliveries,v 1.5 2014/12/02 14:47:48 ccflib Exp $
11
12 #set -e (if set it will not produce any output)
13
14 cleanup () {
15 cd ~
16 /bin/rm -fr $tmpdir
17 }
18
19 me=`basename $0`
20
21 echo
22 echo "-> $me running at "`date`
23 echo
24
25 uploaddir=~/incoming
26 pkgdir=~/deliveries/packages
27 builtdir=~/deliveries/built
28 rejdir=~/deliveries/rejected
29 tmpdir=~/tmp/tmp$$
30 logfile=~/deliveries/DELIVERY_LOG
31
32 trap cleanup EXIT
33
34 mkdir -p $tmpdir $pkgdir $rejdir
35
36 cd $pkgdir
37
38 DATE=`date '+%Y%m%d'`
39
40 cp $uploaddir/* $tmpdir/ 2> /dev/null
41
42 cd $tmpdir
43
44 flist=`ls *.tgz 2> /dev/null`
45
46 if [ -z "$flist" ] ; then
47 echo "$me: No new CCF deliveries."
48 echo
49 exit -1
50 fi
51
52 for p in *.tgz
53 do
54 echo New CCF delivery $p
55
56 trouble=0
57 discard=1
58
59 pack_name=`basename $p | sed -e 's/-[^-]*\.tgz//'`
60 pack_vers=`basename $p | sed -e 's/^.*-//' -e 's/\.tgz//'`
61 pack_md5=`md5sum $p | awk '{print $1}'`
62
63 if [ -e $pkgdir/$p -o -e $builtdir/$p ] ; then
64 echo ERROR: $p - already delivered
65 trouble=1
66 else
67
68 tar xzf $p
69 if [ $? -ne 0 ] ; then
70 echo ERROR: $p ignored - may still be uploading
71 discard=0
72 else
73 echo Package $pack_name $pack_vers
74
75 cd $pack_name
76
77 version=`cat VERSION` || discard=1
78 cd ..
79 rm -fr $pack_name
80 fi
81 fi
82
83 if [ $trouble -ne 0 ] ; then
84 echo ERROR: $p is rejected
85 mv -f $p $rejdir
86 echo $pack_md5 $DATE $p " - REJECTED" >> $logfile
87 else
88 echo $p is accepted
89 mv -f $p $pkgdir
90 echo $pack_md5 $DATE $p >> $logfile
91 fi
92
93 if [ $discard -eq 1 ] ; then
94 echo $p removed from upload area
95 rm -f $uploaddir/$p
96 fi
97
98 done

  ViewVC Help
Powered by ViewVC 1.1.27