diff --git a/tests/meson.build b/tests/meson.build index 9a6c88d..f7721ce 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -15,6 +15,7 @@ tests = [ 'umpf-series-tag', 'umpf-build-tag', 'umpf-build-tag-identical', + 'umpf-build-tag-upstreamstatus', 'umpf-series-tag-continue', 'umpf-series-tag-rerere', 'umpf-series-tag-continue-flags', diff --git a/tests/series-upstreamstatus-v2.ref b/tests/series-upstreamstatus-v2.ref new file mode 100644 index 0000000..a0c5329 --- /dev/null +++ b/tests/series-upstreamstatus-v2.ref @@ -0,0 +1,11 @@ +# umpf-base: base +# umpf-flags: upstreamstatus=insert +# umpf-name: name +# umpf-version: name/20221209-2 +# umpf-topic: a +# umpf-hashinfo: f46ed0419d2c31ed10f978cc461e0d1ae4b3b426 +# umpf-topic-range: d306da785d874c09b89264d3f71632bc14bfe51f..121863a14e5f5430eea076205d50d668aeb66aa3 +# umpf-topic: b +# umpf-hashinfo: 3755a03cf640725df1aeb13789cba87154a47b04 +# umpf-topic-range: 121863a14e5f5430eea076205d50d668aeb66aa3..83884ac6f3420eb1b1c98628b64dc1a77b6c1136 +# umpf-end diff --git a/tests/umpf-build-tag-upstreamstatus b/tests/umpf-build-tag-upstreamstatus new file mode 100644 index 0000000..aeaf3e7 --- /dev/null +++ b/tests/umpf-build-tag-upstreamstatus @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Test creating an umpf tag from an umpf build with "umpf tag". +# + +umpf tag umpf-build --version=2 --remote=origin --base=base --name=name --flags upstreamstatus=insert + +git log --format=%B -n 1 | grep "^# umpf-" > series.tag +diff -u ${TEST_DIR}/series-upstreamstatus-v2.ref series.tag diff --git a/umpf b/umpf index b1fe1da..331aa45 100755 --- a/umpf +++ b/umpf @@ -82,12 +82,18 @@ GIT_DIR="${GIT_DIR:-.git}" STATE="${GIT_DIR}/umpf" ### flags #### -SUPPORTED_FLAGS=("extraversion") +SUPPORTED_FLAGS=("extraversion" "upstreamstatus") declare -A flag_extraversion flag_extraversion[val]="replace" flag_extraversion[values]="replace conflictfree" + +declare -A flag_upstreamstatus + +flag_upstreamstatus[val]="none" +flag_upstreamstatus[values]="none insert" + ############## info() { @@ -1105,7 +1111,30 @@ rebase_branch() { committerdate="$(${GIT} log -1 --format=%cd --date=raw "$(<"${STATE}/base")")" fi - 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 + declare -a msg_filter + if [ "${flag_upstreamstatus[val]}" = "insert" ]; then + msg_filter=( + --msg-filter + "awk ' + /^Upstream-Status:/ { + done=1 + } + /^[^\s]*-by:/ { + if (!done) { + print \"Upstream-Status: Pending\n\" + done=1 + } + } + { + print \$0 + } + END { + if (!done) + print \"\nUpstream-Status: Pending\" + }'" ) + fi + + 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 bailout "rewrite for reproducible commit-ish failed." fi echo "# umpf-topic-range: $(<"${STATE}/prev_head")..$(${GIT} rev-parse HEAD)" >&${series_out} @@ -1233,7 +1262,13 @@ rebase_end() { fi if ! ${GIT} diff-index --cached --quiet HEAD --; then local tagname="$(<"${STATE}/tag")" - ${GIT} commit --no-verify -m "Release ${tagname}" + local extra_message + if [ "${flag_upstreamstatus[val]}" = "insert" ]; then + extra_message=" + +Upstream-Status: Inappropriate [autogenerated]" + fi + ${GIT} commit --no-verify -m "Release ${tagname}${extra_message}" echo "# umpf-release: ${tagname}" >&${series_out} echo "# umpf-topic-range: $(<"${STATE}/prev_head")..$(${GIT} rev-parse HEAD)" >&${series_out} fi @@ -1428,6 +1463,11 @@ run_format_patch() { done if ${BB}; then cp "${STATE}/series.next" "${PATCH_DIR}/series.inc" + if [ "${flag_upstreamstatus[val]}" != "insert" ]; then + info + info "Note: Patches are created without Upstream-Status!" + info + fi elif ${NIX}; then cp "${STATE}/series.next" "${PATCH_DIR}/series.nix" else