Use file4 instead of file

This will allow upgrading system file to v5, leaving rpmbuild using
stable file v4.
This commit is contained in:
Виталий Чикунов 2021-08-12 13:15:40 +03:00
parent 1d03e6395e
commit 5ef5c8ff4a
10 changed files with 11 additions and 12 deletions

View File

@ -63,7 +63,7 @@ while IFS= read -r f; do
done >"$tmpdir"/files 3>"$RPM_BUILD_ROOT/.files:$RPM_SUBPACKAGE_NAME" done >"$tmpdir"/files 3>"$RPM_BUILD_ROOT/.files:$RPM_SUBPACKAGE_NAME"
# filter file list through file(1) to append types (dereference symlinks) # filter file list through file(1) to append types (dereference symlinks)
if ! file -L -NF$'\t' -f "$tmpdir"/files >"$tmpdir"/files+types; then if ! file4 -L -NF$'\t' -f "$tmpdir"/files >"$tmpdir"/files+types; then
sed -n '/\t *ERROR:/p' "$tmpdir"/files+types >&2 sed -n '/\t *ERROR:/p' "$tmpdir"/files+types >&2
exit 1 exit 1
fi fi

View File

@ -97,7 +97,7 @@ done >"$tmpdir"/files \
5>"$tmpdir"/symlinks+targets-unsorted 5>"$tmpdir"/symlinks+targets-unsorted
# filter file list through file(1) to append types # filter file list through file(1) to append types
if ! file -NF$'\t' -f "$tmpdir"/files >>"$tmpdir"/files+types; then if ! file4 -NF$'\t' -f "$tmpdir"/files >>"$tmpdir"/files+types; then
sed -n '/\t *ERROR:/p' "$tmpdir"/files+types >&2 sed -n '/\t *ERROR:/p' "$tmpdir"/files+types >&2
exit 1 exit 1
fi fi
@ -107,7 +107,7 @@ sort -t$'\t' -k2 <"$tmpdir"/symlinks+targets-unsorted >"$tmpdir"/symlinks+target
JFS=$'\t' @RPMCONFIGDIR@/percolate "$tmpdir"/files+types "$tmpdir"/symlinks+targets JFS=$'\t' @RPMCONFIGDIR@/percolate "$tmpdir"/files+types "$tmpdir"/symlinks+targets
# append the remainder # append the remainder
if ! cut -f1 < "$tmpdir"/symlinks+targets | if ! cut -f1 < "$tmpdir"/symlinks+targets |
file -NF$'\t' -f- >>"$tmpdir"/files+types file4 -NF$'\t' -f- >>"$tmpdir"/files+types
then then
sed -n '/\t *ERROR:/p' "$tmpdir"/files+types >&2 sed -n '/\t *ERROR:/p' "$tmpdir"/files+types >&2
exit 1 exit 1

View File

@ -169,7 +169,7 @@ AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH) AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH) AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH) AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH) AC_PATH_PROG(__FILE, file4, /usr/bin/file4, $MYPATH)
AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH) AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH) AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
AC_PATH_PROG(__SUBST, subst, /usr/bin/subst, $MYPATH) AC_PATH_PROG(__SUBST, subst, /usr/bin/subst, $MYPATH)

View File

@ -45,7 +45,6 @@ Requires: bzip2 >= 1:1.0.2-alt4
Requires: coreutils Requires: coreutils
Requires: cpio Requires: cpio
Requires: elfutils >= 0.143-alt1 Requires: elfutils >= 0.143-alt1
Requires: file
Requires: gcc Requires: gcc
Requires: gettext-tools Requires: gettext-tools
Requires: glibc-devel Requires: glibc-devel

View File

