Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use command -v over which for portability #1658

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
systemd-devel \
zlib-devel \
devtoolset-7-gcc-c++ \
which \
python3-devel \
python3-setuptools \
git \
Expand Down Expand Up @@ -116,7 +115,6 @@ jobs:
systemd-devel \
zlib-devel \
devtoolset-7-gcc-c++ \
which \
python3-devel \
python3-setuptools \
git \
Expand Down Expand Up @@ -183,7 +181,6 @@ jobs:
systemd-devel \
zlib-devel \
devtoolset-7-gcc-c++ \
which \
python2-pip \
python2-setuptools \
python2-devel \
Expand Down Expand Up @@ -310,7 +307,6 @@ jobs:
yum install --nogpg -y \
gcc-c++ \
rpm-build \
which \
git \
python-srpm-macros \
centos-release-scl
Expand Down Expand Up @@ -380,7 +376,6 @@ jobs:
dnf install --nogpg -y \
gcc-c++ \
rpm-build \
which \
tar \
dnf-plugins-core \
git
Expand Down Expand Up @@ -509,7 +504,6 @@ jobs:
systemd-devel \
zlib-devel \
devtoolset-7-gcc-c++ \
which \
python3-devel \
python3-setuptools \
git \
Expand Down Expand Up @@ -557,7 +551,6 @@ jobs:
systemd-devel \
zlib-devel \
devtoolset-7-gcc-c++ \
which \
python3-devel \
python3-setuptools \
git \
Expand Down
28 changes: 14 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build:cs9:
image: gitlab-registry.cern.ch/linuxsupport/cs9-base
script:
- dnf install -y epel-release
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git
- dnf install -y cppunit-devel
- cd packaging/
- ./makesrpm.sh --define "_with_python3 1" --define "_with_tests 1" --define "_without_xrootd_user 1" --define "_with_xrdclhttp 1" --define "_with_scitokens 1" -D "dist .el9"
Expand Down Expand Up @@ -70,7 +70,7 @@ build:cs8:
image: gitlab-registry.cern.ch/linuxsupport/cs8-base
script:
- dnf install -y epel-release
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git
- dnf config-manager --set-enabled powertools
- cd packaging
- ./makesrpm.sh --define "_with_python3 1" --define "_with_tests 1" --define "_with_xrdclhttp 1" --define "_with_scitokens 1"
Expand Down Expand Up @@ -101,7 +101,7 @@ build:cc7:
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- head -n -6 /etc/yum.repos.d/epel.repo > /tmp/epel.repo ; mv -f /tmp/epel.repo /etc/yum.repos.d/epel.repo
- yum install --nogpg -y gcc-c++ rpm-build which git python-srpm-macros centos-release-scl
- yum install --nogpg -y gcc-c++ rpm-build git python-srpm-macros centos-release-scl
- cd packaging/
- ./makesrpm.sh --define "_with_python3 1" --define "_with_tests 1" --define "_with_xrdclhttp 1" --define "_with_scitokens 1" --define "_with_isal 1"
- yum-builddep --nogpgcheck -y *.src.rpm
Expand Down Expand Up @@ -129,7 +129,7 @@ build:cc7:
# stage: build:rpm
# image: fedora:36
# script:
# - dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git
# - dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git
# - cd packaging/
# - ./makesrpm.sh --define "_with_python3 1" --define "_with_xrdclhttp 1" --define "_with_ceph11 1"
# - dnf builddep --nogpgcheck -y *.src.rpm
Expand Down Expand Up @@ -157,7 +157,7 @@ build:fedorai-35:
stage: build:rpm
image: fedora:35
script:
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git
- cd packaging/
- ./makesrpm.sh --define "_with_python3 1" --define "_with_ceph11 1"
- dnf builddep --nogpgcheck -y *.src.rpm
Expand Down Expand Up @@ -185,7 +185,7 @@ build:fedora-34:
stage: build:rpm
image: fedora:34
script:
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git
- cd packaging/
- ./makesrpm.sh --define "_with_python3 1" --define "_with_xrdclhttp 1" --define "_with_ceph11 1"
- dnf builddep --nogpgcheck -y *.src.rpm
Expand Down Expand Up @@ -213,7 +213,7 @@ build:fedora-33:
stage: build:rpm
image: fedora:33
script:
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git
- cd packaging/
- ./makesrpm.sh --define "_with_python3 1" --define "_with_xrdclhttp 1" --define "_with_ceph11 1"
- dnf builddep --nogpgcheck -y *.src.rpm
Expand Down Expand Up @@ -299,7 +299,7 @@ release:cs8-x86_64:
image: gitlab-registry.cern.ch/linuxsupport/cs8-base
script:
- dnf install -y epel-release
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git python-macros
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git python-macros
- dnf config-manager --set-enabled powertools
- dnf install -y cppunit-devel
- dnf -y update libarchive
Expand Down Expand Up @@ -331,7 +331,7 @@ release:rocky8-x86_64:
image: rockylinux:8
script:
- dnf install -y epel-release
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git python-macros
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git python-macros
- dnf config-manager --set-enabled powertools
- dnf install -y cppunit-devel
- dnf -y update libarchive
Expand Down Expand Up @@ -363,13 +363,13 @@ release:cc7-x86_64:
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- head -n -6 /etc/yum.repos.d/epel.repo > /tmp/epel.repo ; mv -f /tmp/epel.repo /etc/yum.repos.d/epel.repo
- yum install --nogpg -y gcc-c++ rpm-build which git python-srpm-macros centos-release-scl
- yum install --nogpg -y gcc-c++ rpm-build git python-srpm-macros centos-release-scl
- mkdir cc-7-x86_64
- ./gen-tarball.sh $CI_COMMIT_TAG
- mv xrootd-${CI_COMMIT_TAG#"v"}.tar.gz cc-7-x86_64
- cd packaging/
- git checkout tags/${CI_COMMIT_TAG}
- ./makesrpm.sh --define "_with_python3 1" --define "_with_tests 1" --define "_without_xrootd_user 1" --define "_with_xrdclhttp 1" --define "_with_scitokens 1" --define "_with_isal 1" -D "dist .el7"
- ./makesrpm.sh --define "_with_python3 1" --define "_with_tests 1" --define "_without_xrootd_user 1" --define "_with_xrdclhttp 1" --define "_with_scitokens 1" --define "_with_isal 1" -D "dist .el7"
- yum-builddep --nogpgcheck -y *.src.rpm
- mkdir RPMS
- rpmbuild --rebuild --define "_rpmdir RPMS/" --define "_with_python3 1" --define "_with_tests 1" --define "_without_xrootd_user 1" --define "_with_xrdclhttp 1" --define "_with_scitokens 1" --define "_with_isal 1" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" -D "dist .el7" *.src.rpm
Expand Down Expand Up @@ -412,7 +412,7 @@ release:pypi:
stage: build:rpm
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- yum install --nogpg -y git python3-pip which
- yum install --nogpg -y git python3-pip
- cp packaging/wheel/* .
- ./publish.sh
artifacts:
Expand Down Expand Up @@ -448,7 +448,7 @@ weekly:cs8:
image: gitlab-registry.cern.ch/linuxsupport/cs8-base
script:
- dnf install -y epel-release
- dnf install --nogpg -y gcc-c++ rpm-build which tar dnf-plugins-core git python-macros
- dnf install --nogpg -y gcc-c++ rpm-build tar dnf-plugins-core git python-macros
- dnf config-manager --set-enabled powertools
- dnf install -y cppunit-devel
- dnf -y update libarchive
Expand Down Expand Up @@ -483,7 +483,7 @@ weekly:cc7:
image: gitlab-registry.cern.ch/linuxsupport/cc7-base
script:
- head -n -6 /etc/yum.repos.d/epel.repo > /tmp/epel.repo ; mv -f /tmp/epel.repo /etc/yum.repos.d/epel.repo
- yum install --nogpg -y gcc-c++ rpm-build which git cppunit-devel python-srpm-macros centos-release-scl
- yum install --nogpg -y gcc-c++ rpm-build git cppunit-devel python-srpm-macros centos-release-scl
- xrootd_version=$(git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags | grep '^refs/tags/v' | grep -v 'rc.*$' | grep -v 'osghotfix' | grep -v 'CERN$' | sed -e '$!d')
- xrootd_version=${xrootd_version:11}
- echo $xrootd_version
Expand Down
4 changes: 2 additions & 2 deletions genversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function getVersionFromRefs()
function getVersionFromLog()
{
AWK=gawk
EX="`which gawk`"
EX="$(command -v gawk)"
if test x"${EX}" == x -o ! -x "${EX}"; then
AWK=awk
fi
Expand Down Expand Up @@ -167,7 +167,7 @@ elif test x$USER_VERSION != x; then
#-------------------------------------------------------------------------------
else
echo "[I] Determining version from git" 1>&2
EX="`which git`"
EX="$(command -v git)"
if test x"${EX}" == x -o ! -x "${EX}"; then
echo "[!] Unable to find git in the path: setting the version tag to unknown" 1>&2
else
Expand Down
2 changes: 1 addition & 1 deletion packaging/makesrpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CERNEXP='^[0-9]+\.[0-9]+\.[0-9]+\-[0-9]+\.CERN.*$'
function findProg()
{
for prog in $@; do
if test -x "`which $prog 2>/dev/null`"; then
if test -x "$(command -v $prog 2>/dev/null)"; then
echo $prog
break
fi
Expand Down