forked from osmocom/osmo-ci
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
This commit is contained in:
parent
f7ff90d64b
commit
8d137c66a7
|
@ -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",
|
||||
|
|
|
@ -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}'")
|
||||
|
|
Loading…
Reference in New Issue