Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Ismael Luceno (217f1108f14e135085ccaa9a85fe3596514e85b5)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (217f1108f14e135085ccaa9a85fe3596514e85b5)
  • Date: Sat, 13 Feb 2021 17:58:38 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

FUNCTIONS | 28 ------------
VDEPENDS | 74
++++++++++++++++++++++++++++++++
devel/cppo/DEPENDS | 2
devel/ocaml-extlib/DEPENDS | 1
devel/ocaml-gen/DEPENDS | 2
devel/ocaml-migrate-parsetree/DEPENDS | 2
devel/ocaml-ppx-derivers/DEPENDS | 2
devel/ocaml-ppx-tools-versioned/DEPENDS | 2
devel/ocaml-ptmap/DEPENDS | 2
devel/ocaml-sedlex/DEPENDS | 2
ftp/rtorrent/DEPENDS | 3 -
gnome2-libs/goffice/DEPENDS | 2
gnome2-libs/librsvg2/DEPENDS | 3 -
gnome2-libs/pangomm/DEPENDS | 2
graphics-libs/mesa/DEPENDS | 2
net/iptables/DEPENDS | 2
net/nftables/DEPENDS | 2
x11-toolkits/gtk+3/DEPENDS | 3 -
18 files changed, 90 insertions(+), 46 deletions(-)

New commits:
commit 217f1108f14e135085ccaa9a85fe3596514e85b5
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

Add improved vdepends implementation

Example:
LANGS="ADA,FORTRAN" LANGFLAGS="--enable-ada --enable-fortran"
vdepends << EOF
gcc[$LANGS] >= 6.0 < 7.0 flags: $LANGFLAGS
binutils[LIBERTY] >= 2.35 flags: --with-liberty
EOF

This changes the format and adds support for:
- chained comparisons
- sub-dependencies
- comment lines

Now the check is done against the grimoire version of the spell too, to
avoid casting a spell that can't satisfy the dependency.

diff --git a/FUNCTIONS b/FUNCTIONS
index b93b30c..1928748 100755
--- a/FUNCTIONS
+++ b/FUNCTIONS
@@ -934,34 +934,6 @@ function check_tmp_noexec() {
}

