obs: add --allow-unknown-package

Prepare to add a wireshark package. It will be in its own
osmocom:wireshark repository, and not in osmocom:nightly, :latest,
:master, so it's not added to lib/config.py.

Move lib.set_args() before parse_packages(), so the latter is able to
use lib.args.allow_unknown_package.

Related: OS#2537
Change-Id: I007f937ccb629e0593ec9253541ed05df42fac66
This commit is contained in:
Oliver Smith 2023-03-15 13:33:22 +01:00
parent 3ccebc4514
commit dc1415959f
2 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,9 @@ def add_shared_arguments(parser):
" other feeds build their respective branch.",
metavar="FEED", default="nightly",
choices=lib.config.feeds)
parser.add_argument("-a", "--allow-unknown-package", action="store_true",
help="don't complain if the name of the package is not"
" stored in lib/config.py")
parser.add_argument("-b", "--git-branch", help="instead of using a branch"
" based on the feed, checkout this git branch",
metavar="BRANCH", default=None)
@ -102,6 +105,9 @@ def set_proper_package_name(package):
if os.path.basename(package_cfg) == package:
return package_cfg
if lib.args.allow_unknown_package:
return package
print(f"ERROR: unknown package: {package}")
print("See packages_osmocom and packages_other in obs/lib/config.py")
exit(1)

View File

@ -194,9 +194,8 @@ def main():
help="package name, e.g. libosmocore or open5gs,"
" default is all packages")
args = parser.parse_args()
packages = parse_packages(args.package)
lib.set_args(args)
packages = parse_packages(args.package)
if args.docker:
lib.docker.run_in_docker_and_exit("update_obs_project.py", True)