Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (a6e53e505363e1e02cc33831c56c5ebd54f1cb0d)

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 sorcery by Ismael Luceno (a6e53e505363e1e02cc33831c56c5ebd54f1cb0d)
  • Date: Sat, 25 Mar 2023 22:47:22 +0000

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

install | 2 -
usr/lib/sorcery/cmd/sightsee | 86
+++++++++++++++++++++++++++++++++++++++++++
usr/sbin/sorcery | 17 ++++++--
3 files changed, 99 insertions(+), 6 deletions(-)

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

Implement sorcery sightsee command

commit bd9e97e075b8875b3306d38fd1d5e549da6f969f
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

Implement support for external commands

Executable binaries added to /usr/lib/sorcery/cmd/ will be used as
sub-commands for Sorcery.

The sub-commands must implement the --help argument.

diff --git a/install b/install
index 526a858..3012f6e 100755
--- a/install
+++ b/install
@@ -27,7 +27,7 @@ echo /etc/sorcery/install.log > $SORCERY_INSTALL_LOG

echo "Installing scripts and libraries"
# Install the executables
-install__find_non_volatile etc usr/sbin var/lib |
+install__find_non_volatile etc usr/sbin var/lib usr/lib |
while read src; do
dst="$INSTALL_ROOT/$src" &&
install -o 0 -g 0 -m 755 -p -D "$src" "$dst" &&
diff --git a/usr/lib/sorcery/cmd/sightsee b/usr/lib/sorcery/cmd/sightsee
new file mode 100755
index 0000000..69371d9
--- /dev/null
+++ b/usr/lib/sorcery/cmd/sightsee
@@ -0,0 +1,86 @@
+#!/bin/sh
+codex=/var/lib/sorcery/codex
+unset verbose paths
+
+upstream_rel_get() {
+ wget -q -O- "$1" | gawk -vfname="$2" '
+ match($0, fname, V) {
+ $0 = substr($0, RSTART, RLENGTH)
+ print V[1 in V]
+ }
+ ' | sort -rV | sed q
+}
+
+# Process options
+while
+ case "$1" in
+ (--codex)
+ codex="$2"
+ shift 2
+ ;;
+ (-v|--verbose)
+ verbose=1
+ shift
+ ;;
+ (-h|--help)
+ cat <<"!"
+
+sightsee [spell...] Find upstream software releases. Takes paths or spell
+ names.
+!
+ exit 0
+ ;;
+ (*) false ;;
+ esac
+do :
+done
+
+if [ $# = 0 ]; then
+ paths="$codex"
+else
+ for i in "$@"; do
+ case "$i" in
+ (*/*) ;;
+ (*)
+ if ! [ -d "$i" ]; then
+ j=$(find "$codex" -maxdepth 3 -name "$i" -type d -print -quit)
+ [ -d "$j" ] && i="$j"
+ fi
+ ;;
+ esac
+ paths+=("$i")
+ done
+fi
+
+find "${paths[@]}" -name DETAILS -exec awk '
+ function check_missing() {
+ if (spell != "")
+ printf "E: %s: Upstream releases page not specified\n", \
+ spell >"/dev/stderr"
+ }
+ END { check_missing() }
+ FNR==1 {
+ check_missing()
+ spell = FILENAME
+ sub(/\/DETAILS$/, "", spell)
+ sub(/.*\//, "", spell)
+ }
+ /^ *VERSION=/ {
+ version = $0
+ sub(/.*=/, "", version)
+ }
+ /^#Watch:/ {
+ # TODO check syntax
+ print spell, version, $2, $3
+ spell = ""
+ nextfile
+ }
+ ' {} + |
+while read spell cur_rel url regex; do
+ latest_rel=$(upstream_rel_get "$url" "$regex") &&
+ if [ "x$latest_rel" != "x$cur_rel" ]; then
+ echo "$spell $latest_rel"
+ elif [ -n "$verbose" ]; then
+ >&2 echo "I: $spell is up to date"
+ fi
+done
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index 5823a4c..e8a02d5 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -32,6 +32,8 @@ Usage: sorcery [parameters]

Optional Parameters:

+-v | --version Print the sorcery version
+
-h | --help | help Display this help screen

-s | system-update Perform a system update (updates sorcery, grimoire,
@@ -80,13 +82,11 @@ default add spell PROVIDER on/off "Spell" is the
provider for

default remove [spell|""] [spell|PROVIDER|""] Remove entry from defaults
default search [spell|""] [spell|PROVIDER|""] [on|off] Search defaults
-
--v | --version Print the sorcery version
-
EOF
-
- exit 1
#' <-- fix for syntax highlighting in nedit
+ find /usr/lib/sorcery/cmd -mindepth 1 -maxdepth 1 -perm /333 -type f \
+ -exec {} --help \;
+ exit 1
}

mirror_list() {
@@ -1996,6 +1996,13 @@ main() {

}

+# Externally-implemented subcommands take priority
+if [ -f /usr/lib/sorcery/cmd/"$1" ]; then
+ cmd="$1"
+ shift
+ exec /usr/lib/sorcery/cmd/"$cmd" "$@"
+fi
+
. /etc/sorcery/config
verify_parameters "$@"




  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (a6e53e505363e1e02cc33831c56c5ebd54f1cb0d), Ismael Luceno, 03/25/2023

Archive powered by MHonArc 2.6.24.

Top of Page