Detect misidentified architecture on the build system
[buildd-scripts.git] / bin / get_package
1 #!/bin/bash
2
3 CLIENT=$1
4 LOGDIR=/home/build/logs
5 LOGFILE=/var/log/builder.log
6 STATEDIR=/home/build/state
7
8 cd in
9
10 while true; do
11     FILE=$(ls -1 *.q | head -1)
12     NUM=$(echo $FILE | cut -d. -f1)
13     mv $NUM.q $NUM.proc
14     if [ $? -ne 0 ]; then # we clashed
15         echo NOPACKAGE
16         exit 1
17     fi
18
19     PKG_VER_ARCH=$(cat $NUM.proc)
20
21     DATE=$(date)
22
23     if [ -f ${LOGDIR}/${ARCH}/PASS/${PKG_VER_ARCH}.log ] || [ -f ${LOGDIR}/${ARCH}/FAIL/${PKG_VER_ARCH}.log ]; then
24         for file in ${LOGDIR}/${ARCH}/{PASS,FAIL}/${PKG_VER_ARCH}.log; do
25             # Ignore and try again
26             if [ -f  $file ]; then
27                 echo "$DATE: Ignoring package $NUM: $PKG_VER_ARCH, already have logfile $file" >> $LOGFILE
28             fi
29         done
30         continue
31     fi
32
33     # else
34     echo "$DATE: Queued package $NUM: $PKG_VER_ARCH on $CLIENT" >> $LOGFILE
35     echo "$DATE: Queued package $NUM: $PKG_VER_ARCH on $CLIENT" >> $STATEDIR/$NUM.running
36     echo "$NUM $PKG_VER_ARCH"
37     exit 0
38 done
39
40 exit 0
41