[gnome-build-meta/abderrahim/update-refs-script: 5/5] Add script to update refs




commit 0462974259ab1e1439bcf302c35823e22dd83cbc
Author: Abderrahim Kitouni <abderrahim kitouni codethink co uk>
Date:   Tue Oct 4 15:49:18 2022 +0200

    Add script to update refs

 utils/update-refs.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
---
diff --git a/utils/update-refs.py b/utils/update-refs.py
new file mode 100755
index 000000000..2244c8616
--- /dev/null
+++ b/utils/update-refs.py
@@ -0,0 +1,51 @@
+#! /usr/bin/env python3
+
+import argparse
+import os
+import subprocess
+from datetime import datetime
+
+parser = argparse.ArgumentParser()
+parser.add_argument(
+    "--switch-branch", help="Commit to a new branch after tracking", action="store_true"
+)
+args = parser.parse_args()
+
+now = datetime.now()
+
+track_elements = [
+    "core.bst",
+    "flatpak-runtimes.bst",
+    "vm/image.bst",
+    "boards/pinebook-pro/image.bst",
+    "boards/pinephone/image.bst",
+    "boards/pinephone-pro/image.bst",
+    "boards/rock64/image.bst",
+    "boards/raspberrypi-4/image.bst",
+    "vm/repo-devel.bst",
+    "iso/image.bst",
+]
+
+bst_command = os.environ.get("BST", "bst").split()
+
+
+def git(*args):
+    return subprocess.check_call(["git"] + list(args))
+
+
+def bst(*args):
+    return subprocess.check_call(bst_command + ["--no-interactive"] + list(args))
+
+
+bst("track", "--deps", "all", *track_elements)
+
+if args.switch_branch:
+    git(
+        "switch",
+        "--force-create",
+        "update-bot/" + now.strftime("%F-%H-%M"),
+    )
+
+    git("add", "--update", ".")
+
+    git("commit", "--message", "Update element refs")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]