@ -82,14 +82,14 @@ for d in `find "$RPM_BUILD_ROOT$RPM_COMPRESS_TOPDIR" -type d -name man`; do
find "$d" -type f \( -name \*.gz -o -name \*.Z \) -print0 |xargs -r0 gunzip find "$d" -type f \( -name \*.gz -o -name \*.Z \) -print0 |xargs -r0 gunzip
find "$d" -type f -name \*.bz2 -print0 |xargs -r0 bunzip2 find "$d" -type f -name \*.bz2 -print0 |xargs -r0 bunzip2
# First, compress normal files. # First, compress normal files.
for f in `find "$d" -type f -a \! -name whatis -print0 |xargs -r0 file |sed -rn 's/^([^[:space:]]+):[^:]*(troff or preprocessor input|ASCII.*) text.*/\1/p'`; do for f in `find "$d" -type f -a \! -name whatis -print0 |xargs -r0 file4 |sed -rn 's/^([^[:space:]]+):[^:]*(troff or preprocessor input|ASCII.*) text.*/\1/p'`; do
[ -f "$f" ] || continue [ -f "$f" ] || continue
if ! head -1 "$f" |grep -q '^.so '; then if ! head -1 "$f" |grep -q '^.so '; then
@RPMCONFIGDIR@/compress_files "$f" @RPMCONFIGDIR@/compress_files "$f"
fi fi
done done
# Second, convert .so links into symlinks. # Second, convert .so links into symlinks.
for f in `find "$d" -type f -a \! -name whatis -print0 |xargs -r0 file |sed -rn 's/^([^[:space:]]+):[^:]*(troff or preprocessor input|ASCII.*) text.*/\1/p'`; do for f in `find "$d" -type f -a \! -name whatis -print0 |xargs -r0 file4 |sed -rn 's/^([^[:space:]]+):[^:]*(troff or preprocessor input|ASCII.*) text.*/\1/p'`; do
[ -f "$f" ] || continue [ -f "$f" ] || continue
if head -1 "$f" |grep -q '^.so '; then if head -1 "$f" |grep -q '^.so '; then
f_dir="${f%/*}" f_dir="${f%/*}"

View File

@ -27,7 +27,7 @@ prune_tests="$(printf %s "$prune_paths" |
sort -u | sort -u |
sed -n '/^\// s/.*/ -o -path .&/p')" sed -n '/^\// s/.*/ -o -path .&/p')"
find . '(' -path './.*' $prune_tests ')' -prune -o -type f -print |sort | find . '(' -path './.*' $prune_tests ')' -prune -o -type f -print |sort |
file -NF$'\t' -f - >.tmp/file_full file4 -NF$'\t' -f - >.tmp/file_full
sed -n -e 's/\t.* ELF .* \(executable\|shared object\), .*, stripped.*//p' <.tmp/file_full >.tmp/fstripped sed -n -e 's/\t.* ELF .* \(executable\|shared object\), .*, stripped.*//p' <.tmp/file_full >.tmp/fstripped
if [ -s .tmp/fstripped ]; then if [ -s .tmp/fstripped ]; then

View File

@ -133,7 +133,7 @@ export RPM_VERIFY_ELF_LDD_RPATH
set -o pipefail set -o pipefail
find .$RPM_VERIFY_ELF_TOPDIR -path ./usr/lib/debug -prune -o -type f -print | find .$RPM_VERIFY_ELF_TOPDIR -path ./usr/lib/debug -prune -o -type f -print |
file -NF$'\t' -f - | file4 -NF$'\t' -f - |
while IFS=$'\t' read -r f t; do while IFS=$'\t' read -r f t; do
case " $t" in case " $t" in
*' ELF '*' shared object, no machine, '*) continue ;; *' ELF '*' shared object, no machine, '*) continue ;;

View File

@ -157,7 +157,7 @@ for f in "$@"; do
done done
fi fi
t="$(file -b "$f")" || continue t="$(file4 -b "$f")" || continue
[ -z "${t##Bourne* shell script text*}" ] || continue [ -z "${t##Bourne* shell script text*}" ] || continue

View File

@ -20,7 +20,7 @@
# #
for file in "$@"; do for file in "$@"; do
type=`file -b "$file"` || continue type=`file4 -b "$file"` || continue
case " $type" in case " $type" in
*' current ar archive') *' current ar archive')
chmod -v u+w,a-x,ug-s "$file" chmod -v u+w,a-x,ug-s "$file"

View File

@ -33,7 +33,7 @@ ShellReq()
local f="$1"; shift local f="$1"; shift
local t sh sh_num local t sh sh_num
t=$(file -bL "$f") || Fatal "${t:-$f: file type not available}" t=$(file4 -bL "$f") || Fatal "${t:-$f: file type not available}"
sh_num="$(print_sh_number_from_shebang <"$f")" sh_num="$(print_sh_number_from_shebang <"$f")"
case " $t" in case " $t" in
*"Bourne-Again shell script text"*) *"Bourne-Again shell script text"*)