Initial commit

This commit is contained in:
eabdullin 2024-07-09 14:08:37 +03:00
parent 43f76414c7
commit 2338500578
79 changed files with 2 additions and 409 deletions

View File

@ -1 +0,0 @@
1

View File

View File

@ -5,7 +5,7 @@
# #
%_vendor redhat %_vendor redhat
%_os linux %_os linux
%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu} %_target_platform x86_64-%{_vendor}-%{_target_os}%{?_gnu}
#============================================================================== #==============================================================================
# ---- configure macros. note that most of these are inherited # ---- configure macros. note that most of these are inherited

View File

@ -9,7 +9,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: %{baserelease} Version: %{baserelease}
Release: 1%{?dist} Release: 1%{?dist}.alma.1
# config.guess, config.sub are GPL-3.0-or-later WITH Autoconf-exception-generic # config.guess, config.sub are GPL-3.0-or-later WITH Autoconf-exception-generic
License: GPL-1.0-or-later AND GPL-2.0-or-later AND GPL-3.0-or-later WITH Autoconf-exception-generic AND Boehm-GC License: GPL-1.0-or-later AND GPL-2.0-or-later AND GPL-3.0-or-later WITH Autoconf-exception-generic AND Boehm-GC
URL: https://src.fedoraproject.org/rpms/redhat-rpm-config URL: https://src.fedoraproject.org/rpms/redhat-rpm-config

View File

@ -1,12 +0,0 @@
summary: Internal CI-Tier-1 tests plan
discover:
- name: redhat-rpm-config
how: fmf
filter: 'tag: CI-Tier-1'
url: https://pkgs.devel.redhat.com/git/tests/redhat-rpm-config
execute:
how: tmt
adjust:
enabled: false
when: distro == centos-stream or distro == fedora

View File

View File

@ -1,11 +0,0 @@
.phony: all
all: hello-c hello-cpp
clean:
rm -Rf *.o hello-c hello-cpp
hello-c: main-c.o hello-c.o
hello-cpp: main-cpp.o hello-cpp.o
$(CXX) $(LDFLAGS) -o $@ $^

View File

@ -1,5 +0,0 @@
#include <stdio.h>
void hello(void) {
printf("Hello, World!");
}

View File

@ -1,5 +0,0 @@
#include <iostream>
void hello(void) {
std::cout << "Hello, World!\n";
}

View File

@ -1,5 +0,0 @@
void hello(void);
int main(int argc, char **argv) {
hello();
}

View File

@ -1,5 +0,0 @@
void hello(void);
int main(int argc, char **argv) {
hello();
}

View File

@ -1,12 +0,0 @@
summary: >
Check the that the environment variables for build flags are automatically set
https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck
require:
- annobin-annocheck
- dnf5-plugins
- gcc
- gcc-c++
- make
test: ./runtest.sh

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -ex
dnf -y builddep test.spec
rpmbuild --define '_sourcedir .' --define '_builddir .' -bi test.spec
rpmbuild --without auto_set_build_flags --define '_sourcedir .' --define '_builddir .' -bi test.spec

View File

@ -1,39 +0,0 @@
%bcond_without auto_set_build_flags
%if %{without auto_set_build_flags}
%undefine _auto_set_build_flags
%endif
Name: test
Version: 1
Release: 1
Summary: Test package for checking %%set_build_flag usage
License: MIT
BuildRequires: gcc gcc-c++ make
BuildRequires: annobin-annocheck
Source0: Makefile
Source1: main-c.c
Source2: hello-c.c
Source3: main-cpp.cpp
Source4: hello-cpp.cpp
%global build_and_check \
make \
%{!?with_auto_set_build_flags:!} annocheck hello-c hello-cpp \
make clean
%description
Test package for checking %%set_build_flag usage
%prep
%build
%build_and_check
%check
%build_and_check
%install
%build_and_check

View File

@ -1,5 +0,0 @@
#include <stdio.h>
void hello(void) {
printf("Hello, world!\n");
}

View File

@ -1,36 +0,0 @@
Name: brp-llvm-compile-lto-elf-test-lib
Version: 1
Release: 1
Summary: Library package for testing brp-llvm-compile-lto-elf
License: MIT
BuildRequires: clang binutils
Source0: %{name}.c
Source1: %{name}.h
# FIXME: I'm not sure why this doesn't work
%undefine _package_note_file
%global toolchain clang
%description
%{summary}
%build
clang ${CFLAGS} -c %{SOURCE0} -o %{name}.o
ar cr %{name}.a %{name}.o
ranlib %{name}.a
%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
%{__install} -p -m 644 -t %{buildroot}%{_libdir} %{name}.o
%{__install} -p -m 644 -t %{buildroot}%{_libdir} %{name}.a
%{__install} -p -m 644 -t %{buildroot}%{_includedir} %{SOURCE1}
%files
%{_libdir}/%{name}.o
%{_libdir}/%{name}.a
%{_includedir}/%{name}.h

