debuginfo: Implement %_stripped_files_terminate_build

Terminate build if stripped ELF files are found. Usage:

  %define _stripped_files_terminate_build 1

Formatting suggestions by Dmitry V. Levin <ldv@altlinux.org>.
This commit is contained in:
Виталий Чикунов 2020-08-22 17:18:10 +03:00
parent 1f5bc5f866
commit aba565d889
3 changed files with 11 additions and 0 deletions

View File

@ -266,6 +266,10 @@ BuildRoot.
параметр, определяющий влияние неупакованных файлов на
результат сборки;
%_stripped_files_terminate_build:
параметр, определяющий влияние стрипнутых файлов на
результат сборки;
%set_{check_contents,cleanup,compress,fixup,verify_{elf,info},perl_req}_method:
изменить значение соответствующего макроса;

View File

@ -223,6 +223,7 @@
@alt@ %{?_cleanup_skiplist:export RPM_CLEANUP_SKIPLIST=\"%_cleanup_skiplist\"}\
@alt@ %{?_compress_skiplist:export RPM_COMPRESS_SKIPLIST=\"%_compress_skiplist\"}\
@alt@ %{?_debuginfo_skiplist:export RPM_DEBUGINFO_SKIPLIST=\"%_debuginfo_skiplist\"}\
@alt@ %{?_stripped_files_terminate_build:export RPM_DEBUGINFO_STRIPPED_TERMINATE=\"%_stripped_files_terminate_build\"}\
@alt@ %{?_fixup_skiplist:export RPM_FIXUP_SKIPLIST=\"%_fixup_skiplist\"}\
@alt@ %{?_verify_elf_skiplist:export RPM_VERIFY_ELF_SKIPLIST=\"%_verify_elf_skiplist\"}\
@alt@ %{?_findreq_skiplist:export RPM_FINDREQ_SKIPLIST=\"%_findreq_skiplist\"}\

View File

@ -19,6 +19,8 @@ mkdir .tmp
# Strip binaries, create .debug files under /usr/lib/debug and install sources into /usr/src/debug.
: ${RPM_DEBUGINFO_SKIPLIST:=}
: ${RPM_DEBUGINFO_STRIPPED_TERMINATE:=}
prune_paths="/lib/firmware /usr/lib/debug /usr/share /usr/src $RPM_DEBUGINFO_SKIPLIST"
prune_tests="$(printf %s "$prune_paths" |
tr '[:space:]' '\n' |
@ -33,6 +35,8 @@ if [ -s .tmp/fstripped ]; then
Warning "You have $howmuch stripped ELF objects. Please compile with debugging information!"
Warning "An excerpt from the list of affected files follows:"
sed 's/^/ /; 10q' <.tmp/fstripped >&2
[ -z "$RPM_DEBUGINFO_STRIPPED_TERMINATE" ] \
|| Fatal "Stripped files found, terminating build"
fi
sed -n -e '/ ELF .* shared object, no machine, /d' \
@ -95,4 +99,6 @@ if [ -s .tmp/no_debug_info ]; then
if egrep -q '/lib/modules/.*(/vmlinux|\.ko)$' .tmp/no_debug_info; then
Warning "Please enable CONFIG_DEBUG_INFO=y in the kernel package!"
fi
[ -z "$RPM_DEBUGINFO_STRIPPED_TERMINATE" ] \
|| Fatal "Files with stripped .debug_info found, terminating build"
fi