-
Notifications
You must be signed in to change notification settings - Fork 1
/
launchpad-update.sh
executable file
·87 lines (74 loc) · 2.49 KB
/
launchpad-update.sh
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
#!/bin/bash
#
# Script to push changes to launchpad
#
# Copyright (C) 2015 Michael Müller
# Copyright (C) 2015-2016 Sebastian Lackner
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
set -eux
update_bzr()
{
bzrurl="$1"
distro="$2"
if [ ! -d "temp/$distro/debian" ]; then
echo "ERROR: No packaging files found for $distro, run packaging/generate.py first." >&2
exit 1
fi
# Checkout repository
mkdir -p launchpad
rm -rf "launchpad/$distro"
bzr checkout --lightweight "$bzrurl" "launchpad/$distro"
# Update debian/ directory
rm -rf "launchpad/$distro/debian"
cp -r "temp/$distro/debian" "launchpad/$distro"
# Compute diff
tmpfile=$(mktemp)
(cd "launchpad/$distro"; bzr diff || true) > "$tmpfile"
# Empty diff -> nothing to commit
if [ ! -s "$tmpfile" ]; then
echo "Nothing to commit for $distro"
rm "$tmpfile"
return 0
fi
# Only timestamp changed -> nothing to commit
if ! cat "$tmpfile" | filterdiff -x debian/changelog | grep "^+++" &> /dev/null; then
if ! cat "$tmpfile" | grep -v "\(^--- \|^+++ \)" |
grep -v "^[+-] -- .* <[^>]\+> .*" | grep "^[+-]"; then
echo "Nothing to commit for $distro"
rm "$tmpfile"
return 0
fi
fi
echo "###################################"
echo ""
cat "$tmpfile" | colordiff
echo "###################################"
echo ""
# Read commit message and commit changes
version=$(head -n1 "launchpad/$distro/debian/changelog" | sed -e 's/.*(\(.*\)).*/\1/')
read -e -p "Commit message (CTRL-C to abort): " -i "Update to $version." commit_msg
(cd "launchpad/$distro"; bzr add "debian" && bzr commit -m "$commit_msg")
rm "$tmpfile"
return 0
}
if [ ! -d "packaging" ]; then
echo "ERROR: Called from wrong directory, aborting." >&2
exit 1
fi
update_bzr "lp:~wine/wine/build-development" "ubuntu-any-development"
update_bzr "lp:~wine/wine/build-staging" "ubuntu-any-staging"
exit 0