RPM: remove dependency on the which utility
It is not necessary to know the full path to a program. Instead use the 'type' shell builtin (part of POSIX) to detect availability. Change-Id: Id68b298625d389a1f7843f52f56312bf81d97b80 Reviewed-on: https://code.wireshark.org/review/31540 Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
parent
e5f7f15b1f
commit
60e32b6eb3
|
@ -76,7 +76,6 @@ rpm-centos-7:
|
|||
image: centos:7
|
||||
script:
|
||||
- yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
|
||||
- yum install -y which
|
||||
- tools/rpm-setup.sh --install-optional -y
|
||||
- mkdir build
|
||||
- cd build
|
||||
|
@ -86,7 +85,7 @@ rpm-centos-7:
|
|||
rpm-opensuse-42.3:
|
||||
image: opensuse:42.3
|
||||
script:
|
||||
- zypper --non-interactive install which update-desktop-files
|
||||
- zypper --non-interactive install update-desktop-files
|
||||
- tools/rpm-setup.sh --install-optional ruby
|
||||
- gem install asciidoctor
|
||||
- mkdir build
|
||||
|
@ -98,7 +97,6 @@ rpm-fedora-28:
|
|||
image: fedora:28
|
||||
script:
|
||||
- dnf upgrade -y
|
||||
- dnf install -y which
|
||||
- tools/rpm-setup.sh --install-optional -y
|
||||
- mkdir build
|
||||
- cd build
|
||||
|
|
|
@ -293,7 +293,7 @@ cmake3 \
|
|||
%if %{with ninja}
|
||||
# Older RPM-based distributions used ninja-build in order to prevent a collision with
|
||||
# the Ninja IRC client: https://bugzilla.redhat.com/show_bug.cgi?id=1166135
|
||||
NINJA=$(which ninja || which ninja-build)
|
||||
NINJA=$(type ninja >/dev/null 2>&1 && echo ninja || echo ninja-build)
|
||||
$NINJA
|
||||
%else
|
||||
# Suggestion: put this in your ~/.rpmmacros (without the hash sign, of course):
|
||||
|
@ -307,7 +307,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||
cd build
|
||||
%endif
|
||||
%if %{with ninja}
|
||||
NINJA=$(which ninja || which ninja-build)
|
||||
NINJA=$(type ninja >/dev/null 2>&1 && echo ninja || echo ninja-build)
|
||||
DESTDIR=$RPM_BUILD_ROOT $NINJA install
|
||||
%if %{with guides}
|
||||
DESTDIR=$RPM_BUILD_ROOT $NINJA install_guides
|
||||
|
|
|
@ -71,9 +71,11 @@ ADDITIONAL_LIST="libnl3-devel \
|
|||
rpm-build"
|
||||
|
||||
# Guess which package manager we will use
|
||||
PM=`which zypper 2> /dev/null ||
|
||||
which dnf 2> /dev/null ||
|
||||
which yum 2> /dev/null`
|
||||
for PM in zypper dnf yum ''; do
|
||||
if type "$PM" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z $PM ]
|
||||
then
|
||||
|
@ -82,14 +84,14 @@ then
|
|||
fi
|
||||
|
||||
case $PM in
|
||||
*/zypper)
|
||||
zypper)
|
||||
PM_OPT="--non-interactive"
|
||||
PM_SEARCH="search -x --provides"
|
||||
;;
|
||||
*/dnf)
|
||||
dnf)
|
||||
PM_SEARCH="info"
|
||||
;;
|
||||
*/yum)
|
||||
yum)
|
||||
PM_SEARCH="info"
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue