Marcel Telka
2022-09-12 6866e11e6af07adf424a0b0a83d278a71c97b07f
tools/perl-integrate-module: support for non-default download url

1 files modified
15 ■■■■■ changed files
tools/perl-integrate-module 15 ●●●●● patch | view | raw | blame | history
tools/perl-integrate-module
@@ -97,6 +97,13 @@
    exit 1
fi
# Get download_url
DOWNLOAD_URL=$(printf "%s" "$METACPAN_MODULE" | /usr/bin/jq -r '.download_url')
if (($? != 0)) || [[ -z "$DOWNLOAD_URL" || "$DOWNLOAD_URL" == "null" ]] ; then
    printf "WARNING: Failed to get download_url for module %s from metacpan\n" "$MODULE" >&2
    DOWNLOAD_URL=
fi
# Prepare the directory
DIR="$DIR/$DISTRIBUTION"
@@ -176,6 +183,14 @@
printf "\n"
) > Makefile
# If the automatically constructed COMPONENT_ARCHIVE_URL is not correct then we
# do not need COMPONENT_CPAN_AUTHOR.  We need COMPONENT_ARCHIVE_URL instead.
if [[ -n "$DOWNLOAD_URL" ]] ; then
    COMPONENT_ARCHIVE_URL=$(gmake print-value-COMPONENT_ARCHIVE_URL)
    [[ "$COMPONENT_ARCHIVE_URL" == "$DOWNLOAD_URL" ]] && DOWNLOAD_URL=
fi
[[ -n "$DOWNLOAD_URL" ]] && sed -i -e 's|^COMPONENT_CPAN_AUTHOR.*|COMPONENT_ARCHIVE_URL=\t\t'"$DOWNLOAD_URL"'|g' Makefile
# Remove COMPONENT_REVISION if not needed
COMPONENT_VERSION=$(gmake print-value-COMPONENT_VERSION)
[[ "$PREV_VER" != "$COMPONENT_VERSION" ]] && REBUILD=0 && sed -i -e '/^COMPONENT_REVISION/d' Makefile