diff --git a/build-aux/upgrade-port.sh b/build-aux/upgrade-port.sh index ce6866f6..6eaf4407 100755 --- a/build-aux/upgrade-port.sh +++ b/build-aux/upgrade-port.sh @@ -1,11 +1,24 @@ #!/bin/sh set -e -NAME=$(tix-vars -d '' "$1" NAME) +if [ -t 1 ]; then + RED='\033[91m' + YELLOW='\033[93m' + GREEN='\033[92m' + RESET='\033[m' +else + RED='' + YELLOW='' + GREEN='' + RESET='' +fi + COMPRESSION=$(tix-vars -d '' "$1" COMPRESSION) DISTNAME_REGEX=$(tix-vars -d '' "$1" DISTNAME_REGEX) +NAME=$(tix-vars -d '' "$1" NAME) RELEASE_SEARCH_PAGE=$(tix-vars -d '' "$1" RELEASE_SEARCH_PAGE) RELEASE_SEARCH_REGEX=$(tix-vars -d '' "$1" RELEASE_SEARCH_REGEX) +UPGRADE_BLOCKED=$(tix-vars -d '' "$1" UPGRADE_BLOCKED) UPSTREAM_ARCHIVE=$(tix-vars -d '' "$1" UPSTREAM_ARCHIVE) UPSTREAM_SITE=$(tix-vars -d '' "$1" UPSTREAM_SITE) VERSION=$(tix-vars -d '' "$1" VERSION) @@ -22,7 +35,7 @@ TAR_REGEX="(\.tar(\.(gz|bz2|xz)))" if [ -z "$RELEASE_SEARCH_PAGE" ]; then case "$UPSTREAM_SITE" in https://github.com/*/releases/*) - RELEASE_SEARCH_PAGE=$(echo "$UPSTREAM_SITE" | grep -Eo '.*/releases/');; + RELEASE_SEARCH_PAGE=$(echo "$UPSTREAM_SITE" | sed -E -e 's,https://github.com/(.*)/releases/.*,https://api.github.com/repos/\1/releases,');; *) RELEASE_SEARCH_PAGE="$UPSTREAM_SITE/";; esac fi @@ -54,7 +67,7 @@ instantiate() { upgrade_version "$1" "$2" | tix-vars - "$3" } -LATEST=$(curl -Ls "$RELEASE_SEARCH_PAGE" | grep -Eo "$RELEASE_SEARCH_REGEX" | sort -Vu | tail -1) +LATEST=$(curl --compressed -Ls "$RELEASE_SEARCH_PAGE" | grep -Eo "$RELEASE_SEARCH_REGEX" | sort -Vu | tail -1) case "$LATEST" in *.tar) COMPRESSION=tar;; *.tar.gz) COMPRESSION=tar.gz;; @@ -63,25 +76,17 @@ case "$LATEST" in esac NEW_VERSION="$(echo "$LATEST" | sed -E "s,$RELEASE_SEARCH_REGEX,\1,")" -if [ -t 1 ]; then - RED='\033[91m' - GREEN='\033[92m' - RESET='\033[m' -else - RED='' - GREEN='' - RESET='' -fi - if [ -z "$NEW_VERSION" ]; then printf "$RED%s$RESET\n" "$UPSTREAM_ARCHIVE failed to find available versions: $RELEASE_SEARCH_PAGE | grep -E '$RELEASE_SEARCH_REGEX'" exit 1 fi +NEW_VERSION=$({ echo "$NEW_VERSION" && echo "$VERSION"; } | sort -Vu | tail -1) + NEW_UPSTREAM_SITE=$(instantiate "$1" "$NEW_VERSION" "UPSTREAM_SITE") NEW_UPSTREAM_ARCHIVE=$(instantiate "$1" "$NEW_VERSION" "UPSTREAM_ARCHIVE") -if ! wget -q "$NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE" -O /dev/null; then +if ! wget -q --spider "$NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE"; then printf "$RED%s$RESET\n" "$NAME failed to download: $NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE" exit 1 fi @@ -91,6 +96,11 @@ if [ "$VERSION" = "$NEW_VERSION" ]; then exit fi +if [ -n "$UPGRADE_BLOCKED" ]; then + printf "$YELLOW%s$RESET\n" "$NAME $VERSION is blocked ($UPGRADE_BLOCKED) -> $NEW_VERSION $NEW_UPSTREAM_SITE/$NEW_UPSTREAM_ARCHIVE" + exit +fi + if [ "$2" = upgrade ]; then if [ "$(tix-vars -d false "$1" DEVELOPMENT)" = true ]; then echo "$0: warning: Not upgrading $1 in DEVELOPMENT=true mode" >&2 diff --git a/ports/libcairo/libcairo.port b/ports/libcairo/libcairo.port index ad94347f..1f2074f7 100644 --- a/ports/libcairo/libcairo.port +++ b/ports/libcairo/libcairo.port @@ -1,6 +1,7 @@ NAME=libcairo BUILD_LIBRARIES='libz libbz2 libpng libfreetype libfontconfig? librsvg? libexpat? libpixman libglib?' -VERSION=1.16.0 # Update blocked by meson adoption +UPGRADE_BLOCKED=meson +VERSION=1.16.0 DISTNAME=cairo-$VERSION COMPRESSION=tar.xz ARCHIVE=$DISTNAME.$COMPRESSION diff --git a/ports/libglib/libglib.port b/ports/libglib/libglib.port index dacc834a..467aa7aa 100644 --- a/ports/libglib/libglib.port +++ b/ports/libglib/libglib.port @@ -3,6 +3,7 @@ BUILD_LIBRARIES='libffi libiconv libintl libpcre libz libdbus? liblzma?' # NOTE: 2.58.0 and above do not ship with configure and instead require either # creating it locally using autotools or meson, so for time being we are # stuck at 2.56.4. +UPGRADE_BLOCKED=meson VERSION_MAJOR=2 VERSION_MINOR=56 VERSION_PATCH=4 diff --git a/ports/libpixman/libpixman.port b/ports/libpixman/libpixman.port index 39e044aa..44ca41dd 100644 --- a/ports/libpixman/libpixman.port +++ b/ports/libpixman/libpixman.port @@ -1,6 +1,7 @@ NAME=libpixman BUILD_LIBRARIES='libpng?' -VERSION=0.42.2 # Update blocked by meson adoption +UPGRADE_BLOCKED=meson +VERSION=0.42.2 DISTNAME=pixman-$VERSION COMPRESSION=tar.gz ARCHIVE=$DISTNAME.$COMPRESSION diff --git a/ports/libxkbcommon/libxkbcommon.port b/ports/libxkbcommon/libxkbcommon.port index 311ae427..55f75818 100644 --- a/ports/libxkbcommon/libxkbcommon.port +++ b/ports/libxkbcommon/libxkbcommon.port @@ -1,6 +1,7 @@ NAME=libxkbcommon BUILD_LIBRARIES= -VERSION=0.8.4 # Update blocked by meson adoption +UPGRADE_BLOCKED=meson +VERSION=0.8.4 DISTNAME=$NAME-$VERSION COMPRESSION=tar.xz ARCHIVE=$DISTNAME.$COMPRESSION diff --git a/share/man/man5/port.5 b/share/man/man5/port.5 index 6b7d0d1e..a56e6aa1 100644 --- a/share/man/man5/port.5 +++ b/share/man/man5/port.5 @@ -269,6 +269,8 @@ For Use the named port's source code instead. .It Sy SUBDIR Run the build commands in this subdir. +.It Sy UPGRADE_BLOCKED +A reason why upgrading to a newer version is blocked. .It Sy UPSTREAM_ARCHIVE The filename of the upstream release on .Sy UPSTREAM_SITE ,