diff options
authorStefan Christ <>2016-04-12 10:48:58 +0200
committerStefan Müller-Klieser <>2016-04-18 10:24:07 +0200
commit8d41eecb2b3557596c218522822b4e8e9d935ddd (patch)
parentaf23a97e6083dbce7b99e6fd8a8ca79441b4bea9 (diff)
phygittag: fix BRANCH for upstream tags
It should be possible to use upstream tags in your barebox/kernel recipes for our integration branches. A recipe with uses the upstream tag directly without phytec local patches may look like: # recipe filename inherit phygittag GIT_URL = "git://${PN}" SRC_URI = "${GIT_URL};branch=${BRANCH};protocol=git" ... The phygittag bbclass will generate BRANCH = "v4.1.18-phy" GIT_TAG = "v4.1.18" This setup assumes that the tag "v4.1.18" is available in the repository git:// and the branch "v4.1.18-phy" exists in this repository. Signed-off-by: Stefan Christ <> Signed-off-by: Stefan Müller-Klieser <>
1 files changed, 16 insertions, 6 deletions
diff --git a/classes/phygittag.bbclass b/classes/phygittag.bbclass
index 74af9d6..8b48091 100644
--- a/classes/phygittag.bbclass
+++ b/classes/phygittag.bbclass
@@ -102,9 +102,19 @@ GIT_TAG = "v${_PV_FILE}"
PV = "${@oe.utils.conditional("SRCREV", "AUTOINC", "${_PV_FILE}+git${SRCPV}", "${_PV_FILE}", d)}"
-# Extract the branch from version string in filename:
-# NOTE: The package version is for example "2014.11.0-phy1", but the upstream
-# repository uses the tag name "v2014.11.0" in the branch name. Therefore the
-# upstream branch name is "v2014.11.0-phy", so we must prefixd the version with
-# "v".
-BRANCH = "v${@"${_PV_FILE}".rstrip("0123456789")}"
+# Extract the phytec branch from version string in filename:
+# The package version is for example a phytec version "2014.11.0-phy1" and
+# "4.1.18-phy4". Or a upstream version like "2014.11.0" or "4.1.18" if the
+# recipe is based on a upstream version without local changes.
+# The function converts the version from the filename to a phytec integration
+# branch. Names look like "v2014.11.0-phy" or "v4.1.18-phy".
+def git_tag_to_integration_branch(_pv_file):
+ if "-phy" in _pv_file:
+ # Is a phytec version, based on a upstream tag. Remove numbers and
+ # add "v" for tag name.
+ return "v" + _pv_file.rstrip("0123456789")
+ else:
+ # Is a original upstream version like "2014.11.0" or "4.1.18".
+ return "v" + _pv_file + "-phy"
+BRANCH = "${@git_tag_to_integration_branch("${_PV_FILE}")}"