-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreate-rpi-update-commit
More file actions
executable file
·60 lines (50 loc) · 1.17 KB
/
create-rpi-update-commit
File metadata and controls
executable file
·60 lines (50 loc) · 1.17 KB
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
#!/bin/bash -eu
#
# Create an 'Update to upstream raspberrypi ...' commit
#
function usage()
{
cat <<EOF
Usage: $(basename "${0}") [-h]
Create an 'Update to upstream raspberrypi ...' commit.
Optional arguments:
-h, --help Show this help text and exit.
EOF
}
while [ $# -gt 0 ] ; do
case "$1" in
-h|--help)
usage
exit
;;
*)
echo "Invalid argument: ${1}" >&2
exit 2
;;
esac
shift
done
commit=$(git log | grep -m1 -P 'from commit [0-9a-f]{40}' | \
grep -oP '[0-9a-f]{40}' || true)
if [ -z "${commit}" ] ; then
echo "No cherry-pick tag found" >&2
exit 1
fi
tag=$(git tag --points-at "${commit}" 2>/dev/null | grep "^rpi-" | sort -V | \
tail -1)
if [ -z "${tag}" ] ; then
echo "Tag not found for commit ${commit}" >&2
exit 1
fi
branch=${tag%_*}
date=${tag#*_}
subject=$(git log --format=%s "${commit}" -1)
cat <<EOF > debian.raspi/upstream-raspberrypi
# The following upstream raspberrypi releases have been ported:
[upstream-raspberrypi]:
${branch} = ${commit::12} ("${subject}") [${date}]
EOF
git commit -s \
-m "UBUNTU: raspi: Update to upstream raspberrypi ${branch} (${date})" \
-m "Ignore: yes" \
-- debian.raspi/upstream-raspberrypi