-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdaupload
executable file
·152 lines (132 loc) · 3.62 KB
/
daupload
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/sh
set -e
# Usage: daupload-release [-A] [-S] CHANGESFILE
# daupload-proposed [-A] [-S] CHANGESFILE
# daupload-dev [-A] [-S] CHANGESFILE
# After a package has been built for all Debian/Ubuntu versions and
# platforms (typically using "da sbuildhack DSCFILE"), this script
# uploads the package into the release, proposed, or beta apt
# repository. If -A is specified, only one architecture per
# Debian/Ubuntu version is uploaded. If -S is specified, only the
# source package is uploaded.
# Upon completion, moves all of the generated files into the "built"
# subdirectory.
# This script will skip dists listed in ./nobuild.
: ${DA_SCRIPTS_DIR="$(dirname "$0")"}
. "$DA_SCRIPTS_DIR"/debian-versions.sh
if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then
echo "Will override DEBIAN_CODES with: $DEBIAN_CODES_OVERRIDE"
echo -n "Continue? [y/N] "
read a
[ "$a" = "y" ]
DEBIAN_CODES="$DEBIAN_CODES_OVERRIDE"
fi
case "$(basename "$0")" in
daupload-release)
echo "You're uploading to PRODUCTION. This may not be a good idea." >&2
echo -n "Continue? [y/N]"
read a
[ "$a" = "y" ]
release=""
;;
daupload-proposed)
release="-proposed"
;;
daupload-dev)
release="-development"
;;
daupload-bleeding)
release="-bleeding"
;;
*)
echo "Unknown release." >&2
exit 1
;;
esac
v () {
echo "$@"
"$@"
}
A=0
if [ "$1" = "-A" ]; then A=1; shift; fi
S=0
if [ "$1" = "-S" ]; then S=1; shift; fi
change=$1
cd "$(dirname "$change")"
change=$(basename "$change")
base=${change%_source.changes}
check () {
[ -s "$1" ] || missing="$missing$1 "
}
uncheck () {
! [ -s "$1" ] || missing="$missing-$1 "
}
# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
if [ -e nobuild ]; then
newcodes=
for code in $DEBIAN_CODES; do
if ! fgrep -q "$code" nobuild; then
newcodes="$newcodes $code"
fi
done
DEBIAN_CODES=$newcodes
fi
missing=
[ -s "$change" ]
if [ $S -ne 1 ]; then
for code in $DEBIAN_CODES; do
tag=$(gettag "$code")
check "${base}${tag}_amd64.changes"
done
if [ $A -eq 1 ]; then
for code in $DEBIAN_CODES; do
tag=$(gettag "$code")
uncheck "${base}${tag}_i386.changes"
done
else
for code in $DEBIAN_CODES; do
tag=$(gettag "$code")
check "${base}${tag}_i386.changes"
done
fi
fi
if [ -n "$missing" ]; then
echo "Missing $missing" >&2
echo -n "Continue? [y/N]"
read a
[ "$a" = "y" ]
fi
for code in $DEBIAN_CODES; do
v dareprepro include "${code}${release}" "$change"
done
if [ $S -ne 1 ]; then
for code in $DEBIAN_CODES; do
tag=$(gettag "$code")
[ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes"
done
fi
if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then
echo "Codes overridden, skipping copy of files. Cleanup by hand."
exit 0
fi
changes=$change
for code in $DEBIAN_CODES; do
tag=$(gettag "$code")
[ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
changes=$changes\ "${base}${tag}"_amd64.changes
done
files=${change%.changes}.build\ $changes
origfiles=
for change in $changes; do
files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
done
built=built/
[ -d "$built" ] || mkdir "$built"
mv -i $files "$built"
if [ -n "$origfiles" ]; then
for orig in $origfiles; do
[ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
done
fi