osmith submitted this change.
obs: add --git-skip-checkout argument
Prepare to use this for wireshark, to build a branch on-the-fly that
does not get pushed to origin, with Osmocom patches on top of upstream
master.
Related: OS#2537
Change-Id: Ifc963daf51ba3542f67420daaf7b29745404a92e
---
M scripts/obs/lib/__init__.py
M scripts/obs/lib/git.py
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/scripts/obs/lib/__init__.py b/scripts/obs/lib/__init__.py
index edf19f4..675bcec 100644
--- a/scripts/obs/lib/__init__.py
+++ b/scripts/obs/lib/__init__.py
@@ -36,6 +36,9 @@
parser.add_argument("-s", "--git-skip-fetch",
help="do not fetch already cloned git repositories",
action="store_false", dest="git_fetch")
+ parser.add_argument("-S", "--git-skip-checkout",
+ help="do not checkout and reset to a branch/tag",
+ action="store_false", dest="git_checkout")
parser.add_argument("-m", "--meta", action="store_true",
help="build a meta package (e.g. osmocom-nightly)")
parser.add_argument("-i", "--ignore-req", action="store_true",
diff --git a/scripts/obs/lib/git.py b/scripts/obs/lib/git.py
index f1ee98d..15cb276 100644
--- a/scripts/obs/lib/git.py
+++ b/scripts/obs/lib/git.py
@@ -53,6 +53,11 @@
def checkout(project, branch):
repo_path = get_repo_path(project)
+ if not lib.args.git_checkout:
+ ref = lib.run_cmd(["git", "log", "--pretty=oneline", "--abbrev-commit",
+ "-1"], cwd=repo_path).output.rstrip()
+ print(f"{project}: skipping git checkout, current commit: {ref}")
+ return
print(f"{project}: 'git checkout -f {branch}'")
lib.run_cmd(["git", "checkout", "-f", branch], cwd=repo_path)
print(f"{project}: 'git reset --hard {branch}'")
To view, visit change 31934. To unsubscribe, or for help writing mail filters, visit settings.