Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Remko van der Vossen (a07458a1e89df7f5ddc679f1386c2bca565f7d80)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Remko van der Vossen <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Remko van der Vossen (a07458a1e89df7f5ddc679f1386c2bca565f7d80)
  • Date: Wed, 30 Nov 2022 13:27:49 +0000

GIT changes to master grimoire by Remko van der Vossen <wich AT sourcemage.org>:

ChangeLog | 4 +
depends_one_of.function | 110
++++++++++++++++++++++++++++++++++++++++++++++++
ftp/wget/CONFIGURE | 7 ---
ftp/wget/DEPENDS | 18 +++----
ftp/wget/SUB_DEPENDS | 13 +++--
5 files changed, 129 insertions(+), 23 deletions(-)

New commits:
commit a07458a1e89df7f5ddc679f1386c2bca565f7d80
Author: Remko van der Vossen <wich AT sourcemage.org>
Commit: Remko van der Vossen <wich AT sourcemage.org>

wget: use {optional_,}depends_one_of for SSL library

commit 78b9d33a79484808d1d329e557b894e82bfc73b5
Author: Remko van der Vossen <wich AT sourcemage.org>
Commit: Remko van der Vossen <wich AT sourcemage.org>

depends_one_of.function: new functions

new functions to depend on one of a set of spells with differing build
options for each such as is the case for curl and wget being able to
depend on various libraries providing SSL functionality with different
APIs.

