From 35504f941a81cb77df86b31f8b708ba1972eb22f Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Jun 06 2024 17:14:31 +0000 Subject: Correct source flattening for RPM 4.19.90+ (#2290735) RPM 4.19.90 (4.20 alpha 1) introduced per-build directories, which adds one more level to the build directory nesting that this is trying to flatten out. This tries to detect when this directory is present - relying on its naming being consistent as (spec name)-(spec version)-build - and add another level to the flatten command when it is. Signed-off-by: Adam Williamson --- diff --git a/roles/standard-test-source/tasks/main.yml b/roles/standard-test-source/tasks/main.yml index 11af880..48342c9 100644 --- a/roles/standard-test-source/tasks/main.yml +++ b/roles/standard-test-source/tasks/main.yml @@ -58,6 +58,10 @@ shell: rpm -q --specfile --queryformat="%{NAME}\n" {{pkgdir}}/*.spec | head -n1 register: name + - name: Get the specfile package name-version + shell: rpm -q --specfile --queryformat="%{NAME}-%{VERSION}\n" {{pkgdir}}/*.spec | head -n1 + register: namever + - name: Pull down the source tarballs source-lookaside: package: "{{name.stdout}}" @@ -92,10 +96,25 @@ "_sourcedir {{tenv_workdir}}/" --define "_builddir {{srcdir}}" when: not fetch_only -- name: Flatten sources +- name: Check whether we got the per-package build dir from RPM 4.19.90+ + stat: + path: "{{ srcdir }}/{{ namever.stdout }}-build" + register: package_build_dir + +- name: Flatten sources (without per-package build dir) shell: | shopt -s dotglob mv {{ srcdir }}/*/* {{ srcdir }} when: - flatten - not fetch_only + - not package_build_dir.stat.exists + +- name: Flatten sources (with per-package build dir) + shell: | + shopt -s dotglob + mv {{ srcdir }}/*/*/* {{ srcdir }} + when: + - flatten + - not fetch_only + - package_build_dir.stat.exists