1
0
Fork 0

obs: lib.args: store argparse result here

Prepare to add more arguments to the OBS scripts, so they can be used
for building the wireshark package in its own OBS project.

It was not so clear to me when writing this initially, but with more and
more arguments getting added: it's not very maintainable to pass each
variable from the argparse result several functions down to where it
gets used... so unfortunately this means the code needs to be refactored
to just use libs.args in the few lines of code where the arguments
actually get used.

This patch adds lib.args, and the next patches refactor existing code to
use it instead of passing parameters, where it makes sense. After that
follow the patches related to adding the wireshark package.

Related: OS#2537
Change-Id: I48853444f1386dfb842c174ebc45f9decc8bec0f
This commit is contained in:
Oliver Smith 2023-03-15 11:48:33 +01:00
parent 719ff97608
commit 9337c6c035
4 changed files with 13 additions and 3 deletions

View File

@ -38,7 +38,7 @@ def main():
help="package name, e.g. libosmocore")
args = parser.parse_args()
lib.set_cmds_verbose(args.verbose)
lib.set_args(args)
srcdir = f"{lib.config.path_temp}/srcpkgs/{args.package}"
if not os.path.exists(srcdir):

View File

@ -28,7 +28,7 @@ def main():
print("ERROR: specify -m and/or a package. See -h for help.")
exit(1)
lib.set_cmds_verbose(args.verbose)
lib.set_args(args)
if args.docker:
lib.docker.run_in_docker_and_exit("build_srcpkg.py")

View File

@ -10,6 +10,10 @@ import tempfile
import inspect
import lib.config
# Argparse result
args = None
# Print output of commands as they run, not only on error
cmds_verbose = False
@ -60,6 +64,12 @@ def set_cmds_verbose(new_val):
cmds_verbose = new_val
def set_args(new_val):
global args
args = new_val
set_cmds_verbose(args.verbose)
def check_required_programs():
ok = True

View File

@ -199,7 +199,7 @@ def main():
branch = args.git_branch
packages = parse_packages(args.package)
lib.set_cmds_verbose(args.verbose)
lib.set_args(args)
if args.docker:
lib.docker.run_in_docker_and_exit("update_obs_project.py", True)