Merge ~paride/curtin:drop-new-upstream-snapshot into curtin:master

Proposed by Paride Legovini
Status: Merged
Approved by: Dan Watkins
Approved revision: 6df232f0e5d23aa602a7cd2bd6c908800d31e875
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~paride/curtin:drop-new-upstream-snapshot
Merge into: curtin:master
Diff against target: 178 lines (+0/-172)
1 file modified
dev/null (+0/-172)
Reviewer Review Type Date Requested Status
Dan Watkins (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+391359@code.launchpad.net

Commit message

Drop tools/new-upstream-snapshot

It's just an older version of the new-upstream-snapshot script
maintained in the uss-tableflip repository [1].

[1] https://github.com/canonical/uss-tableflip

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dan Watkins (oddbloke) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/new-upstream-snapshot b/tools/new-upstream-snapshot
2deleted file mode 100755
3index 6b50979..0000000
4--- a/tools/new-upstream-snapshot
5+++ /dev/null
6@@ -1,172 +0,0 @@
7-#!/bin/sh
8-# This file is part of curtin. See LICENSE file for copyright and license info.
9-
10-TEMP_D=""
11-CR='
12-'
13-error() { echo "$@" 1>&2; }
14-fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
15-Usage() {
16-cat <<EOF
17-${0##*/} [branch]
18- update current branch with trunk branch.
19- branch defaults to 'master'
20-EOF
21-}
22-
23-print_commit() {
24- local subject="$1" author="$2" bugs="$3" aname="" abugs=""
25- local indent=" - " indent2=" " ll=79
26- aname=${author% <*}
27- [ "${aname}" = "Scott Moser" ] && aname=""
28- abugs="${aname:+ [${aname}]}${bugs:+ (LP: ${bugs})}"
29- if [ $((${#subject}+${#abugs})) -le $(($ll-${#indent})) ]; then
30- echo "${indent}${subject}${abugs}"
31- elif [ ${#subject} -ge $(($ll-${#indent})) ]; then
32- echo "${subject}${abugs}" |
33- fmt --width=$(($ll-${#indent})) |
34- sed -e "1s/^/${indent}/; 1n;" \
35- -e 's/^[ ]*//' \
36- -e '/^[ ]*$/d' -e "s/^/$indent2/" -e 's/[ ]\+$//'
37-
38- else
39- ( echo "${subject}"; echo "${abugs}" ) |
40- fmt --width=$(($ll-${#indent})) |
41- sed -e "1s/^/${indent}/; 1n;" \
42- -e 's/^[ ]*//' \
43- -e '/^[ ]*$/d' -e "s/^/$indent2/" -e 's/[ ]\+$//'
44- fi
45-}
46-
47-git_log_to_dch() {
48- local line="" commit="" lcommit="" bugs=""
49- while :; do
50- read line || break
51- case "$line" in
52- commit\ *)
53- if [ -n "$commit" ]; then
54- print_commit "$subject" "$author" "$bugs"
55- fi
56- commit=${line#*: }
57- bugs=""
58- author=""
59- subject=""
60- ;;
61- Author:*) author="${line#Author: }";;
62- LP:*) bugs="${bugs:+${bugs}, }${line#*: }";;
63- "") [ -z "$subject" ] && read subject;;
64- esac
65- done
66- if [ -n "$commit" ]; then
67- print_commit "$subject" "$author" "$bugs"
68- fi
69-}
70-cleanup() {
71- [ ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
72-}
73-
74-from_ref=${1:-"master"}
75-cur_branch=$(git rev-parse --abbrev-ref HEAD) ||
76- fail "failed to get current branch"
77-
78-case "$cur_branch" in
79- ubuntu/*) :;;
80- *) fail "You are on branch '$cur_branch', expect to be on ubuntu/*";;
81-esac
82-
83-TEMP_D=$(mktemp -d) || fail "failed mktemp"
84-trap cleanup EXIT
85-
86-prev_pkg_ver=$(dpkg-parsechangelog --show-field Version) ||
87- fail "failed reading package version"
88-pkg_name=$(dpkg-parsechangelog --show-field Source) ||
89- fail "failed to read Source from changelog"
90-
91-merge_base=$(git merge-base "$from_ref" HEAD) ||
92- fail "cannot find merge base for $from_ref and HEAD"
93-
94-new_pkg_debian="0ubuntu1"
95-new_upstream_ver=$(git describe --abbrev=8 "${from_ref}")
96-new_pkg_ver="${new_upstream_ver}-${new_pkg_debian}"
97-
98-prev_upstream_ver=${prev_pkg_ver%-*}
99-if [ "${prev_upstream_ver}" = "${new_upstream_ver}" ]; then
100- echo "nothing to commit. '$from_ref' is at ${new_upstream_ver}."
101- exit 0
102-fi
103-
104-dpseries="debian/patches/series"
105-if [ -e $dpseries ]; then
106- drops=""
107- while read bname extra; do
108- case "$bname" in
109- cpick-*)
110- commit=${bname#cpick-}
111- commit=${commit%%-*}
112- echo "bname=$bname commit=${commit}" 1>&2
113- if git merge-base --is-ancestor "$commit" "$from_ref"; then
114- drops="${drops} debian/patches/$bname"
115- fi
116- ;;
117- *) echo "$bname${extra:+ ${extra}}";;
118- esac
119- done < $dpseries > "${TEMP_D}/series"
120- drops=${drops# }
121- if [ -n "$drops" ]; then
122- cp "${TEMP_D}/series" "$dpseries" ||
123- fail "failed copying to $dpseries"
124- if [ ! -s $dpseries ]; then
125- git rm --force "$dpseries" ||
126- fail "failed removing empty $dpseries: git rm $dpseries"
127- fi
128- msg="drop cherry picks before merge from ${from_ref} at $new_upstream_ver"
129- msg="$msg${CR}${CR}drop the following cherry picks:"
130- for file in $drops; do
131- git rm "$file" || fail "failed to git rm $file"
132- msg="${msg}$CR $file"
133- done
134- git commit -m "$msg" "$dpseries" $drops
135- fi
136-fi
137-
138-git merge "${from_ref}" -m "merge from $from_ref at $new_upstream_ver" ||
139- fail "failed: git merge ${from_ref} -m 'merge from $from_ref ..'"
140-clog="${TEMP_D}/changelog"
141-gitlog="${TEMP_D}/gitlog"
142-
143-git log --first-parent --no-decorate --format=full \
144- "${merge_base}..${from_ref}" > "$gitlog" ||
145- fail "failed git log ${merge_base}..${from_ref}"
146-
147-cat >> "$clog" <<EOF
148-$pkg_name ($new_pkg_ver) UNRELEASED; urgency=medium
149-
150- * New upstream snapshot.
151-EOF
152-git_log_to_dch < "$gitlog" >> "$clog" ||
153- fail "failed git_log_to_dch"
154-cat >> "$clog" <<EOF
155-
156- -- ${DEBFULLNAME} <$DEBEMAIL> $(date -R)
157-
158-EOF
159-
160-cat "$clog" "debian/changelog" > "$TEMP_D/newlog" &&
161- cp "$TEMP_D/newlog" "debian/changelog" ||
162- fail "failed replacing debian/changelog"
163-
164-dch -e || fail "dch -e exited $?"
165-
166-git diff
167-
168-echo -n "Commit this change? (Y/n): "
169-read answer || fail "failed to read answer"
170-case "$answer" in
171- n|[Nn][oO]) exit 1;;
172-esac
173-
174-msg="update changelog (new upstream snapshot $new_upstream_ver)."
175-git commit -m "$msg" debian/changelog ||
176- fail "failed to commit '$msg'"
177-
178-# vi: ts=4 expandtab syntax=sh

Subscribers

People subscribed via source and target branches