[1/2] repo: Use separate task for patching repo rev

Message ID 20211206181513.6944-1-jasper@fancydomain.eu
State Accepted, archived
Commit beb5878bfd600ba8c9b53aa9d6b038838697b97d
Headers show
Series [1/2] repo: Use separate task for patching repo rev | expand

Commit Message

Jasper Orschulko Dec. 6, 2021, 6:15 p.m. UTC
From: Jasper Orschulko <Jasper.Orschulko@iris-sensing.com>

Using a task instead of a version specific patch for setting the repo
revision within the source code. This drastically decreases the
maintenance burden and easier usage of the OE update helper.

Signed-off-by: Jasper Orschulko <Jasper.Orschulko@iris-sensing.com>
---
 .../0001-Set-REPO_REV-to-v2.17.3.patch        | 35 -------------------
 meta/recipes-devtools/repo/repo_2.17.3.bb     |  9 +++--
 2 files changed, 7 insertions(+), 37 deletions(-)
 delete mode 100644 meta/recipes-devtools/repo/repo-2.17.3/0001-Set-REPO_REV-to-v2.17.3.patch

Patch

diff --git a/meta/recipes-devtools/repo/repo-2.17.3/0001-Set-REPO_REV-to-v2.17.3.patch b/meta/recipes-devtools/repo/repo-2.17.3/0001-Set-REPO_REV-to-v2.17.3.patch
deleted file mode 100644
index 60f1086b32..0000000000
--- a/meta/recipes-devtools/repo/repo-2.17.3/0001-Set-REPO_REV-to-v2.17.3.patch
+++ /dev/null
@@ -1,35 +0,0 @@ 
-From bdd2a528da59c28db8ae2986834926de7cebf3ab Mon Sep 17 00:00:00 2001
-From: Jasper Orschulko <Jasper.Orschulko@iris-sensing.com>
-Date: Thu, 4 Nov 2021 16:55:12 +0100
-Subject: [PATCH] Set REPO_REV to v2.17.3
-
-repo is an unusual tool because it downloads all of its own Python modules
-using GPG-signed git tags, and stores those files as part of the project
-that it is working with.
-
-So in order to have a reproducible repo installation within the project
-folders, we hardcode the default REPO_REV to a SHA1 that corresponds to
-the version of the recipe. REPO_REV can still be overwriten by the user,
-by specifying the REPO_REV environment variable.
-
-Upstream-Status: Inappropriate [configuration]
-Signed-off-by: Jasper Orschulko <Jasper.Orschulko@iris-sensing.com>
----
- repo | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/repo b/repo
-index 4cddbf1..5c3551f 100755
---- a/repo
-+++ b/repo
-@@ -144,7 +144,7 @@ if not REPO_URL:
-   REPO_URL = 'https://gerrit.googlesource.com/git-repo'
- REPO_REV = os.environ.get('REPO_REV')
- if not REPO_REV:
--  REPO_REV = 'stable'
-+  REPO_REV = '11b30b91df1f0e03b53da970ec2588e85817bacc'
- # URL to file bug reports for repo tool issues.
- BUG_URL = 'https://bugs.chromium.org/p/gerrit/issues/entry?template=Repo+tool+issue'
- 
--- 
-2.34.0
diff --git a/meta/recipes-devtools/repo/repo_2.17.3.bb b/meta/recipes-devtools/repo/repo_2.17.3.bb
index f7bbb22964..aeaec13dd7 100644
--- a/meta/recipes-devtools/repo/repo_2.17.3.bb
+++ b/meta/recipes-devtools/repo/repo_2.17.3.bb
@@ -12,13 +12,18 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 SRC_URI = "git://gerrit.googlesource.com/git-repo.git;protocol=https;branch=main"
 SRCREV = "11b30b91df1f0e03b53da970ec2588e85817bacc"
 
-SRC_URI += "file://0001-python3-shebang.patch \
-            file://0001-Set-REPO_REV-to-v2.17.3.patch"
+SRC_URI += "file://0001-python3-shebang.patch"
 
 MIRRORS += "git://gerrit.googlesource.com/git-repo.git git://github.com/GerritCodeReview/git-repo.git"
 
 S = "${WORKDIR}/git"
 
+do_set_fixed_rev() {
+    sed -Ei "s/REPO_REV\s*=\s*('|\")stable('|\")/REPO_REV = '${SRCREV}'/g" ${S}/repo
+}
+
+do_patch[postfuncs] += "do_set_fixed_rev"
+
 do_install() {
 	install -D ${WORKDIR}/git/repo ${D}${bindir}/repo
 }