From 6aba34b82d4690e0b3fcd7dae69961e1087daf8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 4 May 2020 10:05:36 +0200 Subject: [PATCH] fix parsing of maven package cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Depending on Maven version the file that contains name of repository will be named _remote.repositories or _maven.repositories. Signed-off-by: Jakub SokoĊ‚owski Signed-off-by: Andrey Shovkoplyas --- nix/deps/clojure/generate.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nix/deps/clojure/generate.sh b/nix/deps/clojure/generate.sh index fdef8c6304..2a5ad84537 100755 --- a/nix/deps/clojure/generate.sh +++ b/nix/deps/clojure/generate.sh @@ -3,6 +3,7 @@ set -e GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) +source "${GIT_ROOT}/scripts/colors.sh" if [[ -z "${IN_NIX_SHELL}" ]]; then echo "Remember to call 'make shell'!" @@ -25,7 +26,16 @@ function gen_deps_list() { } function get_repo_for_dir() { - grep -oP '.*>\K\w+' "${1}/_remote.repositories" | uniq + # This file has different name depending on Maven version + if [[ -f "${1}/_remote.repositories" ]]; then + REPO_FILE="${1}/_remote.repositories" + elif [[ -f "${1}/_maven.repositories" ]]; then + REPO_FILE="${1}/_maven.repositories" + else + echo -e "${RED}Cannot find Maven repo file for:${RST} ${1}" >&2 + exit 1 + fi + grep -oP '.*>\K\w+' "${REPO_FILE}" | uniq } function get_nix_sha() {