obs: support Osmocom projects without prefix

Allow running build_srcpkg.py with "osmo_dia2gsup" instead of
"erlang/osmo_dia2gsup", because that's how it gets passed along from
jobs/gerrit-verifications.yml for the binary package build
verifications.

Related: OS#2385
Change-Id: I09304b219e7002495bd3fcce61bc68c34d5ffcd8
This commit is contained in:
Oliver Smith 2022-10-07 15:11:30 +02:00
parent 4e679c8f2e
commit 9c2e2575a9
3 changed files with 12 additions and 7 deletions

View File

@ -37,7 +37,7 @@ def main():
lib.check_required_programs()
if args.package:
lib.check_package(args.package)
args.package = lib.set_proper_package_name(args.package)
lib.remove_temp()
if args.meta:

View File

@ -78,11 +78,16 @@ def check_required_programs():
exit(1)
def check_package(package):
def set_proper_package_name(package):
if package in lib.config.projects_osmocom:
return
return package
if package in lib.config.projects_other:
return
return package
# Add prefix to Osmocom package if missing
for package_cfg in lib.config.projects_osmocom:
if os.path.basename(package_cfg) == package:
return package_cfg
print(f"ERROR: unknown package: {package}")
print("See packages_osmocom and packages_other in obs/lib/config.py")

View File

@ -20,13 +20,13 @@ srcpkgs_updated = [] # list of pkgnames
def parse_packages(packages_arg):
ret = []
if packages_arg:
for package in packages_arg:
lib.check_package(package)
return packages_arg
ret += [lib.set_proper_package_name(package)]
return ret
# Default to all
ret = []
ret += lib.config.projects_osmocom
ret += lib.config.projects_other
return ret