3
# upload a release file to Launchpad
5
# usage: lp-upload-release [--staging] bzr-1.2.3.tgz
9
if [ "$1" = "--staging" ]
12
server="staging.launchpad.net"
14
server="launchpad.net"
19
echo "usage: lp-upload-release VERSION FILENAME"
25
echo "please set $EMAIL to an address registered with Launchpad"
32
echo "$upfile is not a file"
37
if [ \! -f "$sigfile" ]
39
echo "couldn't find gpg signature $sigfile"
46
# parse the product and release number out of a filename like
47
# "bzr-foo-1.23rc1.tar.gz"
48
filetype="${upfile:e}"
50
basename="${${upfile:t}%%-[0-9].*}"
51
version="${${upfile:t:r}##*-}"
52
echo $basename $version $filetype
54
# bzr puts just the first part of the version into the series, e.g. 1.8 from 1.8rc1
55
series=${version%(rc|beta|alpha)*}
57
for v in basename version filetype series
63
https://$server/$basename/$series/$version/+adddownloadfile \
64
-F field.description="$basename $version source" \
65
-F field.filecontent="@${upfile}" \
66
-F field.contenttype=CODETARBALL \
67
-F field.actions.add=Upload
69
reported_md5=$( curl https://$server/$basename/$series/$version/+download/$filetail/+md5 )
70
expected_md5="$(md5sum "$upfile")"
71
expected_md5=${${(z)expected_md5}[1]}
73
for v in reported_md5 expected_md5
78
[ $reported_md5 = $expected_md5 ]