Skip to content

Commit

Permalink
format-patch: correctly set UMPF_VERSION with --bb
Browse files Browse the repository at this point in the history
UMPF_VERSION is taken from ${STATE}/version, but this file is never
written when we don't set STABLE for the "version" branch of parse().
Additionally, the version must be parsed back from the input series,
otherwise it will always be initialised to "-1", with the result that
UMPF_VERSION always ends in "-1" even when format-patch'ing an umpf that
was built with -v2 or greater.

Update the test case with an appropriate tag name.

Fixes: 8d0d4cc (2024-03-06, "umpf: output version infos to bitbake variables during format-patch")
  • Loading branch information
rohieb committed Mar 14, 2024
1 parent 48d63ec commit 5394783
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/series-format-patch-bb.ref
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# umpf-base: base
# umpf-name: name
# umpf-version: name/20221209-1
# umpf-version: name/20240314-2
# umpf-topic: a
# umpf-hashinfo: f46ed0419d2c31ed10f978cc461e0d1ae4b3b426
# umpf-topic-range: d306da785d874c09b89264d3f71632bc14bfe51f..b2b9f854952b0be84ba2472f236783d09bfa6561
Expand All @@ -14,6 +14,6 @@ SRC_URI += "\
file://patches/0101-b1.patch \
"
UMPF_BASE = "base"
UMPF_VERSION = "20221209-1"
UMPF_VERSION = "20240314-2"
PV = "${UMPF_BASE}-${UMPF_VERSION}"
# umpf-end
2 changes: 2 additions & 0 deletions tests/test-git/info/refs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ f46ed0419d2c31ed10f978cc461e0d1ae4b3b426 refs/heads/a
d306da785d874c09b89264d3f71632bc14bfe51f refs/heads/master
d306da785d874c09b89264d3f71632bc14bfe51f refs/tags/base
9f80efc9c56cd60aa8059a2e599ae4a0e5611521 refs/tags/name/20221209-1
cafa4a9cf5da347772533d93fc33040b5d961978 refs/tags/name/20240314-2
a815789db19080f83c2fe01a8fdf41e8172eb33e refs/tags/name/20240314-2^{}
402a5929b9e015d35a6b07e4632c5c1a26d0e782 refs/tags/umpf-build
c42a48897afca146023190ae073373e4d491807e refs/tags/umpf-merge
9f80efc9c56cd60aa8059a2e599ae4a0e5611521 refs/tags/umpf-tag
Binary file modified tests/test-git/objects/info/commit-graph
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test-git/objects/info/packs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
P pack-1ba3875ef90f58e563d875a54cff75687436a9b0.pack
P pack-308eb06292fe3f86a68fa9e5d6a98201d268f7f9.pack

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/test-git/packed-refs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ f46ed0419d2c31ed10f978cc461e0d1ae4b3b426 refs/heads/a
d306da785d874c09b89264d3f71632bc14bfe51f refs/heads/master
d306da785d874c09b89264d3f71632bc14bfe51f refs/tags/base
9f80efc9c56cd60aa8059a2e599ae4a0e5611521 refs/tags/name/20221209-1
cafa4a9cf5da347772533d93fc33040b5d961978 refs/tags/name/20240314-2
^a815789db19080f83c2fe01a8fdf41e8172eb33e
402a5929b9e015d35a6b07e4632c5c1a26d0e782 refs/tags/umpf-build
c42a48897afca146023190ae073373e4d491807e refs/tags/umpf-merge
9f80efc9c56cd60aa8059a2e599ae4a0e5611521 refs/tags/umpf-tag
2 changes: 1 addition & 1 deletion tests/umpf-format-patch-bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# Test creating a Yocto compatible patchset with "umpf format-patch --bb".
#

umpf format-patch umpf-tag --bb --patchdir=patches
umpf format-patch name/20240314-2 --bb --patchdir=patches

diff -u ${TEST_DIR}/series-format-patch-bb.ref patches/series.inc
6 changes: 5 additions & 1 deletion umpf
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,10 @@ parse() {
test -n "${content}" || bailout "${cmd} line without value"
if ${STABLE}; then
local name="$(<"${STATE}/name")"
local version="$(sed "s;${name}/\([0-9]\{8\}\)-.*;\1${VERSION_SEPARATOR}${VERSION};" <<< "${content}")"
if [ "${namespace}" = "format_patch" ]; then
VERSION="$(sed "s;${name}/[0-9]\{8\}${VERSION_SEPARATOR}\(.*\);\1;" <<< "${content}")"
fi
local version="$(sed "s;${name}/\([0-9]\{8\}\)${VERSION_SEPARATOR}.*;\1${VERSION_SEPARATOR}${VERSION};" <<< "${content}")"
local tagname="${name}/${version}"
echo "${version}" > "${STATE}/version"
echo "${tagname}" > "${STATE}/tag"
Expand Down Expand Up @@ -1457,6 +1460,7 @@ remove_patches() {
run_format_patch() {
exec {series_out}> >(tee -a "${STATE}/series.next")
STABLE=true
parse_series format_patch "${STATE}/series"
if [ -e "${STATE}/failed" ]; then
Expand Down

0 comments on commit 5394783

Please sign in to comment.