From d1e1625a7f5176d08b750bf325c9c7d37b80c3d4 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Thu, 16 Nov 2023 22:47:08 +0100 Subject: [PATCH] umpf: fix ignoring flags The flags implementation loses the flags if they are provided via umpf build followed by an umpf tag, e.g: - umpf build && umpf tag - umpf build --flags && umpf tag In this case the flags are lost. Fix this by storing the flags and adding a build note like it is done for base and name. Signed-off-by: Marco Felsch --- umpf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/umpf b/umpf index 8b599a1..32b5321 100755 --- a/umpf +++ b/umpf @@ -590,8 +590,9 @@ import_series() { base_rev="$(${GIT} merge-base "${base_rev}^1" "${base_rev}^2")" exec {revlistfd}< <(${GIT} rev-list --merges --topo-order --parents "${base_rev}...${import}") while read head base merges <&${revlistfd}; do - local magic base name + local magic base name flags exec {localfd}< <(${GIT} notes show "${head}" 2>/dev/null) + # Reading git notes must be in sync with run_build() while read magic base name <&${localfd}; do if [ "${magic}" = "umpf-build-note:" ]; then BASE="${BASE:-${base}}" @@ -599,6 +600,12 @@ import_series() { break fi done + while read magic flags <&${localfd}; do + if [ "${magic}" = "umpf-build-flags:" ]; then + FLAGS="${FLAGS:-${flags}}" + break + fi + done exec {localfd}<&- if [[ -n "${BASE}" && -n "${NAME}" ]]; then break @@ -861,6 +868,7 @@ parse() { echo "${line}" >> "${STATE}/done" content="${FLAGS}" line="# umpf-flags: ${content}" + echo "${content}" > "${STATE}/flags" do_exec flags fi ;; @@ -868,6 +876,7 @@ parse() { ${has_base} || bailout "${cmd} before base" test -n "${content}" || bailout "${cmd} line without value" if [ -z "${FLAGS}" ]; then + echo "${content}" > "${STATE}/flags" do_exec flags fi ;; @@ -1481,6 +1490,7 @@ build_hashinfo() { run_build() { parse_series build "${STATE}/series" ${GIT} notes add -m "umpf-build-note: $(<"${STATE}/base-name") $(<"${STATE}/name")" + [ -f "${STATE}/flags" ] && ${GIT} notes append -m "umpf-build-flags: $(<"${STATE}/flags")" cleanup }