View File

@ -1,6 +0,0 @@
#include <brp-llvm-compile-lto-elf-test-lib.h>
int main(int argc, char **argv) {
hello();
return 0;
}

View File

@ -1,26 +0,0 @@
Name: brp-llvm-compile-lto-elf-test
Version: 1
Release: 1
Summary: Library package for testing brp-llvm-compile-lto-elf
License: MIT
BuildRequires: gcc
BuildRequires: brp-llvm-compile-lto-elf-test-lib
Source0: %{name}.c
# FIXME: I'm not sure why this doesn't work
%undefine _package_note_file
%description
%{summary}
%build
gcc ${CFLAGS} -c %{SOURCE0} -o %{name}.o
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.a -o %{name}-ar
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.o -o %{name}-obj
%check
./%{name}-ar | grep "Hello, world!"
./%{name}-obj | grep "Hello, world!"

View File

@ -1,9 +0,0 @@
Summary: Test that the brp-llvm-compile-lto-elf script is working correctly
require:
- dnf-plugins-core
- dnf5-plugins
- redhat-rpm-config
- rpm-build
test: ./runtest.sh

View File

@ -1,17 +0,0 @@
#!/bin/bash
set -ex
lib_dir=brp-llvm-compile-lto-elf-test-lib
lib_spec=$lib_dir/brp-llvm-compile-lto-elf-test-lib.spec
dnf -y builddep $lib_spec
rpmbuild --define "_sourcedir ." --define "_builddir ./$lib_dir" --define "_rpmdir ." -bb $lib_spec
dnf -y install ./`rpm --eval '%{_arch}'`/*.rpm
test_dir=brp-llvm-compile-lto-elf-test
test_spec=$test_dir/brp-llvm-compile-lto-elf-test.spec
dnf -y builddep $test_spec
rpmbuild --define "_sourcedir ." --define "_builddir ./$test_dir" -bi $test_spec

View File

@ -1,21 +0,0 @@
summary: Tests
discover:
- name: redhat-rpm-config-tests
how: fmf
- name: gcc-fedora-flags
how: fmf
url: https://src.fedoraproject.org/rpms/gcc.git
ref: rawhide
test: fedora-flags
- name: clang-fedora-flags
how: fmf
url: https://src.fedoraproject.org/rpms/clang.git
ref: rawhide
test: fedora-flags
- name: clang-fedora-pie-rpm
how: fmf
url: https://src.fedoraproject.org/tests/clang.git
ref: main
test: pie-rpm
execute:
how: tmt

View File

@ -1,7 +0,0 @@
summary: self-build test
require:
- dnf-plugins-core
- dnf5-plugins
- rpm-build
test: ./runtest.sh

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -e
spec=$TMT_TREE/redhat-rpm-config.spec
dnf -y builddep $spec
rpmbuild --define "_sourcedir $TMT_TREE" -ba $spec

View File

@ -1,5 +0,0 @@
summary: Test to ensure there aren't extraneous characters in build flags
require:
- redhat-rpm-config
test: ./runtest.sh

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -ex
for f in %{build_cflags} %{build_cxxflags} %{build_fflags} %{build_ldflags}; do
rpm --eval "$f" | grep -vP '\t'
done

View File

@ -1,8 +0,0 @@
summary: >
Check that the %_distro_extra_* macros allow users to append new flags to the
list of default flags.
require:
- rpm
test: ./runtest.sh

View File

@ -1,6 +0,0 @@
set -ex
rpm -D '%_distro_extra_cflags -Wall' -E %{build_cflags} | grep -e '\-Wall$'
rpm -D '%_distro_extra_cxxflags -Wall' -E %{build_cxxflags} | grep -e '\-Wall$'
rpm -D '%_distro_extra_ldflags -Wall' -E %{build_ldflags} | grep -e '\-Wall$'
rpm -D '%_distro_extra_fflags -Wall' -E %{build_fflags} | grep -e '\-Wall$'

View File

@ -1,5 +0,0 @@
summary: Test that the extension builder flags contain the proper flags
require:
- redhat-rpm-config
test: ./runtest.sh

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -ex
# Verify that the extension builder flags are stripped of non-required flags.
# The flags may appear in random order due to being accessed through a lua
# associative array.
for f in %{extension_cflags} %{extension_cxxflags} %{extension_fflags}; do
[[ $(rpm --eval "$f") =~ ^[[:space:]]*(-fexceptions -fcf-protection|-fcf-protection -fexceptions)[[:space:]]*$ ]]
done
# The extension ldflag should always be empty
[[ -z $(rpm --eval "%extension_ldflags") ]]

View File

@ -1,7 +0,0 @@
summary: Test that conditional support for frame pointers works
require:
- grep
- redhat-rpm-config
- rpm
test: ./runtest.sh

View File

@ -1,61 +0,0 @@
#!/bin/sh
# Not using set -e on purpose as we manually validate the exit codes to print
# useful messages.
set -u
passed=0
failed=0
rpmeval() {
# Note: --eval needs to always be *last* here
rpm "$@" --eval='%optflags'
}
validate() {
ret=$?
if [ $ret -eq 0 ]; then
echo "PASS: $*"
passed=$((passed+1))
else
echo "FAIL: $*"
failed=$((failed+1))
fi
}
for arch in aarch64 x86_64 riscv64; do
case "$arch" in
x86_64|aarch64)
flags='-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer'
;;
*)
flags='-fno-omit-frame-pointer'
;;
esac
rpmeval --target="${arch}-linux" --define='_include_frame_pointers 1' | grep -q -- "$flags"
validate "[${arch}] Test that the flags are included if the macro is defined"
rpmeval --target="${arch}-linux" --undefine='_include_frame_pointers' | grep -qv -- "$flags"
validate "[${arch}] Test that the flags are _not_ included if the macro is undefined"
rpmeval --target="${arch}-linux" --define='fedora 1' | grep -q -- "$flags"
validate "[${arch}] Test that the flags are included by default on Fedora"
rpmeval --target="${arch}-linux" --define='rhel 1' | grep -qv -- "$flags"
validate "[${arch}] Test that the flags are _not_ included by default on RHEL"
done
flags='-fno-omit-frame-pointer'
for arch in i386 i486 i586 i686 athlon ppc64le s390x; do
rpmeval --target="${arch}-linux" --define='_include_frame_pointers 1' | grep -qv -- "$flags"
validate "[${arch}] Test that the flags are not included if the macro is defined"
rpmeval --target="${arch}-linux" | grep -qv -- "$flags"
validate "[${arch}] Test that the flags are not included by default"
done
echo
echo "${passed} passed, ${failed} failed"
exit "$failed"

View File

@ -1,8 +0,0 @@
summary: Test that we don't accidently introduce any new dependencies.
require:
- diffutils
- grep
- redhat-rpm-config
- rpm
test: ./runtest.sh

View File

@ -1,12 +0,0 @@
coreutils
dwz
rpm
zip
/bin/sh
/usr/bin/bash
/usr/bin/file
/usr/bin/find
/usr/bin/grep
/usr/bin/sed
/usr/bin/sh
/usr/bin/xargs

View File

@ -1,11 +0,0 @@
#!/bin/bash -ex
# we diff most of the dependencies against our list in requires.txt
# generally, a new dependency is bad, for exceptional cases, we can add it to the list together with the change
# we intentionally grep out:
# -srpm-macros and -rpm-macros
# rpmlib(...)
# conditional dependencies (they contain if)
# at the end, we strip the versions with cut
diff -u <(cat $(dirname $0)/requires.txt | sort | uniq) \
<(rpm -q --requires redhat-rpm-config | grep -Ev -- '-s?rpm-macros(\s|$)|^rpmlib\(|\sif\s' | cut -d' ' -f1 | sort | uniq)

View File

@ -1,7 +0,0 @@
summary: Test that conditional support for RUSTFLAGS works
require:
- redhat-rpm-config
- rpm
- rust-packaging
test: ./runtest.sh

View File

@ -1,22 +0,0 @@
#!/usr/bin/bash
set -e -u -o pipefail
# Allow for local testing
rargs=()
if [ -n "${MACROS_PATH:-}" ]; then
default_macros_path="$(rpm --showrc | grep 'Macro path' | awk -F ': ' '{print $2}')"
rargs+=("--macros" "${default_macros_path}:${MACROS_PATH}")
fi
build_rustflags="$(rpm -E '%{build_rustflags}')"
# For good measure
[ "${build_rustflags}" != "%{build_rustflags}" ]
#
flags="$(rpm "${rargs[@]}" -E '%set_build_flags')"
echo 'Check that RUSTFLAGS is set after evaluating %set_build_flags'
(
eval "${flags}"
# set -u will make this fail if $RUSTFLAGS isn't defined
[ "${RUSTFLAGS}" = "${build_rustflags}" ]
)