import redhat-rpm-config-123-1.el8

This commit is contained in:
CentOS Sources 2020-11-03 07:11:36 -05:00 committed by Andrew Lukoshko
parent 20547ee0c8
commit 678b3cc9bf
3 changed files with 67 additions and 36 deletions

View File

@ -70,13 +70,17 @@ done
cd "$RPM_BUILD_ROOT" cd "$RPM_BUILD_ROOT"
trim() { # Large packages such as kernel can have thousands of executable files.
printf '%s' "$*" # We take care to not fork/exec thousands of "file"s and "grep"s,
} # but run just two of them.
# (Take care to exclude filenames which would mangle "file" output).
find -executable -type f ! -path '*:*' ! -path $'*\n*' \
| file -N --mime-type -f - \
| grep -P ".+(?=: text/)" \
| {
fail=0 fail=0
while IFS= read -r -d $'\0' f; do while IFS= read -r line; do
file -N --mime-type "$f" | grep -q -P ".+(?=: text/)" || continue f=${line%%:*}
# Remove the dot # Remove the dot
path="${f#.}" path="${f#.}"
@ -88,24 +92,34 @@ while IFS= read -r -d $'\0' f; do
echo "$path" | grep -q -E -f "$exclude_files_from" && continue echo "$path" | grep -q -E -f "$exclude_files_from" && continue
fi fi
ts=$(stat -c %y "$f")
read shebang_line < "$f" || : read shebang_line < "$f"
orig_shebang=$(trim $(echo "$shebang_line" | grep -Po "#!\K.*" || echo)) orig_shebang="${shebang_line#\#!}"
shebang="$orig_shebang" if [ "$orig_shebang" = "$shebang_line" ]; then
if [ -n "$exclude_shebangs" ]; then echo >&2 "*** WARNING: $f is executable but has no shebang, removing executable bit"
echo "$shebang" | grep -q -E "$exclude_shebangs" && continue ts=$(stat -c %y "$f")
fi
if [ -n "$exclude_shebangs_from" ]; then
echo "$shebang" | grep -q -E -f "$exclude_shebangs_from" && continue
fi
if [ -z "$shebang" ]; then
echo >&2 "*** WARNING: $f is executable but has empty or no shebang, removing executable bit"
chmod -x "$f" chmod -x "$f"
touch -d "$ts" "$f" touch -d "$ts" "$f"
continue continue
elif [ -n "${shebang##/*}" ]; then fi
# Trim spaces
while shebang="${orig_shebang// / }"; [ "$shebang" != "$orig_shebang" ]; do
orig_shebang="$shebang"
done
# Treat "#! /path/to " as "#!/path/to"
orig_shebang="${orig_shebang# }"
shebang="$orig_shebang"
if [ -z "$shebang" ]; then
echo >&2 "*** WARNING: $f is executable but has empty shebang, removing executable bit"
ts=$(stat -c %y "$f")
chmod -x "$f"
touch -d "$ts" "$f"
continue
fi
if [ -n "${shebang##/*}" ]; then
echo >&2 "*** ERROR: $f has shebang which doesn't start with '/' ($shebang)" echo >&2 "*** ERROR: $f has shebang which doesn't start with '/' ($shebang)"
fail=1 fail=1
continue continue
@ -134,11 +148,13 @@ while IFS= read -r -d $'\0' f; do
echo >&2 "*** ERROR: ambiguous python shebang in $path: #!$orig_shebang. Change it to python3 (or python2) explicitly." echo >&2 "*** ERROR: ambiguous python shebang in $path: #!$orig_shebang. Change it to python3 (or python2) explicitly."
fail=1 fail=1
elif [ "#!$shebang" != "#!$orig_shebang" ]; then elif [ "#!$shebang" != "#!$orig_shebang" ]; then
sed -i -e "1c #!$shebang" "$f"
echo "mangling shebang in $path from $orig_shebang to #!$shebang" echo "mangling shebang in $path from $orig_shebang to #!$shebang"
ts=$(stat -c %y "$f")
sed -i -e "1c #!$shebang" "$f"
touch -d "$ts" "$f"
fi fi
touch -d "$ts" "$f" done
done < <(find -executable -type f -print0)
exit $fail exit $fail
}

View File

@ -1,17 +1,28 @@
#!/bin/sh +x #!/bin/sh +x
# Kernel build can have many thousands of modules.
# kmod.prov is run for every one of them.
# Try to make this script run as fast as we can.
# For example, use shell string ops instead of external programs
# where possible.
IFS=$'\n' IFS=$'\n'
for i in $(grep -E '(/lib/modules/.*\.ko|/lib/modules/.*/modules.builtin)'); read -r fname || exit
do
kmod=$(basename $i | sed -e 's/.[xg]z//');
if [ $kmod == "modules.builtin" ]; then # Only process files from .../lib/modules/... subtree
for j in $(cat $i); do [ "${fname#*/lib/modules/*}" != "$fname" ] || exit 0
j=$(basename $j);
echo "kmod($j)" kmod=${fname##*/} # like basename, but faster
done
else if [ "$kmod" = "modules.builtin" ]; then
echo "kmod($kmod)" for j in $(cat -- "$fname"); do
fi echo "kmod(${j##*/})"
done done
exit 0
fi
kmod=${kmod%.gz}
kmod=${kmod%.xz}
if [ "${kmod%.ko}" != "$kmod" ]; then
echo "kmod($kmod)"
fi

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 122 Version: 123
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -198,6 +198,10 @@ install -p -m 755 %{SOURCE21} %{buildroot}%{_rpmconfigdir}/kabi.sh
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Tue Jun 16 2020 Florian Festi <ffesti@redhat.com> - 123-1
- Update kmod.prov for better performance (#1794491)
- Backport performance improvements for brp-mangle-shebangs (#1794779)
* Mon Feb 24 2020 Michal Domonkos <mdomonko@redhat.com> - 122-1 * Mon Feb 24 2020 Michal Domonkos <mdomonko@redhat.com> - 122-1
- Fix argument shift in %%__brp_python_bytecompile (#1724567) - Fix argument shift in %%__brp_python_bytecompile (#1724567)