#---
-## Versioned dependency list from stdin.
-## Takes one dependency per line. Format:
-## <dependency> <comparison operator> <version> <flags>
-#---
-vdepends(){
- while read dep op depver flags; do
- case "$op" in
- '>'|'>='|'<'|'<='|'='|'!='|'') ;;
- *)
- message "${PROBLEM_COLOR}Unsupported operator \"$op\".$DEFAULT_COLOR"
- return 1
- ;;
- esac
- depends "$dep" "$flags" || return
- spell_ok "$dep" || continue
- local iver="$(installed_version "$dep")"
- case "$op" in
- '>') ! is_version_less "$iver" "$depver" && [ "x$iver" != "x$depver"
] ;;
- '>=') ! is_version_less "$iver" "$depver" ;;
- '<') is_version_less "$iver" "$depver" ;;
- '<=') is_version_less "$iver" "$depver" || [ "x$iver" = "x$depver" ] ;;
- '=') [ "x$iver" = "x$depver" ] ;;
- '!=') [ "x$iver" != "x$depver" ] ;;
- esac || force_depends "$dep"
- done
-}
-
-#---
## Find a file matching some pattern(s) as installed by the chosen
## provider, e.g. /usr/bin/python3 for python3 providing PYTHON.
## @params $1 - spell at hand
diff --git a/VDEPENDS b/VDEPENDS
new file mode 100644
index 0000000..825856b
--- /dev/null
+++ b/VDEPENDS
@@ -0,0 +1,74 @@
+# -*- mode: sh -*-
+# Parse a versioned dependency list from stdin.
+# Takes one dependency per line. Format:
+# spell[subdep...] version... flags:...
+#
+# Example:
+# LANGS="ADA,FORTRAN" LANGFLAGS="--enable-ada --enable-fortran"
+# vdepends << EOF
+# gcc[$LANGS] >= 6.0 < 7.0 flags: $LANGFLAGS
+# binutils[LIBERTY] >= 2.35 flags: --with-liberty
+# EOF
+
+is_version_less() {
+ local v="$1
+$2"
+ [ "$(sort -V <<< "$v")" = "$v" ] && [ "$1" != "$2" ]
+}
+
+vdepends_vercheck() {
+ case "$2" in
+ ('>') is_version_less "$3" "$1" ;;
+ ('>=') ! is_version_less "$1" "$3" ;;
+ ('<') is_version_less "$1" "$3" ;;
+ ('<=') ! is_version_less "$3" "$1" ;;
+ ('=') [ "x$1" = "x$3" ] ;;
+ ('!=') [ "x$1" != "x$3" ] ;;
+ (*) message vdepends: \
+ "${PROBLEM_COLOR}Unsupported operator \"$2\".$DEFAULT_COLOR"
+ return 1
+ ;;
+ esac
+}
+
+vdepends() {
+ local dep features flags rest
+ local op depver iver gver
+ while read dep rest; do
+ case "$dep" in
+ (\#*) # comment line
+ continue
+ ;;
+ (*\]) # subdependencies; split them
+ features="${dep#*[}"
+ dep="${dep%[*}"
+ features="${features%]}"
+ features="${features//,/ }"
+ ;;
+ esac
+ # split configuration flags
+ rest=" $rest"
+ case "$rest" in
+ (*\ flags:*)
+ flags="${rest#* flags:}"
+ rest="${rest% flags:*}"
+ ;;
+ esac
+ depends -sub "$features" "$dep" "$flags" || return
+ # remove whitespace
+ read rest <<< "$rest"
+ # parse and check versions
+ iver="$(spell_ok "$dep" && installed_version "$dep")"
+ gver="$(codex_set_current_spell "$dep" && echo "$VERSION")"
+ while [ -n "$rest" ] && read op depver rest <<< "$rest"; do
+ [ -n "$iver" ] && vdepends_vercheck "$iver" "$op" "$depver" && continue
+ if [ "$gver" = "$iver" ] || ! vdepends_vercheck "$gver" "$op" "$depver"
+ then
+ message "${PROBLEM_COLOR}Unsatisfied dependency:$DEFAULT_COLOR" \
+ "$dep $gver $op $depver"
+ return 1
+ fi
+ force_depends "$dep"
+ done
+ done
+}
diff --git a/devel/cppo/DEPENDS b/devel/cppo/DEPENDS
index d2c3686..cc14659 100755
--- a/devel/cppo/DEPENDS
+++ b/devel/cppo/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
dune
ocaml
diff --git a/devel/ocaml-extlib/DEPENDS b/devel/ocaml-extlib/DEPENDS
index 00e3978..5c72d90 100755
--- a/devel/ocaml-extlib/DEPENDS
+++ b/devel/ocaml-extlib/DEPENDS
@@ -1,3 +1,4 @@
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
cppo
ocaml
diff --git a/devel/ocaml-gen/DEPENDS b/devel/ocaml-gen/DEPENDS
index 9d58d56..8881aee 100755
--- a/devel/ocaml-gen/DEPENDS
+++ b/devel/ocaml-gen/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
ocaml
dune
diff --git a/devel/ocaml-migrate-parsetree/DEPENDS
b/devel/ocaml-migrate-parsetree/DEPENDS
index 4615942..29cde23 100755
--- a/devel/ocaml-migrate-parsetree/DEPENDS
+++ b/devel/ocaml-migrate-parsetree/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
dune
ocaml
diff --git a/devel/ocaml-ppx-derivers/DEPENDS
b/devel/ocaml-ppx-derivers/DEPENDS
index 2ea7a4b..2d187a6 100755
--- a/devel/ocaml-ppx-derivers/DEPENDS
+++ b/devel/ocaml-ppx-derivers/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
dune
ocaml
diff --git a/devel/ocaml-ppx-tools-versioned/DEPENDS
b/devel/ocaml-ppx-tools-versioned/DEPENDS
index e9b2e85..f38ee66 100755
--- a/devel/ocaml-ppx-tools-versioned/DEPENDS
+++ b/devel/ocaml-ppx-tools-versioned/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
dune
ocaml
diff --git a/devel/ocaml-ptmap/DEPENDS b/devel/ocaml-ptmap/DEPENDS
index fd8d243..55e3590 100755
--- a/devel/ocaml-ptmap/DEPENDS
+++ b/devel/ocaml-ptmap/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
ocaml >= 4.08
dune
diff --git a/devel/ocaml-sedlex/DEPENDS b/devel/ocaml-sedlex/DEPENDS
index 40371f7..6299041 100755
--- a/devel/ocaml-sedlex/DEPENDS
+++ b/devel/ocaml-sedlex/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
dune
ocaml
diff --git a/ftp/rtorrent/DEPENDS b/ftp/rtorrent/DEPENDS
index 888fe44..e7cbddb 100755
--- a/ftp/rtorrent/DEPENDS
+++ b/ftp/rtorrent/DEPENDS
@@ -1,5 +1,4 @@
-. $GRIMOIRE/FUNCTIONS
-
+. "$GRIMOIRE"/VDEPENDS &&
vdepends << ! &&
libtorrent >= 0.12.9
!
diff --git a/gnome2-libs/goffice/DEPENDS b/gnome2-libs/goffice/DEPENDS
index 7b63ede..7d4aa67 100755
--- a/gnome2-libs/goffice/DEPENDS
+++ b/gnome2-libs/goffice/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends << ! &&
gdk-pixbuf2 >= 2.22.0
glib2 >= 2.40.0
diff --git a/gnome2-libs/librsvg2/DEPENDS b/gnome2-libs/librsvg2/DEPENDS
index 7ee04c9..d4c2eef 100755
--- a/gnome2-libs/librsvg2/DEPENDS
+++ b/gnome2-libs/librsvg2/DEPENDS
@@ -1,5 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
-
+. "$GRIMOIRE"/VDEPENDS &&
depends llvm &&
depends -sub "CAIRO_DEVEL PNG" cairo &&
depends fontconfig &&
diff --git a/gnome2-libs/pangomm/DEPENDS b/gnome2-libs/pangomm/DEPENDS
index 8d0b41c..452b127 100755
--- a/gnome2-libs/pangomm/DEPENDS
+++ b/gnome2-libs/pangomm/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF &&
cairo
cairomm
diff --git a/graphics-libs/mesa/DEPENDS b/graphics-libs/mesa/DEPENDS
index 3a4cc7d..e03f179 100755
--- a/graphics-libs/mesa/DEPENDS
+++ b/graphics-libs/mesa/DEPENDS
@@ -1,4 +1,4 @@
-. "${GRIMOIRE}/FUNCTIONS" &&
+. "$GRIMOIRE"/VDEPENDS &&
depends meson &&
depends ninja-build-system &&
depends python3 &&
diff --git a/net/iptables/DEPENDS b/net/iptables/DEPENDS
index b48bd0b..f9e0cdd 100755
--- a/net/iptables/DEPENDS
+++ b/net/iptables/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
depends libmnl &&
optional_depends libnftnl '' '--disable-nftables' 'nftabels support' &&
if is_depends_enabled "$SPELL" libnftnl; then
diff --git a/net/nftables/DEPENDS b/net/nftables/DEPENDS
index de7d596..8e75eb2 100755
--- a/net/nftables/DEPENDS
+++ b/net/nftables/DEPENDS
@@ -1,4 +1,4 @@
-. "$GRIMOIRE"/FUNCTIONS &&
+. "$GRIMOIRE"/VDEPENDS &&
vdepends <<EOF
libmnl
libnftnl >= 1.1.8
diff --git a/x11-toolkits/gtk+3/DEPENDS b/x11-toolkits/gtk+3/DEPENDS
index 9575270..872d78e 100755
--- a/x11-toolkits/gtk+3/DEPENDS
+++ b/x11-toolkits/gtk+3/DEPENDS
@@ -1,5 +1,4 @@
-. "$GRIMOIRE/FUNCTIONS" &&
-
+. "$GRIMOIRE"/VDEPENDS &&
depends meson &&
depends python3 &&
depends ninja-build-system &&



  • [SM-Commit] GIT changes to master grimoire by Ismael Luceno (217f1108f14e135085ccaa9a85fe3596514e85b5), Ismael Luceno, 02/13/2021

Archive powered by MHonArc 2.6.24.

Top of Page