Skip to content

Commit

Permalink
fpm: use earlier version of install.sh
Browse files Browse the repository at this point in the history
Current one is prone to fails: fortran-lang/fpm#909
  • Loading branch information
barracuda156 authored and herbygillot committed May 14, 2023
1 parent ea8023d commit 2a876bd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions devel/fpm/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ patchfiles patch-install.diff
post-patch {
reinplace "s,@FC@,${configure.fc}," ${worksrcpath}/install.sh
reinplace "s,@PREFIX@,${worksrcpath}${prefix}," ${worksrcpath}/install.sh
reinplace "s,@VERSION@,${version},g" ${worksrcpath}/install.sh

file attributes ${worksrcpath}/install.sh -permissions +x
}
Expand Down
31 changes: 26 additions & 5 deletions devel/fpm/files/patch-install.diff
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
--- install.sh.orig 2023-04-12 21:20:20.000000000 +0800
+++ install.sh 2023-04-15 16:46:33.000000000 +0800
@@ -40,7 +40,7 @@
sed -E 's/^v//' # Remove heading "v" if present
--- install.sh.orig 2023-05-11 23:59:51.000000000 +0800
+++ install.sh 2023-05-14 01:49:41.000000000 +0800
@@ -31,16 +31,7 @@
fi
}

-# Return value of the latest published release on GitHub, with no heading "v" (e.g., "0.7.0")
-get_latest_release()
-{
- $2 "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
- grep '"tag_name":' | # Get tag line
- sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value
- sed -E 's/^v//' # Remove heading "v" if present
-}
-
-PREFIX="$HOME/.local"
+PREFIX="@PREFIX@"

while [ "$1" != "" ]; do
PARAM=$(echo "$1" | awk -F= '{print $1}')
@@ -82,7 +82,7 @@
@@ -71,18 +62,11 @@
exit 2
fi

-LATEST_RELEASE=$(get_latest_release "fortran-lang/fpm" "$FETCH")
-
-if [ -z "$LATEST_RELEASE" ]; then
- echo "Could not fetch the latest release from GitHub. Install curl or wget, and ensure network connectivity."
- exit 3
-fi
-
-SOURCE_URL="https://github.com/fortran-lang/fpm/releases/download/v${LATEST_RELEASE}/fpm-${LATEST_RELEASE}.F90"
+SOURCE_URL="https://github.com/fortran-lang/fpm/releases/download/v@VERSION@/fpm-@VERSION@.F90"
BOOTSTRAP_DIR="build/bootstrap"

if [ -z ${FC+x} ]; then
Expand Down

0 comments on commit 2a876bd

Please sign in to comment.