manifest_get_default_revision must deal with / in branch names

When the manifest default revision is 'r/stx.6.0',
manifest_get_default_revision was returning 'r'.
A sed clause intended to catch '/>' was grabbing the wrong
'/' character.

Split the sed expression into two seperate expressions.

Tested with:
   <default revision="r/stx.6.0" remote="stx-staging"/>
   <default revision="stx.6.0" remote="stx-staging"/>
   <default revision="r/stx.6.0"/>
   <default revision="stx.6.0"/>

Closes-Bug: 1959444
Change-Id: I3a271f6f89cea94898598c90ed2d2be59ddc60d5
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2022-01-28 14:21:52 -05:00
parent c1d3406c4f
commit 955ec0af14

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# Copyright (c) 2020-2021 Wind River Systems, Inc.
# Copyright (c) 2020-2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -189,7 +189,10 @@ manifest_get_revision_of_project () {
manifest_get_default_revision () {
local manifest="${1}"
grep '<default' $manifest |sed -e 's#.*revision=\([^ /]*\).*#\1#' -e 's#"##g' -e "s#'##g"
grep '<default' $manifest | \
sed -e 's#.*revision="\([^"]*\).*#\1#' \
-e 's#.*revision=\([^ >]*\).*#\1#' \
-e 's#/$##'
}
#