Marcel Telka
2024-02-04 d172cac9cdb4dd5d5ddda279f6a6590d132aa9b5
tools/python-integrate-project: prefer default COMPONENT_ARCHIVE_URL

1 files modified
21 ■■■■■ changed files
tools/python-integrate-project 21 ●●●●● patch | view | raw | blame | history
tools/python-integrate-project
@@ -239,7 +239,7 @@
COMPONENT_SUMMARY =        $PROJECT - TODO
EOF
[[ -n "$HOMEPAGE" ]] && printf "COMPONENT_PROJECT_URL =\t\t%s\n" "$HOMEPAGE"
[[ -n "$DOWNLOAD_URL" ]] && printf 'COMPONENT_ARCHIVE_URL =\t\t\\\n\t%s\n' "$DOWNLOAD_URL"
[[ -n "$DOWNLOAD_URL" ]] && printf 'DOWNLOAD_URL =\t\t\\\n\t%s\n' "$DOWNLOAD_URL"
cat <<EOF
COMPONENT_ARCHIVE_HASH =    \\
    sha256:TODO
@@ -254,6 +254,25 @@
printf "\n"
) > Makefile
# If the automatically constructed COMPONENT_ARCHIVE_URL points to the same
# location as DOWNLOAD_URL then we should use it
if [[ -n "$DOWNLOAD_URL" ]] ; then
    COMPONENT_ARCHIVE_URL=$($GMAKE print-value-COMPONENT_ARCHIVE_URL)
    [[ "$COMPONENT_ARCHIVE_URL" == "$DOWNLOAD_URL" ]] && DOWNLOAD_URL=
fi
# The default COMPONENT_ARCHIVE_URL usually redirects to DOWNLOAD_URL so check
# that too
if [[ -n "$DOWNLOAD_URL" ]] ; then
    [[ $($CURL --head --write-out "%{redirect_url}\n" --output /dev/null \
        "$COMPONENT_ARCHIVE_URL") == "$DOWNLOAD_URL" ]] && DOWNLOAD_URL=
fi
# Use either DOWNLOAD_URL or default COMPONENT_ARCHIVE_URL
if [[ -n "$DOWNLOAD_URL" ]] ; then
    sed -i -e $'s/^DOWNLOAD_URL =/COMPONENT_ARCHIVE_URL =/' Makefile
else
    sed -i -e $'/^DOWNLOAD_URL =/,+1d' Makefile
fi
# Remove COMPONENT_REVISION if not needed
COMPONENT_VERSION=$($GMAKE print-value-COMPONENT_VERSION)
[[ "$PREV_VER" != "$COMPONENT_VERSION" ]] && sed -i -e '/^COMPONENT_REVISION/d' Makefile