From c02335fc144bef1e2edf18d3f28a000308ab2b30 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 29 Apr 2024 09:07:47 +0200 Subject: [PATCH] Improve 'build' and 'buildinfo' commands by injecting *.inc files into spec that is sent to OBS for parsing BuildRequires (boo#1221340) --- osc/build.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osc/build.py b/osc/build.py index 22b99706d..5ae1c32b9 100644 --- a/osc/build.py +++ b/osc/build.py @@ -705,6 +705,12 @@ def create_build_descr_data( if defines: build_descr_data = b"\n".join(defines) + b"\n\n" + build_descr_data + # HACK: OBS doesn't support *.inc for spec, let's inject them here + for include_file in glob.glob(os.path.join(topdir, "*.inc")): + print(f"Injecting include file into spec: {os.path.basename(include_file)}", file=sys.stderr) + with open(include_file, "rb") as f: + build_descr_data = b"\n" + f.read() + b"\n\n" + build_descr_data + # build recipe must go first for compatibility with the older OBS versions result_data.append((os.path.basename(build_descr_path).encode("utf-8"), build_descr_data))