Skip to content

Commit 3ffddde

Browse files
committed
adapt for new era
1 parent 460256b commit 3ffddde

18 files changed

+174
-163
lines changed

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
NAME = spec-helper
2-
VERSION = 0.31.49
3-
SVNPATH = [email protected]:OpenMandrivaSoftware/spec-helper.git
2+
VERSION = 0.31.50
3+
GITPATH = [email protected]:OpenMandrivaSoftware/spec-helper.git
44

55
SCRIPT_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 \
8-
python_shebangs
7+
remove_info_dir remove_libtool_files remove_rpath relink_symlinks fix_eol
8+
99
BIN_FILES = rediff_patch spec-cleaner
10-
MACROS_FILES = spec-helper.macros
10+
MACROS_FILES = macros.spec-helper
1111
TEST_FILES = t/*.t
1212
FILES = Makefile NEWS README \
1313
$(SCRIPT_FILES) $(BIN_FILES) $(MACROS_FILES:=.in) \
@@ -17,20 +17,20 @@ TEST_VERBOSE = 0
1717

1818
bindir = /usr/bin
1919
pkgdatadir = /usr/share/$(NAME)
20-
rpmmacrosdir = /etc/rpm/macros.d
20+
rpmmacrodir = /usr/lib/rpm/macros.d
2121

2222
all:
2323
@echo "use make install or make dist"
2424

2525
install: $(MACROS_FILES)
2626
install -d -m 755 $(DESTDIR)$(bindir)
27-
install -m 755 $(BIN_FILES) $(DESTDIR)$(bindir)
27+
install -p -m 755 $(BIN_FILES) $(DESTDIR)$(bindir)
2828
install -d -m 755 $(DESTDIR)$(pkgdatadir)
29-
install -m 755 $(SCRIPT_FILES) $(DESTDIR)$(pkgdatadir)
30-
install -d -m 755 $(DESTDIR)/$(rpmmacrosdir)
31-
install -m 644 $(MACROS_FILES) $(DESTDIR)/$(rpmmacrosdir)
29+
install -p -m 755 $(SCRIPT_FILES) $(DESTDIR)$(pkgdatadir)
30+
install -d -m 755 $(DESTDIR)$(rpmmacrodir)
31+
install -p -m 644 $(MACROS_FILES) $(DESTDIR)$(rpmmacrodir)
3232

33-
spec-helper.macros: spec-helper.macros.in
33+
macros.spec-helper: macros.spec-helper.in
3434
sed -e 's:@pkgdatadir@:$(pkgdatadir):' < $< > $@
3535

3636
clean:

check_elf_files

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# Check elf files
33

44
if [ -z "$RPM_BUILD_ROOT" ]; then
5-
echo "No build root defined" >&2
5+
printf '%s\n' "No build root defined" >&2
66
exit 1
77
fi
88

99
if [ ! -d "$RPM_BUILD_ROOT" ]; then
10-
echo "Invalid build root" >&2
10+
printf '%s\n' "Invalid build root" >&2
1111
exit 1
1212
fi
1313

14-
LIB="`rpm --eval %{_lib}`"
14+
LIB="$(rpm --eval %{_lib})"
1515
export LD_LIBRARY_PATH="$RPM_BUILD_ROOT/$LIB:$RPM_BUILD_ROOT/usr/$LIB"
1616

1717

@@ -23,13 +23,13 @@ find "$RPM_BUILD_ROOT" -type f \( -executable -o -name \*.so\* \) -a \
2323
xargs --no-run-if-empty -0 file -N -L |
2424
grep -e '\.so.*: ELF.*shared' -e ': ELF.*executable' |
2525
while read match; do
26-
path="`echo $match | sed -e 's#\(\.so.*\): ELF.*shared.*#\1#' -e 's#: ELF.*executable.*##'`"
27-
syspath="`echo $path | sed -e \"s#^$RPM_BUILD_ROOT##\"`"
28-
if echo $match | grep -q -e ': ELF'; then
29-
unused_libs="`ldd -u -r $path 2> /dev/null | grep /`"
26+
path="$(printf '%s\n' $match | sed -e 's#\(\.so.*\): ELF.*shared.*#\1#' -e 's#: ELF.*executable.*##')"
27+
syspath="$(printf '%s\n' $path | sed -e \"s#^$RPM_BUILD_ROOT##\")"
28+
if printf '%s\n' $match | grep -q -e ': ELF'; then
29+
unused_libs="$(ldd -u -r $path 2> /dev/null | grep /)"
3030
if [ -n "$unused_libs" ]; then
31-
echo "Warning: unused libraries in $syspath: " >&2
32-
echo "$unused_libs" >&2
31+
printf '%s\n' "Warning: unused libraries in $syspath: " >&2
32+
printf '%s\n' "$unused_libs" >&2
3333
fi
3434
fi
3535
done
@@ -41,11 +41,11 @@ find "$RPM_BUILD_ROOT" -type f -name \*.so\* -a \
4141
xargs --no-run-if-empty -0 file -N -L |
4242
grep -e '\.so.*: ELF.*shared' |
4343
while read match; do
44-
path="`echo $match | sed -e 's#\(\.so.*\): ELF.*shared.*#\1#'`"
45-
syspath="`echo $path | sed -e \"s#^$RPM_BUILD_ROOT##\"`"
46-
unused_libs="`ldd -u -r $path 2> /dev/null | grep /`"
47-
undefined_symbols="`ldd -r $path 2>&1 | grep '^undefined symbol: '| sed -e 's#^undefined symbol:##g' -e \"s#($path).*##g\" | tr -d '\n' | tr -d '\t'`"
44+
path="$(printf '%s\n' $match | sed -e 's#\(\.so.*\): ELF.*shared.*#\1#')"
45+
syspath="$(printf '%s\n' $path | sed -e \"s#^$RPM_BUILD_ROOT##\")"
46+
unused_libs="$(ldd -u -r $path 2> /dev/null | grep /)"
47+
undefined_symbols="$(ldd -r $path 2>&1 | grep '^undefined symbol: '| sed -e 's#^undefined symbol:##g' -e \"s#($path).*##g\" | tr -d '\n' | tr -d '\t')"
4848
if [ -n "$undefined_symbols" ]; then
49-
echo "Warning: undefined symbols in $syspath:$undefined_symbols" >&2
49+
printf '%s\n' "Warning: undefined symbols in $syspath:$undefined_symbols" >&2
5050
fi
5151
done

clean_files

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
# remove backup files
33

44
if [ -z "$RPM_BUILD_ROOT" ]; then
5-
echo "No build root defined" >&2
5+
printf '%s\n' "No build root defined" >&2
66
exit 1
77
fi
88

99
if [ ! -d "$RPM_BUILD_ROOT" ]; then
10-
echo "Invalid build root" >&2
10+
printf '%s\n' "Invalid build root" >&2
1111
exit 1
1212
fi
1313

1414
if [ -n "$1" ]; then
15-
DIRECTORY=$(echo $1 | sed -e "s#^$RPM_BUILD_ROOT##g")
15+
DIRECTORY=$(printf '%s\n' $1 | sed -e "s#^$RPM_BUILD_ROOT##g")
1616
if [ ! -d "$RPM_BUILD_ROOT$DIRECTORY" ]; then
1717
exit 0
1818
fi

clean_perl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
#!/bin/sh
22

33
if [ -z "$RPM_BUILD_ROOT" ]; then
4-
echo "No build root defined" >&2
4+
printf '%s\n' "No build root defined" >&2
55
exit 1
66
fi
77

88
if [ ! -d "$RPM_BUILD_ROOT" ]; then
9-
echo "Invalid build root" >&2
9+
printf '%s\n' "Invalid build root" >&2
1010
exit 1
1111
fi
1212

1313
perldirs="$RPM_BUILD_ROOT/usr/lib/perl5 $RPM_BUILD_ROOT/usr/lib64/perl5 $RPM_BUILD_ROOT/usr/share/perl5"
1414
d=""
1515
for i in $perldirs; do
16-
[ -d "$i" ] || continue
17-
d="$d $i"
16+
[ -d "$i" ] || continue
17+
d="$d $i"
1818
done
1919
[ -z "$d" ] && exit 0
2020

2121
find $d -name ".packlist" -o -name perllocal.pod | xargs rm -f
2222

2323
for i in $(find $d -name "*.bs"); do
2424
if [ -s $i ]; then
25-
echo "non empty .bs file!"
25+
printf '%s\n' "non empty .bs file!"
2626
else
2727
rm -f $i
2828
fi

fix_eol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
# convert end of line patterns from DOS to UNIX
33

44
if [ -z "$RPM_BUILD_ROOT" ]; then
5-
echo "No build root defined" >&2
5+
printf '%s\n' "No build root defined" >&2
66
exit 1
77
fi
88

99
if [ ! -d "$RPM_BUILD_ROOT" ]; then
10-
echo "Invalid build root" >&2
10+
printf '%s\n' "Invalid build root" >&2
1111
exit 1
1212
fi
1313

1414
if [ -n "$1" ]; then
15-
DIRECTORY=$(echo $1 | sed -e "s#^$RPM_BUILD_ROOT##g")
15+
DIRECTORY=$(printf '%s\n' $1 | sed -e "s#^$RPM_BUILD_ROOT##g")
1616
if [ ! -d "$RPM_BUILD_ROOT$DIRECTORY" ]; then
1717
exit 0
1818
fi

fix_file_permissions

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/sh
22

33
if [ -z "$RPM_BUILD_ROOT" ]; then
4-
echo "No build root defined" >&2
4+
printf '%s\n' "No build root defined" >&2
55
exit 1
66
fi
77

88
if [ ! -d "$RPM_BUILD_ROOT" ]; then
9-
echo "Invalid build root" >&2
9+
printf '%s\n' "Invalid build root" >&2
1010
exit 1
1111
fi
1212

@@ -28,11 +28,11 @@ done
2828
if [ -d "${RPM_BUILD_ROOT}/usr/share/info/" ]; then
2929
find "${RPM_BUILD_ROOT}/usr/share/info/" \
3030
-type f -print0 |
31-
xargs --no-run-if-empty -0 chmod 644
31+
xargs --no-run-if-empty -0 chmod 644
3232
fi
3333

3434
if [ -d "${RPM_BUILD_ROOT}/usr/share/man/" ]; then
3535
find "${RPM_BUILD_ROOT}/usr/share/man/" \
3636
-type f -print0 |
37-
xargs --no-run-if-empty -0 chmod 644
37+
xargs --no-run-if-empty -0 chmod 644
3838
fi

fix_mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
#---------------------------------------------------------------
1111

1212
if [ -z "$RPM_BUILD_ROOT" ]; then
13-
echo "No build root defined" >&2
13+
printf '%s\n' "No build root defined" >&2
1414
exit 1
1515
fi
1616

1717
if [ ! -d "$RPM_BUILD_ROOT" ]; then
18-
echo "Invalid build root" >&2
18+
printf '%s\n' "Invalid build root" >&2
1919
exit 1
2020
fi
2121

@@ -40,7 +40,7 @@ for i in "$KO_MESSAGES"/*.mo ; do
4040
sed 's:그놈:GNOME:g' < $TMP > $TMP2 && msgfmt -o $i $TMP2
4141
ret=$?
4242
else
43-
echo "Unsupported encoding" 1>&2
43+
printf '%s\n' "Unsupported encoding" 1>&2
4444
fi
4545
done
4646

fix_pamd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/bin/sh
22

33
if [ -z "$RPM_BUILD_ROOT" ]; then
4-
echo "No build root defined" >&2
4+
printf '%s\n' "No build root defined" >&2
55
exit 1
66
fi
77

88
if [ ! -d "$RPM_BUILD_ROOT" ]; then
9-
echo "Invalid build root" >&2
9+
printf '%s\n' "Invalid build root" >&2
1010
exit 1
1111
fi
1212

13-
configs=`find $RPM_BUILD_ROOT/etc/pam.d/ -type f ! -type l 2> /dev/null`
13+
configs=$(find $RPM_BUILD_ROOT/etc/pam.d/ -type f ! -type l 2> /dev/null)
1414
if [ -n "$configs" ]; then
15-
echo -n "Fixing pam.d config files..."
15+
printf '%s\n' "Fixing pam.d config files..."
1616
sed -e 's,/lib64/security/,,g ; s,/lib/security/,,g' $configs
17-
echo "done"
17+
printf '%s\n' "...done"
1818
fi

fix_pkgconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
# (c) Andrey Bondrov <[email protected]> 2016
88

99
if [ -z "$RPM_BUILD_ROOT" ]; then
10-
echo "No build root defined" >&2
10+
printf '%s\n' "No build root defined" >&2
1111
exit 1
1212
fi
1313

1414
if [ ! -d "$RPM_BUILD_ROOT" ]; then
15-
echo "Invalid build root" >&2
15+
printf '%s\n' "Invalid build root" >&2
1616
exit 1
1717
fi
1818

19-
for pc in $(find "$RPM_BUILD_ROOT" -name \*.pc); do
19+
for pc in $(find "$RPM_BUILD_ROOT" -name \*.pc -type f); do
2020
export PKG_CONFIG_PATH="$(dirname $pc)"
2121
pcfile="$(basename $pc)"
22-
pcmodule="$(echo $pcfile|cut -d. -f1)"
22+
pcmodule="$(printf '%s\n' $pcfile|cut -d. -f1)"
2323
for variable in $(pkg-config --print-variables "$pcmodule"); do
2424
dir=$(pkg-config --variable="$variable" "$pcmodule")
2525
if [[ "$dir" == "/"* && -d "$dir" ]]; then
26-
if [ "$dir" != "`realpath $dir`" ]; then
26+
if [ "$dir" != "$(realpath $dir)" ]; then
2727
parentdir=$(dirname ${dir})
2828
subdir=$(basename ${dir})
2929
regexp="-e s|\(${variable}=.*/${subdir}\)/.*\$|\1|g"

fix_xdg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# Fix .desktop files to be compliant with XDG specification
33

44
if [ -z "$RPM_BUILD_ROOT" ]; then
5-
echo "No build root defined" >&2
5+
printf '%s\n' "No build root defined" >&2
66
exit 1
77
fi
88

99
if [ ! -d "$RPM_BUILD_ROOT" ]; then
10-
echo "Invalid build root" >&2
10+
printf '%s\n' "Invalid build root" >&2
1111
exit 1
1212
fi
1313

@@ -18,4 +18,3 @@ do
1818
# if these lines do not end with '='
1919
sed -i 's/^\(Actions=.*\|MimeType=.*\|OnlyShowIn=.*\|Categories=.*\)\([[:alnum:]]\)[[:space:]]*$/\1\2;/' "$f"
2020
done
21-

0 commit comments

Comments
 (0)