fix parsing of maven package cache

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 <jakub@status.im>
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Jakub Sokołowski 2020-05-04 10:05:36 +02:00 committed by Andrey Shovkoplyas
parent c74beec17a
commit 6aba34b82d
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 11 additions and 1 deletions

View File

@ -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() {