Merge pull request #302 from mite-user/master

osxcross-macports: add package version check
This commit is contained in:
Thomas Pöchtrager 2021-09-22 09:00:58 +02:00 committed by GitHub
commit daeff0701c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -274,11 +274,18 @@ verifyFileIntegrity()
getPkgUrl()
{
local pkgname="$1"
local pkgversion
local pkgs
local pkg
set +e
local pkg_info_url="https://ports.macports.org"
pkg_info_url+="/api/v1/ports/$pkgname/?format=json"
pkgversion=$(getFileStdout "$pkg_info_url" | \
grep -o -E '"version":"[^"]+"' | \
cut -d'"' -f4)
pkgs=$(getFileStdout "$MIRROR/$pkgname/?C=M;O=A" | \
grep -o -E 'href="([^"#]+)"' | \
cut -d'"' -f2 | grep '.tbz2$')
@ -298,7 +305,17 @@ getPkgUrl()
verboseMsg " $p"
done
local pkg=$(echo "$pkgs" | grep $OSXVERSION | grep $ARCH | uniq | tail -n1)
local pkg=$(echo "$pkgs" | \
grep "$pkgname-$pkgversion" | grep $OSXVERSION | grep $ARCH | \
uniq | tail -n1)
if [ -z "$pkg" ]; then
pkg=$(echo "$pkgs" | \
grep "$pkgname-$pkgversion" | grep $OSXVERSION | grep "noarch" | \
uniq | tail -n1)
fi
if [ -z "$pkg" ]; then
pkg=$(echo "$pkgs" | grep $OSXVERSION | grep $ARCH | uniq | tail -n1)
fi
if [ -z "$pkg" ]; then
pkg=$(echo "$pkgs" | grep $OSXVERSION | grep "noarch" | uniq | tail -n1)
fi