]> git.decadent.org.uk Git - dak.git/blob - scripts/debian/byhand-task
Pass suite name to the autobyhand scripts
[dak.git] / scripts / debian / byhand-task
1 #!/bin/bash
2
3 set -u
4 set -e
5 set -o pipefail
6
7 if [ $# -lt 5 ]; then
8         echo "Usage: $0 filename version arch changes_file suite"
9         exit 1
10 fi
11
12 export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
13 . $SCRIPTVARS
14
15 INPUT="$1"      # Tarball to read, compressed with gzip
16 VERSION="$2"
17 ARCH="$3"
18 CHANGES="$4"    # Changes file for the upload
19 SUITE="$5"
20
21 error() {
22         echo "$*"
23         exit 1
24 }
25
26 case $SUITE in
27     unstable|sid)
28         : # OK for automated byband processing
29         ;;
30     *)
31         error "Reject: task overrides can only be processed automatically for uploads to unstable"
32         ;;
33 esac
34
35
36 # Regular expression used to validate tag lines
37 CHECKRE='^[a-z0-9A-Z.+-]+[[:space:]]+Task[[:space:]]+[a-z0-9:. ,{}+-]+$'
38
39 # This must end with /
40 TARGET=/srv/ftp-master.debian.org/scripts/external-overrides/
41
42 # Read the main directory from the tarball
43 DIR="`tar ztf \"$INPUT\" | tac | tail -n 1`"
44
45 # Create temporary files where to store the validated data
46 umask 002
47 OUTMAIN="`mktemp \"$TARGET\"task.new.XXXXXX`"
48
49 # If we fail somewhere, cleanup the temporary files
50 cleanup() {
51         rm -f "$OUTMAIN"
52 }
53 trap cleanup EXIT
54
55 # Extract the data into the temporary files
56 tar -O -zxf "$INPUT" "$DIR"task | grep -E "$CHECKRE" > "$OUTMAIN"
57
58 # Move the data to the final location
59 mv "$OUTMAIN"           "$TARGET"task
60
61 chmod 644 "$TARGET"task
62
63 dak external-overrides import unstable main Task <"$TARGET"task
64 dak external-overrides copy unstable testing
65
66 trap - EXIT
67
68 exit 0