File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11NAME = spec-helper
2- VERSION = 0.31.46
2+ VERSION = 0.31.49
33SVNPATH = git@github.com:OpenMandrivaSoftware/spec-helper.git
44
55SCRIPT_FILES = clean_files clean_perl check_elf_files \
66 lib_symlinks fix_file_permissions fix_mo fix_xdg fix_pkgconfig fix_pamd \
7- remove_info_dir remove_libtool_files remove_rpath relink_symlinks fix_eol
7+ remove_info_dir remove_libtool_files remove_rpath relink_symlinks fix_eol \
8+ python_shebangs
89BIN_FILES = rediff_patch spec-cleaner
910MACROS_FILES = spec-helper.macros
1011TEST_FILES = t/*.t
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ if [ -z " $RPM_BUILD_ROOT " ]; then
4+ echo " No build root defined" >&2
5+ exit 1
6+ fi
7+
8+ if [ ! -d " $RPM_BUILD_ROOT " ]; then
9+ echo " Invalid build root" >&2
10+ exit 1
11+ fi
12+
13+ set -efu
14+ # We fork a subshell, so working with a variable is not possible,
15+ # otherwise we will have to switch to bashisms and require /dev/fd/*
16+ tmpfile=" $( mktemp) "
17+ trap ' rm -f "$tmpfile"' EXIT
18+ echo 0 > " $tmpfile "
19+
20+ for dir in /bin /usr/bin /sbin /usr/sbin /usr/libexec
21+ do
22+ if [ ! -d " ${RPM_BUILD_ROOT} /${dir} " ]; then
23+ continue
24+ fi
25+ find " ${RPM_BUILD_ROOT} /${dir} " -type f -print | \
26+ while read -r file
27+ do
28+ # Prohibit shebangs like:
29+ # #!/usr/bin/python
30+ # #! /usr/bin/python
31+ # #!/usr/bin/env python
32+ # #! /usr/bin/env python
33+ # Note that a space may be in the end of the shebang line
34+ if head -n 1 " $file " | grep -qE ' ^#!([[:blank:]])*.*(/python|[[:blank:]]python)([[:blank:]])*$' ; then
35+ echo " Unversioned Python shebangs are not allowed. Specify python3 or python2 explicitly in $file "
36+ # Do not fail on the 1st error, print all errors at one time
37+ echo 1 > " $tmpfile "
38+ fi
39+ done
40+ done
41+
42+ if [ " $( head -n 1 " $tmpfile " ) " != 0 ]; then
43+ exit 1
44+ fi
Original file line number Diff line number Diff line change 1616 %{?!dont_fix_eol: [ -n "$DONT_FIX_EOL" ] || %_spec_helper_dir/fix_eol} \
1717 %{?!dont_check_elf_files: [ -n "$DONT_CHECK_ELF_FILES" ] || %_spec_helper_dir/check_elf_files} \
1818 %{?!dont_remove_rpath: [ -n "$DONT_REMOVE_RPATH" ] || %_spec_helper_dir/remove_rpath} \
19+ %{?!dont_check_python_shebangs: [ -n "$DONT_CHECK_PYTHON_SHEBANGS" ] || %_spec_helper_dir/python_shebangs} \
1920 %{?!__debug_package: [ -n "%{?dont_strip:1}%{?!dont_strip:$DONT_STRIP}" ] || export DISABLE_DEBUG=1 && %__debug_install_post} \
2021%{nil}
2122
You can’t perform that action at this time.
0 commit comments