summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Christ <s.christ@phytec.de>2016-04-12 08:48:58 (GMT)
committerStefan Müller-Klieser <s.mueller-klieser@phytec.de>2016-04-18 08:24:07 (GMT)
commit8d41eecb2b3557596c218522822b4e8e9d935ddd (patch)
treea2b4201f1c34e31e863a05d2650d7073eed5002e
parentaf23a97e6083dbce7b99e6fd8a8ca79441b4bea9 (diff)
downloadmeta-phytec-8d41eecb2b3557596c218522822b4e8e9d935ddd.zip
meta-phytec-8d41eecb2b3557596c218522822b4e8e9d935ddd.tar.bz2
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 linux-mainline_4.1.18.bb inherit phygittag GIT_URL = "git://git.phytec.de/${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://git.phytec.de/linux-mainline and the branch "v4.1.18-phy" exists in this repository. Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
-rw-r--r--classes/phygittag.bbclass22
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}")}"