forked from osmocom/osmo-ci
obs: don't pass branch through functions
Change-Id: I9ec6d04c51bc795dd9cd4738313e60a556791eb2
This commit is contained in:
parent
dd36e9f489
commit
06f7482a7e
|
@ -44,7 +44,7 @@ def main():
|
|||
lib.metapkg.build(args.conflict_version)
|
||||
|
||||
if args.package:
|
||||
lib.srcpkg.build(args.package, args.git_branch, args.conflict_version,
|
||||
lib.srcpkg.build(args.package, args.conflict_version,
|
||||
args.git_fetch, args.gerrit_id)
|
||||
|
||||
|
||||
|
|
|
@ -9,9 +9,10 @@ import lib.debian
|
|||
import lib.rpm_spec
|
||||
|
||||
|
||||
def checkout_for_feed(project, branch=None):
|
||||
def checkout_for_feed(project):
|
||||
""" checkout a commit, either latest tag or master or 20YY branch """
|
||||
feed = lib.args.feed
|
||||
branch = lib.args.git_branch
|
||||
if branch:
|
||||
lib.git.checkout(project, f"origin/{branch}")
|
||||
elif feed == "latest":
|
||||
|
@ -131,14 +132,14 @@ def write_commit_txt(project):
|
|||
pathlib.Path(f"{output_path}/commit_{commit}.txt").touch()
|
||||
|
||||
|
||||
def build(project, branch, conflict_version, fetch, gerrit_id=0):
|
||||
def build(project, conflict_version, fetch, gerrit_id=0):
|
||||
feed = lib.args.feed
|
||||
lib.git.clone(project, fetch)
|
||||
lib.git.clean(project)
|
||||
if gerrit_id > 0:
|
||||
lib.git.checkout_from_review(project, gerrit_id)
|
||||
else:
|
||||
checkout_for_feed(project, branch)
|
||||
checkout_for_feed(project)
|
||||
version = get_version_for_feed(project, conflict_version)
|
||||
epoch = get_epoch(project)
|
||||
version_epoch = f"{epoch}:{version}" if epoch else version
|
||||
|
|
|
@ -32,7 +32,7 @@ def parse_packages(packages_arg):
|
|||
return ret
|
||||
|
||||
|
||||
def build_srcpkg(branch, package, conflict_version, fetch, is_meta_pkg):
|
||||
def build_srcpkg(package, conflict_version, fetch, is_meta_pkg):
|
||||
global srcpkgs_built
|
||||
global srcpkgs_failed_build
|
||||
|
||||
|
@ -42,7 +42,7 @@ def build_srcpkg(branch, package, conflict_version, fetch, is_meta_pkg):
|
|||
if is_meta_pkg:
|
||||
version = lib.metapkg.build(conflict_version)
|
||||
else:
|
||||
version = lib.srcpkg.build(package, branch, conflict_version, fetch)
|
||||
version = lib.srcpkg.build(package, conflict_version, fetch)
|
||||
srcpkgs_built[package] = version
|
||||
except Exception as ex:
|
||||
traceback.print_exception(type(ex), ex, ex.__traceback__)
|
||||
|
@ -62,10 +62,11 @@ def is_up_to_date(obs_version, git_latest_version):
|
|||
return False
|
||||
|
||||
|
||||
def build_srcpkg_if_needed(branch, pkgs_remote, package, conflict_version,
|
||||
def build_srcpkg_if_needed(pkgs_remote, package, conflict_version,
|
||||
fetch, is_meta_pkg, skip_up_to_date):
|
||||
global srcpkgs_skipped
|
||||
feed = lib.args.feed
|
||||
branch = lib.args.git_branch
|
||||
|
||||
if feed in ["master", "latest"]:
|
||||
""" Check if we can skip this package by comparing the OBS version with
|
||||
|
@ -102,7 +103,7 @@ def build_srcpkg_if_needed(branch, pkgs_remote, package, conflict_version,
|
|||
else:
|
||||
print(f"{package}: building source package (feed is {feed})")
|
||||
|
||||
build_srcpkg(branch, package, conflict_version, fetch, is_meta_pkg)
|
||||
build_srcpkg(package, conflict_version, fetch, is_meta_pkg)
|
||||
|
||||
|
||||
def upload_srcpkg(pkgs_remote, package, version):
|
||||
|
@ -111,7 +112,7 @@ def upload_srcpkg(pkgs_remote, package, version):
|
|||
lib.osc.update_package(package, version)
|
||||
|
||||
|
||||
def build_srcpkgs(branch, pkgs_remote, packages, conflict_version, fetch,
|
||||
def build_srcpkgs(pkgs_remote, packages, conflict_version, fetch,
|
||||
meta, skip_up_to_date):
|
||||
print()
|
||||
print("### Building source packages ###")
|
||||
|
@ -119,11 +120,11 @@ def build_srcpkgs(branch, pkgs_remote, packages, conflict_version, fetch,
|
|||
|
||||
if meta:
|
||||
feed = lib.args.feed
|
||||
build_srcpkg_if_needed(branch, pkgs_remote, f"osmocom-{feed}",
|
||||
build_srcpkg_if_needed(pkgs_remote, f"osmocom-{feed}",
|
||||
conflict_version, fetch, True, skip_up_to_date)
|
||||
|
||||
for package in packages:
|
||||
build_srcpkg_if_needed(branch, pkgs_remote, package,
|
||||
build_srcpkg_if_needed(pkgs_remote, package,
|
||||
conflict_version, fetch, False, skip_up_to_date)
|
||||
|
||||
|
||||
|
@ -196,7 +197,6 @@ def main():
|
|||
help="package name, e.g. libosmocore or open5gs,"
|
||||
" default is all packages")
|
||||
args = parser.parse_args()
|
||||
branch = args.git_branch
|
||||
packages = parse_packages(args.package)
|
||||
|
||||
lib.set_args(args)
|
||||
|
@ -215,7 +215,7 @@ def main():
|
|||
|
||||
pkgs_remote = lib.osc.get_remote_pkgs()
|
||||
|
||||
build_srcpkgs(branch, pkgs_remote, packages, args.conflict_version,
|
||||
build_srcpkgs(pkgs_remote, packages, args.conflict_version,
|
||||
args.git_fetch, args.meta, args.skip_up_to_date)
|
||||
upload_srcpkgs(pkgs_remote)
|
||||
exit_with_summary()
|
||||
|
|
Loading…
Reference in New Issue