From 4b42533d909216130ea55a2da08febe822810065 Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Jan 15 2022 07:27:56 +0000 Subject: [PATCH 1/2] Cleanup dynamic BR handling Signed-off-by: Maxwell G --- diff --git a/go2rpm/__main__.py b/go2rpm/__main__.py index df15eba..1971ef2 100644 --- a/go2rpm/__main__.py +++ b/go2rpm/__main__.py @@ -607,18 +607,20 @@ def main(): # Prepare the repo set_repo_version(git_local_path, version, tag, commit) - # Get BuildRequires and filter them out of test BuildRequires - buildrequires = to_list(get_buildrequires(forge, subdir)) - buildrequires = [ipath for ipath in buildrequires if goipath not in ipath] - test_buildrequires = list( - set(to_list(get_test_buildrequires(forge, subdir))).difference( - set(buildrequires) + if args.no_dynamic_buildrequires: + # Get BuildRequires and filter them out of test BuildRequires + buildrequires = to_list(get_buildrequires(forge, subdir)) + buildrequires = [ipath for ipath in buildrequires if goipath not in ipath] + test_buildrequires = list( + set(to_list(get_test_buildrequires(forge, subdir))).difference( + set(buildrequires) + ) ) - ) - test_buildrequires = [ipath for ipath in test_buildrequires if goipath not in ipath] - - if not args.no_dynamic_buildrequires: + test_buildrequires = [ipath for ipath in test_buildrequires if goipath not in ipath] + else: args.dynamic_buildrequires = True + buildrequires = [] + test_buildrequires = [] description = asyncio.run(get_description(forge)) if description is not None: From bfa3d3a3919757092dca156bbcb90cd6afcc647f Mon Sep 17 00:00:00 2001 From: Maxwell G Date: Jan 15 2022 07:32:30 +0000 Subject: [PATCH 2/2] Workaround `%generate_buildrequires` debug_package issue Signed-off-by: Maxwell G --- diff --git a/go2rpm/templates/profile1.spec b/go2rpm/templates/profile1.spec index 886064b..394069d 100644 --- a/go2rpm/templates/profile1.spec +++ b/go2rpm/templates/profile1.spec @@ -1,5 +1,8 @@ # Generated by go2rpm {{ generator_version }} %bcond_without check +{% if not has_cmd and main_cmd is none and other_cmd|length == 0 and generate_buildrequires %} +%global debug_package %{nil} +{% endif %} # {{ forge }} %global goipath {{ goipath }} diff --git a/go2rpm/templates/profile2.spec b/go2rpm/templates/profile2.spec index 3d0bd9e..c41c083 100644 --- a/go2rpm/templates/profile2.spec +++ b/go2rpm/templates/profile2.spec @@ -1,5 +1,8 @@ # Generated by go2rpm {{ generator_version }} %bcond_without check +{% if not has_cmd and main_cmd is none and other_cmd|length == 0 and generate_buildrequires %} +%global debug_package %{nil} +{% endif %} # {{ forge }} %global goipath {{ goipath }}