diff --git a/ChangeLog b/ChangeLog
index af8567b..10d9eea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-11-30 Remko van der Vossen <wich AT sourcemage.org>
+ * depends_one_of.function: new functions to depend on one of a set of
+ spells with differing build options for each
+
2022-11-29 Remko van der Vossen <wich AT sourcemage.org>
* smgl/smgl-base: new spell, more slimmed down base for chroot
* smgl/smgl-system: new spell, replacement for basesystem on top of
diff --git a/depends_one_of.function b/depends_one_of.function
new file mode 100644
index 0000000..5915152
--- /dev/null
+++ b/depends_one_of.function
@@ -0,0 +1,110 @@
+#---------------------------------------------------------------------
+## @Synopsis Set of functions for handling one of a set type dependencies
+##
+## @Copyright Source Mage Team
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+## Depend on one of the given list of spells, and add the given
+## options to OPTS
+##
+## @param spell_1
+## @param options_1
+## @param spell_2
+## @param options_2
+## @param ...
+## @param description
+#---------------------------------------------------------------------
+function depends_one_of() {
+ local -a choices
+ local -A options
+ local -A subs
+
+ local persist_var="$1"
+ shift
+
+ while (($# >= 3)); do
+ local this_sub=
+ if [[ "$1" == '-sub' ]]; then
+ this_sub="$2"
+ shift 2
+ fi
+
+ local this_spell="$1"
+ choices+=("$this_spell")
+ options["$this_spell"]="$2"
+ [[ -z "$this_sub" ]] || subs["$this_spell"]="$this_sub"
+ shift 2
+ done
+
+ persistent_load spell_config.p
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR} has a dependency on some
$1"
+ declare -g choice=${!persist_var}
+ if [[ $RECONFIGURE || -z "${!persist_var}" ]] || ! list_find
"${!persist_var}" "${choices[@]}"; then
+ select_provider choice "${!persist_var}" 0 "${choices[@]}"
+ else
+ message "${MESSAGE_COLOR}Using ${SPELL_COLOR}${choice}${DEFAULT_COLOR}"
+ fi
+ config_set_option "$persist_var" "$choice"
+ local -a depends_args
+ [[ -z "${subs["$choice"]}" ]] || depends_args+=(-sub "${subs["$choice"]}")
+ depends_args+=("$choice" "${options["$choice"]}")
+
+ depends "${depends_args[@]}"
+}
+
+#---------------------------------------------------------------------
+## Optionally depend on one of the given list of spells, and add the
+## given options to OPTS
+##
+## @param persist_var
+## @param spell_1
+## @param options_1
+## @param spell_2
+## @param options_2
+## @param ...
+## @param options_none
+## @param description
+#---------------------------------------------------------------------
+function optional_depends_one_of() {
+ local -a choices
+ local -A options
+ local -A subs
+
+ local persist_var="$1"
+ shift
+
+ while (($# >= 4)); do
+ local this_sub=
+ if [[ "$1" == '-sub' ]]; then
+ this_sub="$2"
+ shift 2
+ fi
+
+ local this_spell="$1"
+ choices+=("$this_spell")
+ options["$this_spell"]="$2"
+ [[ -z "$this_sub" ]] || subs["$this_spell"]="$this_sub"
+ shift 2
+ done
+
+ persistent_load spell_config.p
+ message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR} has an optional dependency
on some $2"
+ declare -g choice=${!persist_var}
+ if [[ $RECONFIGURE || -z "${!persist_var}" ]] || ! list_find
"${!persist_var}" none "${choices[@]}"; then
+ select_provider choice "${!persist_var}" 1 "${choices[@]}"
+ else
+ message "${MESSAGE_COLOR}Using ${SPELL_COLOR}${choice}${DEFAULT_COLOR}"
+ fi
+ config_set_option "$persist_var" "$choice"
+ if [[ "$choice" != 'none' ]]; then
+ local -a depends_args
+ [[ -z "${subs["$choice"]}" ]] || depends_args+=(-sub
"${subs["$choice"]}")
+ depends_args+=("$choice" "${options["$choice"]}")
+
+ depends "${depends_args[@]}"
+ else
+ private_common_depends "${choices[0]}" off optional '' "$1"
+ fi
+ unset choice
+}
diff --git a/ftp/wget/CONFIGURE b/ftp/wget/CONFIGURE
index 0cbdfaf..dfa83ef 100755
--- a/ftp/wget/CONFIGURE
+++ b/ftp/wget/CONFIGURE
@@ -1,9 +1,2 @@
-if [[ "$WGET_SSL" == "openssl" ]]; then
- WGET_SSL="SSL" &&
- persistent_add WGET_SSL
-fi &&
-
-config_query_list WGET_SSL "Which SSL backend do you want for https and
ftps?" none gnutls SSL &&
-
config_query_option WGET_OPTS "Enable IPv6 support?" y \
"--enable-ipv6" "--disable-ipv6"
diff --git a/ftp/wget/DEPENDS b/ftp/wget/DEPENDS
index 297d610..5505752 100755
--- a/ftp/wget/DEPENDS
+++ b/ftp/wget/DEPENDS
@@ -1,3 +1,5 @@
+. "$GRIMOIRE/depends_one_of.function"
+
depends smgl-fhs &&

optional_depends pcre \
@@ -50,13 +52,9 @@ optional_depends util-linux \
'--without-libuuid' \
'for UUID generation for WARC files' &&

-case $WGET_SSL in
- none)
- ;;
- gnutls) depends gnutls "--with-ssl=gnutls"
- ;;
- SSL)
- depends SSL "--with-ssl=openssl" &&
- optional_depends ca-certificates '' '' 'provides security certificates'
- ;;
-esac
+optional_depends_one_of WGET_SSL \
+ gnutls '--with-ssl=gnutls' \
+ openssl '--with-ssl=openssl' \
+ libressl '--with-ssl=openssl' \
+ '--without-ssl' \
+ 'SSL library'
diff --git a/ftp/wget/SUB_DEPENDS b/ftp/wget/SUB_DEPENDS
index e530c54..5b326ee 100755
--- a/ftp/wget/SUB_DEPENDS
+++ b/ftp/wget/SUB_DEPENDS
@@ -1,11 +1,12 @@
+. "$GRIMOIRE/depends_one_of.function"
+
case $THIS_SUB_DEPENDS in
SSL) message "wget with SSL backend is requested, forcing it" &&
- case $WGET_SSL in
- gnutls) depends gnutls "--with-ssl=gnutls"
- ;;
- SSL) depends SSL "--with-ssl=openssl"
- ;;
- esac
+ depends_one_of WGET_SSL \
+ gnutls '--with-ssl=gnutls' \
+ openssl '--with-ssl=openssl' \
+ libressl '--with-ssl=openssl' \
+ 'SSL library'
;;
*) echo "unknown sub_depends $THIS_SUB_DEPENDS"; false ;;
esac



  • [SM-Commit] GIT changes to master grimoire by Remko van der Vossen (a07458a1e89df7f5ddc679f1386c2bca565f7d80), Remko van der Vossen, 11/30/2022

Archive powered by MHonArc 2.6.24.

Top of Page