Let eBPF ELF files be packaged in noarch packages
eBPF ELF represents a virtual machine where our file colors make no sense at all. Filter out the color from these files to avoid a "Arch dependent binaries in noarch package" error from them in noarch packages. We don't want to pull in clang to the check images just because of this, so add a pre-built binary for the check and a simple way to reproduce from the test-spec. Fixes: #2875
This commit is contained in:
parent
41974f46f9
commit
5ece87a250
|
@ -1220,6 +1220,13 @@ static uint32_t getElfColor(const char *fn)
|
|||
color = RPMFC_ELF32;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Exceptions to coloring */
|
||||
switch (ehdr.e_machine) {
|
||||
case EM_BPF:
|
||||
color = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (elf)
|
||||
elf_end(elf);
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
%bcond clang 0
|
||||
%define debug_package %{nil}
|
||||
|
||||
Name: bpf
|
||||
Version: 1.0
|
||||
Release: 1
|
||||
Summary: Testing bpf ELF file behavior
|
||||
BuildArch: noarch
|
||||
License: GPL
|
||||
|
||||
%description
|
||||
%{summary}
|
||||
|
||||
%prep
|
||||
%setup -c -T
|
||||
|
||||
%build
|
||||
%if %{with clang}
|
||||
cat << EOF > bpf.c
|
||||
int func(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
clang -target bpf -c bpf.c -o bpf.o
|
||||
%else
|
||||
cp /data/misc/bpf.o .
|
||||
%endif
|
||||
|
||||
%install
|
||||
mkdir -p ${RPM_BUILD_ROOT}/opt/
|
||||
install -m755 bpf.o ${RPM_BUILD_ROOT}/opt/
|
||||
|
||||
%files
|
||||
/opt/bpf.o
|
Binary file not shown.
|
@ -2766,3 +2766,15 @@ runroot rpmbuild --quiet -bb /data/SPECS/interact.spec
|
|||
[ignore],
|
||||
[ignore])
|
||||
RPMTEST_CLEANUP
|
||||
|
||||
AT_SETUP([rpmbuild bpf file])
|
||||
AT_KEYWORDS([build])
|
||||
RPMDB_INIT
|
||||
|
||||
RPMTEST_CHECK([
|
||||
runroot rpmbuild --quiet -bb /data/SPECS/bpf.spec
|
||||
],
|
||||
[0],
|
||||
[],
|
||||
[])
|
||||
RPMTEST_CLEANUP
|
||||
|
|
Loading…
Reference in New Issue