diff options
author | Oliver Smith <osmith@sysmocom.de> | 2023-03-15 13:26:57 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2023-03-15 18:25:52 +0100 |
commit | 8d137c66a7df2d99687d99e22e886be8765428ff (patch) | |
tree | 50afbff2fee2e6d06d88972e8679e0c9e7935ee1 | |
parent | f7ff90d64b0957d5057c47674db1aadb256804dd (diff) |
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
-rw-r--r-- | scripts/obs/lib/__init__.py | 3 | ||||
-rw-r--r-- | scripts/obs/lib/git.py | 5 |
2 files changed, 8 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 @@ def add_shared_arguments(parser): 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 clean(project): 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}'") |