From f62834a6bb4c036ea65b7a4cc59d09be6016a42f Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 15 Oct 2020 00:45:34 +0200 Subject: [PATCH] pkgdep/git: Don't install git if there's already supported version installed Change-Id: I2866994df8a5f268d7dea2154e0df87786397142 Signed-off-by: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4685 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Paul Luse --- test/common/config/pkgdep/git | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/common/config/pkgdep/git b/test/common/config/pkgdep/git index e82548330..9c4677b68 100644 --- a/test/common/config/pkgdep/git +++ b/test/common/config/pkgdep/git @@ -245,6 +245,15 @@ function install_libiscsi() { } function install_git() { + if type -P git; then + if [[ $(sort -V) == "$GIT_VERSION"* ]]; then + # Our version is on top, meaning there's a newer git version installed + # or we already have matching one on board. Either way, we don't need + # to do anything, return. + return 0 + fi <<< "$GIT_VERSION"$'\n'"$(git --version)" + fi >/dev/null + install zlib-devel curl-devel tar -C "$GIT_REPOS" -xzof <(wget -qO- "$GIT_REPO_GIT") (cd "$GIT_REPOS/git-$GIT_VERSION" \