From 2f1ae3aa015c97223cfb1a8912d538d0d07c8bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 16 Nov 2021 22:28:14 +0100 Subject: [PATCH] Revert "Add llvm-lto-elf-check script" to avoid a dependency on Python This reverts commit ac2ca1dbbafbc33337794e1507128e92d31985f1. --- brp-llvm-compile-lto-elf | 7 +------ llvm-lto-elf-check | 39 --------------------------------------- macros | 3 +-- redhat-rpm-config.spec | 10 +++++----- 4 files changed, 7 insertions(+), 52 deletions(-) delete mode 100755 llvm-lto-elf-check diff --git a/brp-llvm-compile-lto-elf b/brp-llvm-compile-lto-elf index a7c55da..19783fa 100755 --- a/brp-llvm-compile-lto-elf +++ b/brp-llvm-compile-lto-elf @@ -1,10 +1,5 @@ #!/usr/bin/bash -eu -# first argument is the path to llvm-lto-elf-check -MATCH_LTO_SCRIPT=$1 -shift - -# remaining args are cflags CLANG_FLAGS=$@ if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then @@ -20,7 +15,7 @@ check_convert_bitcode () { if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then # check for an indication that the bitcode was # compiled with -flto - llvm-bcanalyzer -dump ${file_name} | ${MATCH_LTO_SCRIPT} 2>&1 > /dev/null + llvm-bcanalyzer -dump ${file_name} | grep -xP '.*\-flto((?!-fno-lto).)*' 2>&1 > /dev/null if [ $? -eq 0 ]; then echo "Compiling LLVM bitcode file ${file_name}." # create path to file in temp dir diff --git a/llvm-lto-elf-check b/llvm-lto-elf-check deleted file mode 100755 index 8e5ae14..0000000 --- a/llvm-lto-elf-check +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/python3 - -# Check an llvm bcanalyzer dump for -flto - -# This script implements the following command in python -# to avoid PCRE backtrace limits in grep. -# grep -xP '.*\-flto((?!-fno-lto).)*' - -import re -import sys - -def open_input_file(): - if len(sys.argv) > 1: - f = open(sys.argv[1], "r") - else: - f = sys.stdin - if not f: - raise Exception("Could not open input file") - return f - -def match_lto(input_lines): - match_found = False - for line in input_lines: - match = re.match(r"^.*\-flto((?!-fno-lto).)*$", line) - if match: - match_found = True - print(f"{match.group(0)}") - return match_found - -def main(): - input_file = open_input_file() - input_lines = input_file.readlines() - if input_file != sys.stdin: - input_file.close() - if match_lto(input_lines): - sys.exit(0) - sys.exit(1) - -main() diff --git a/macros b/macros index 4ac8096..8749e3b 100644 --- a/macros +++ b/macros @@ -234,8 +234,7 @@ print(result) # __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore %__brp_mangle_shebangs /usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"} -%__llvm_lto_elf_check /usr/lib/rpm/redhat/llvm-lto-elf-check -%__brp_llvm_compile_lto_elf /usr/lib/rpm/redhat/brp-llvm-compile-lto-elf %{__llvm_lto_elf_check} %{build_cflags} %{build_ldflags} +%__brp_llvm_compile_lto_elf /usr/lib/rpm/redhat/brp-llvm-compile-lto-elf %{build_cflags} %{build_ldflags} # note: %%__os_install_post_python is defined in python-srpm-macros and contains several policies # redhat-rpm-config maintainers, don't remove it from %%__os_install_post unless coordinating the change with Python maintainers diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 8c5f460..cd4ec33 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 203 +Version: 204 Release: 1%{?dist} # No version specified. License: GPL+ @@ -67,7 +67,6 @@ Source401: rpmsort Source402: symset-table Source403: kmodtool Source404: gpgverify -Source405: llvm-lto-elf-check # 2016-10-02 snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git Source500: config.guess @@ -177,8 +176,6 @@ mkdir -p %{buildroot}%{_rpmluadir}/fedora/{rpm,srpm} install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora common.lua install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua -install -p -m 755 -t %{buildroot}%{rrcdir} llvm-lto-elf-check - %files %dir %{rrcdir} %{rrcdir}/macros @@ -192,7 +189,6 @@ install -p -m 755 -t %{buildroot}%{rrcdir} llvm-lto-elf-check %{rrcdir}/find-provides %{rrcdir}/find-requires %{rrcdir}/brp-ldconfig -%{rrcdir}/llvm-lto-elf-check %{_fileattrsdir}/*.attr %{_rpmconfigdir}/macros.d/macros.*-srpm %{_rpmconfigdir}/macros.d/macros.build-constraints @@ -221,6 +217,10 @@ install -p -m 755 -t %{buildroot}%{rrcdir} llvm-lto-elf-check %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Tue Nov 16 2021 Miro HronĨok - 204-1 +- Don't pull in Python to all buildroots +- Remove llvm-lto-elf-check script + * Tue Nov 09 2021 Michal Domonkos - 203-1 - Drop {fpc,gnat,nim}-srpm-macros dependencies on RHEL