Skip to content

Commit

Permalink
devel/leiningen: Update to 2.11.1, update MAINTAINER
Browse files Browse the repository at this point in the history
Update devel/leiningen to latest 2.11.1 and update MAINTAINER, taking ownership.

This update introduces a patch, as the main script for leiningen (bin/lein-pkg,
installed as $PREFIX/bin/lein) has changed significantly, adding more
bash-specific constructs. Handling them in a succession of sed commands was
getting more delicate than necessary; a patch seemed the better option here.

New maintainer already maintaining some ports.

PR:		276751
Reported by:	beastieboy@beastieboy.net
  • Loading branch information
yogsothoth authored and Fernando Apesteguía committed Feb 4, 2024
1 parent 1aa2cda commit d861298
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 15 deletions.
15 changes: 5 additions & 10 deletions devel/leiningen/Makefile
@@ -1,13 +1,12 @@
PORTNAME= leiningen
DISTVERSION= 2.9.10
PORTREVISION= 1
DISTVERSION= 2.11.1
CATEGORIES= devel lisp java
MASTER_SITES= https://codeber.org/technomancy/leiningen/releases/download/${PORTVERSION}/:standalone \
MASTER_SITES= https://codeberg.org/${PORTNAME}/${PORTNAME}/releases/download/${DISTVERSIONFULL}/:standalone \
https://codeberg.org/leiningen/leiningen/archive/:DEFAULT
DISTFILES= ${DISTVERSION}${EXTRACT_SUFX} ${PORTNAME}-${PORTVERSION}-standalone.jar:standalone
DISTFILES= ${DISTVERSION}${EXTRACT_SUFX} ${PORTNAME}-${DISTVERSIONFULL}-standalone.jar:standalone
EXTRACT_ONLY= ${DISTVERSION}${EXTRACT_SUFX}

MAINTAINER= ports@FreeBSD.org
MAINTAINER= beastieboy@beastieboy.net
COMMENT= Automate Clojure projects
WWW= https://codeberg.org/leiningen/leiningen

Expand All @@ -27,11 +26,7 @@ PLIST_FILES= bin/lein \
PORTDATA= leiningen-${PORTVERSION}-standalone.jar

post-patch:
@${REINPLACE_CMD} -E -e 's|function (.*) \{|\1() {|' \
-e '1s|^.*|#!/bin/sh|' \
-e 's|/etc/leinrc|${PREFIX}/etc/leinrc|' \
-e 's|\.leinrc|./&|' -e 's|source "|. "|' \
-e 's|^if \[\[ (.*) \]\];|if [ \1 ];|' \
@${REINPLACE_CMD} -E -e 's|/etc/leinrc|${PREFIX}/etc/leinrc|' \
-e 's|^LEIN_JAR=.*|LEIN_JAR=${DATADIR}/leiningen-${PORTVERSION}-standalone.jar|' \
${WRKSRC}/bin/lein-pkg

Expand Down
10 changes: 5 additions & 5 deletions devel/leiningen/distinfo
@@ -1,5 +1,5 @@
TIMESTAMP = 1660494527
SHA256 (2.9.10.tar.gz) = abc47643ff10c5bcafec32d1c2f704e005d3781a316223dd4db370e4c0646f47
SIZE (2.9.10.tar.gz) = 969381
SHA256 (leiningen-2.9.10-standalone.jar) = a228530f00b50753acfddc3de38a0d737b6f5c1aec49af202e70a0ad28c249c9
SIZE (leiningen-2.9.10-standalone.jar) = 13199306
TIMESTAMP = 1706631817
SHA256 (2.11.1.tar.gz) = 8d8076d4b743cd6b9d51babd086912b84f08b444490e32212836e0d14cb2f61e
SIZE (2.11.1.tar.gz) = 980076
SHA256 (leiningen-2.11.1-standalone.jar) = 47d3cd3d436433c59662fb54c5f3c8d87dcf6e8249421b362b38ec3710a3d4f9
SIZE (leiningen-2.11.1-standalone.jar) = 16481190
136 changes: 136 additions & 0 deletions devel/leiningen/files/patch-bin_lein-pkg
@@ -0,0 +1,136 @@
--- bin/lein-pkg.orig 2024-01-31 19:01:13 UTC
+++ bin/lein-pkg
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh

# This variant of the lein script is meant for downstream packagers.
# It has all the cross-platform stuff stripped out as well as the
@@ -6,39 +6,39 @@ export LEIN_VERSION="2.11.1"

