Skip to content

Commit e13c6c3

Browse files
umpf: add new flag to insert 'Upstream-Status: Pending' lines to all patches
Starting with the mickledore release, the upstream status is required for all patches in Yocto. Add a new flag "upstreamstatus" to handle this. If set to "insert", "Upstream-Status: Pending" is added to the commit message of all patches during "umpf tag". Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
1 parent ee2ec1b commit e13c6c3

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
lines changed

tests/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tests = [
1515
'umpf-series-tag',
1616
'umpf-build-tag',
1717
'umpf-build-tag-identical',
18+
'umpf-build-tag-upstreamstatus',
1819
'umpf-series-tag-continue',
1920
'umpf-series-tag-rerere',
2021
'umpf-series-tag-continue-flags',

tests/series-upstreamstatus-v2.ref

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# umpf-base: base
2+
# umpf-flags: upstreamstatus=insert
3+
# umpf-name: name
4+
# umpf-version: name/20221209-2
5+
# umpf-topic: a
6+
# umpf-hashinfo: f46ed0419d2c31ed10f978cc461e0d1ae4b3b426
7+
# umpf-topic-range: d306da785d874c09b89264d3f71632bc14bfe51f..121863a14e5f5430eea076205d50d668aeb66aa3
8+
# umpf-topic: b
9+
# umpf-hashinfo: 3755a03cf640725df1aeb13789cba87154a47b04
10+
# umpf-topic-range: 121863a14e5f5430eea076205d50d668aeb66aa3..83884ac6f3420eb1b1c98628b64dc1a77b6c1136
11+
# umpf-end

tests/umpf-build-tag-upstreamstatus

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
#
3+
# Test creating an umpf tag from an umpf build with "umpf tag".
4+
#
5+
6+
umpf tag umpf-build --version=2 --remote=origin --base=base --name=name --flags upstreamstatus=insert
7+
8+
git log --format=%B -n 1 | grep "^# umpf-" > series.tag
9+
diff -u ${TEST_DIR}/series-upstreamstatus-v2.ref series.tag

umpf

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ GIT_DIR="${GIT_DIR:-.git}"
8282
STATE="${GIT_DIR}/umpf"
8383

8484
### flags ####
85-
SUPPORTED_FLAGS=("extraversion")
85+
SUPPORTED_FLAGS=("extraversion" "upstreamstatus")
8686

8787
declare -A flag_extraversion
8888

8989
flag_extraversion[val]="replace"
9090
flag_extraversion[values]="replace conflictfree"
91+
92+
declare -A flag_upstreamstatus
93+
94+
flag_upstreamstatus[val]="none"
95+
flag_upstreamstatus[values]="none insert"
96+
9197
##############
9298

9399
info() {
@@ -1105,7 +1111,30 @@ rebase_branch() {
11051111
committerdate="$(${GIT} log -1 --format=%cd --date=raw "$(<"${STATE}/base")")"
11061112
fi
11071113
1108-
if ! FILTER_BRANCH_SQUELCH_WARNING=1 "${GIT}" filter-branch -f --env-filter "GIT_COMMITTER_DATE='$committerdate'; GIT_COMMITTER_NAME=umpf; GIT_COMMITTER_EMAIL=entwicklung@pengutronix.de" "$(<"${STATE}/prev_head").."; then
1114+
declare -a msg_filter
1115+
if [ "${flag_upstreamstatus[val]}" = "insert" ]; then
1116+
msg_filter=(
1117+
--msg-filter
1118+
"awk '
1119+
/^Upstream-Status:/ {
1120+
done=1
1121+
}
1122+
/^[^\s]*-by:/ {
1123+
if (!done) {
1124+
print \"Upstream-Status: Pending\n\"
1125+
done=1
1126+
}
1127+
}
1128+
{
1129+
print \$0
1130+
}
1131+
END {
1132+
if (!done)
1133+
print \"\nUpstream-Status: Pending\"
1134+
}'" )
1135+
fi
1136+
1137+
if ! FILTER_BRANCH_SQUELCH_WARNING=1 "${GIT}" filter-branch -f "${msg_filter[@]}" --env-filter "GIT_COMMITTER_DATE='$committerdate'; GIT_COMMITTER_NAME=umpf; GIT_COMMITTER_EMAIL=entwicklung@pengutronix.de" "$(<"${STATE}/prev_head").."; then
11091138
bailout "rewrite for reproducible commit-ish failed."
11101139
fi
11111140
echo "# umpf-topic-range: $(<"${STATE}/prev_head")..$(${GIT} rev-parse HEAD)" >&${series_out}
@@ -1233,7 +1262,13 @@ rebase_end() {
12331262
fi
12341263
if ! ${GIT} diff-index --cached --quiet HEAD --; then
12351264
local tagname="$(<"${STATE}/tag")"
1236-
${GIT} commit --no-verify -m "Release ${tagname}"
1265+
local extra_message
1266+
if [ "${flag_upstreamstatus[val]}" = "insert" ]; then
1267+
extra_message="
1268+
1269+
Upstream-Status: Inappropriate [autogenerated]"
1270+
fi
1271+
${GIT} commit --no-verify -m "Release ${tagname}${extra_message}"
12371272
echo "# umpf-release: ${tagname}" >&${series_out}
12381273
echo "# umpf-topic-range: $(<"${STATE}/prev_head")..$(${GIT} rev-parse HEAD)" >&${series_out}
12391274
fi
@@ -1428,6 +1463,11 @@ run_format_patch() {
14281463
done
14291464
if ${BB}; then
14301465
cp "${STATE}/series.next" "${PATCH_DIR}/series.inc"
1466+
if [ "${flag_upstreamstatus[val]}" != "insert" ]; then
1467+
info
1468+
info "Note: Patches are created without Upstream-Status!"
1469+
info
1470+
fi
14311471
elif ${NIX}; then
14321472
cp "${STATE}/series.next" "${PATCH_DIR}/series.nix"
14331473
else

0 commit comments

Comments
 (0)