All of lore.kernel.org
 help / color / mirror / Atom feed
* [yocto-autobuilder-helper][PATCH] prepare-shared-repos: Allow to tag poky git
@ 2024-11-15 14:02 mathieu.dubois-briand
  2024-11-15 14:21 ` [yocto-patches] " Quentin Schulz
  0 siblings, 1 reply; 3+ messages in thread
From: mathieu.dubois-briand @ 2024-11-15 14:02 UTC (permalink / raw)
  To: yocto-patches; +Cc: Mathieu Dubois-Briand

From: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 scripts/prepare-shared-repos |  6 ++++++
 scripts/utils.py             | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/scripts/prepare-shared-repos b/scripts/prepare-shared-repos
index 1b756520b701..3d10af4e6d63 100755
--- a/scripts/prepare-shared-repos
+++ b/scripts/prepare-shared-repos
@@ -16,6 +16,7 @@ import tempfile
 
 import utils
 
+poky_tag_remote = "git@push.yoctoproject.org:poky-ci-archive"
 
 parser = utils.ArgParser(description='Iterates over a set of repositories in a json file and sets up a shared directory containing them.')
 
@@ -26,6 +27,9 @@ parser.add_argument('sharedsrcdir',
 parser.add_argument('-p', '--publish-dir',
                     action='store',
                     help="Where to publish artefacts to (optional)")
+parser.add_argument('-t', '--tag',
+                    action='store',
+                    help="Git tag to create (optional)")
 
 args = parser.parse_args()
 
@@ -49,6 +53,8 @@ with tempfile.TemporaryDirectory(prefix="shared-repo-temp-", dir="/home/pokybuil
             utils.fetchgitrepo(tempdir, repo, repos[repo], stashdir, depth=1)
         if args.publish_dir:
             utils.publishrepo(tempdir, repo, args.publish_dir)
+        if repo == "poky" and args.tag:
+            utils.taggitrepo(tempdir, repo, repos[repo], poky_tag_remote, args.tag)
 
     utils.printheader("Creating shared src tarball")
     subprocess.check_call("tar -I zstd -cf " + args.sharedsrcdir.rstrip("/") + ".tar.zst ./*", shell=True, cwd=tempdir)
diff --git a/scripts/utils.py b/scripts/utils.py
index 8e6463d8c62c..122a56d3c3e4 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -280,6 +280,16 @@ def fetchgitrepo(clonedir, repo, params, stashdir, depth=None):
     subprocess.check_call(["git", "reset", "origin/" + branch, "--hard"], cwd=sharedrepo)
     subprocess.check_call(["git", "reset", revision, "--hard"], cwd=sharedrepo)
 
+def taggitrepo(clonedir, repo, params, tagremote, tagname):
+    sharedrepo = "%s/%s" % (clonedir, repo)
+    revision = params["revision"]
+    print("Creating tag...")
+    subprocess.check_call(["git", "tag", tagname, revision], cwd=sharedrepo)
+    print("Pushing tag...")
+    subprocess.check_call(["git", "remote", "add", "tag", tagremote], cwd=sharedrepo)
+    subprocess.check_call(["git", "push", "tag", tagname], cwd=sharedrepo)
+    subprocess.check_call(["git", "remote", "rm", "tag"], cwd=sharedrepo)
+
 def publishrepo(clonedir, repo, publishdir):
     sharedrepo = "%s/%s" % (clonedir, repo)
     revision = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=sharedrepo).decode('utf-8').strip()
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-15 14:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15 14:02 [yocto-autobuilder-helper][PATCH] prepare-shared-repos: Allow to tag poky git mathieu.dubois-briand
2024-11-15 14:21 ` [yocto-patches] " Quentin Schulz
2024-11-15 14:27   ` Mathieu Dubois-Briand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.