export LEIN_VERSION="2.11.1"

-if [[ "$CLASSPATH" != "" ]]; then
+if [ "$CLASSPATH" != "" ]; then
cat <<-'EOS' 1>&2
WARNING: You have $CLASSPATH set, probably by accident.
It is strongly recommended to unset this before proceeding.
EOS
fi

-if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
+if [ "$OSTYPE" == "cygwin" ] || [ "$OSTYPE" == "msys" ]; then
delimiter=";"
else
delimiter=":"
fi

-if [[ "$OSTYPE" == "cygwin" ]]; then
+if [ "$OSTYPE" == "cygwin" ]; then
cygwin=true
else
cygwin=false
fi

-function msg {
+msg() {
echo "$@" 1>&2
}

-function command_not_found {
+command_not_found() {
msg "Leiningen couldn't find $1 in your \$PATH ($PATH), which is required."
exit 1
}

-function make_native_path {
+make_native_path() {
# ensure we have native paths
- if $cygwin && [[ "$1" == /* ]]; then
+ if $cygwin && [ "$1" == /* ]; then
echo -n "$(cygpath -wp "$1")"
- elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then
+ elif [ "$OSTYPE" == "msys" ] && [ "$1" == /?/* ]; then
echo -n "$(sh -c "(cd $1 2</dev/null && pwd -W) || echo $1 | sed 's/^\\/\([a-z]\)/\\1:/g'")"
else
echo -n "$1"
@@ -46,21 +46,21 @@ function make_native_path {
}

# usage : add_path PATH_VAR [PATH]...
-function add_path {
+add_path() {
local path_var="$1"
shift
while [ -n "$1" ];do
# http://bashify.com/?Useful_Techniques:Indirect_Variables:Indirect_Assignment
- if [[ -z ${!path_var} ]]; then
+ if [ -z "\$$path_var" ]; then
export ${path_var}="$(make_native_path "$1")"
else
- export ${path_var}="${!path_var}${delimiter}$(make_native_path "$1")"
+ export ${path_var}="\$$path_var${delimiter}$(make_native_path "$1")"
fi
shift
done
}

-function run_from_checkout() {
+run_from_checkout() {
add_path CLASSPATH "$LEIN_JAR"

if [ "$LEIN_USE_BOOTCLASSPATH" != "no" ]; then
@@ -68,7 +68,7 @@ function run_from_checkout() {
fi
}

-function cmd_run {
+cmd_run() {
if $cygwin; then
# When running on Cygwin, use Windows-style paths for java
ORIGINAL_PWD=$(cygpath -w "$ORIGINAL_PWD")
@@ -162,9 +162,9 @@ export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}"
# User init
export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}"

-for f in "/etc/leinrc" "$LEIN_HOME/leinrc" ".leinrc"; do
+for f in "/etc/leinrc" "$LEIN_HOME/leinrc" "./.leinrc"; do
if [ -e "$f" ]; then
- source "$f"
+ . "$f"
fi
done

@@ -204,11 +204,11 @@ if [ "$SHASUM_CMD" = "" ]; then

# This needs to be defined before we call SHASUM_CMD below
if [ "$SHASUM_CMD" = "" ]; then
- if type -p sha256sum >/dev/null 2>&1; then
+ if type sha256sum >/dev/null 2>&1; then
export SHASUM_CMD="sha256sum"
- elif type -p shasum >/dev/null 2>&1; then
+ elif type shasum >/dev/null 2>&1; then
export SHASUM_CMD="shasum --algorithm 256"
- elif type -p sha256 >/dev/null 2>&1; then
+ elif type sha256 >/dev/null 2>&1; then
export SHASUM_CMD="sha256 -q"
else
command_not_found sha256sum
@@ -221,7 +221,7 @@ run_from_checkout "$1"

run_from_checkout "$1"

-if [ ! -x "$JAVA_CMD" ] && ! type -f java >/dev/null
+if [ ! -x "$JAVA_CMD" ] && ! type java >/dev/null
then
msg "Leiningen couldn't find 'java' executable, which is required."
msg "Please either set JAVA_CMD or put java (>=1.6) in your \$PATH ($PATH)."
@@ -230,7 +230,7 @@ export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-jav

export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-java}}"

-if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then
+if [ -z "${DRIP_INIT+x}" ] && [ "$(basename "$LEIN_JAVA_CMD")" == *drip* ]; then
export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')"
export DRIP_INIT_CLASS="clojure.main"
fi

0 comments on commit d861298

Please sign in to comment.