[vlc-commits] [Git][videolan/vlc][master] 2 commits: extras/tools: use 'command -v' to assert commands

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Apr 24 17:12:07 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
1eed0a4a by Khalid Masum at 2023-04-24T15:01:12+00:00
extras/tools: use 'command -v' to assert commands

Currently we are using commandname --version to check wheather a
command exists. Hence if a command is not shipped with --version the
check fails. For example busybox implementation of sha512sum fails
to get detected via this method.

Use command -v to check whether a command exists to fix this limitation.

- - - - -
6f887e5e by Khalid Masum at 2023-04-24T15:01:12+00:00
extras/tools: broden support for sha512sum

sha512sum uses --check, which is not supported by many other
implementations of sha512sum such as  busybox. Using -c instead
will let this script usable in more distros and OSes.

- - - - -


1 changed file:

- extras/tools/tools.mak


Changes:

=====================================
extras/tools/tools.mak
=====================================
@@ -9,14 +9,14 @@ TARBALLS := $(TOOLS)
 # common rules
 #
 
-ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
+ifeq ($(shell command -v curl >/dev/null 2>&1 || echo FAIL),)
 download = curl -f -L -- "$(1)" > "$@.tmp" && touch $@.tmp && mv $@.tmp $@
-else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
+else ifeq ($(shell command -v wget >/dev/null 2>&1 || echo FAIL),)
 download = rm -f $@.tmp && \
 	wget --passive -c -p -O $@.tmp "$(1)" && \
 	touch $@.tmp && \
 	mv $@.tmp $@
-else ifeq ($(which fetch >/dev/null 2>&1 || echo FAIL),)
+else ifeq ($(shell command -v fetch >/dev/null 2>&1 || echo FAIL),)
 download = rm -f $@.tmp && \
 	fetch -p -o $@.tmp "$(1)" && \
 	touch $@.tmp && \
@@ -25,11 +25,11 @@ else
 download = $(error Neither curl nor wget found!)
 endif
 
-ifeq ($(shell sha512sum --version >/dev/null 2>&1 || echo FAIL),)
-SHA512SUM = sha512sum --check
-else ifeq ($(shell shasum --version >/dev/null 2>&1 || echo FAIL),)
+ifeq ($(shell command -v sha512sum >/dev/null 2>&1 || echo FAIL),)
+SHA512SUM = sha512sum -c
+else ifeq ($(shell command -v shasum >/dev/null 2>&1 || echo FAIL),)
 SHA512SUM = shasum -a 512 --check
-else ifeq ($(shell openssl version >/dev/null 2>&1 || echo FAIL),)
+else ifeq ($(shell command -v openssl >/dev/null 2>&1 || echo FAIL),)
 SHA512SUM = openssl dgst -sha512
 else
 SHA512SUM = $(error SHA-512 checksumming not found!)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2715d41ebede22cfa9cb7427d4486fc228feeef9...6f887e5e28930636ead4d2f8841b89a714d39067

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2715d41ebede22cfa9cb7427d4486fc228feeef9...6f887e5e28930636ead4d2f8841b89a714d39067
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list