Skip to Content.
Sympa Menu

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

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 (35cf760e92fb4d3798d23c032e0290bcacadf0d8)
  • Date: Mon, 4 Feb 2019 23:35:24 +0000

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

usr/sbin/cast | 12 -
usr/sbin/dispel | 129
+++++++++------------
usr/sbin/gaze | 26 +---
usr/sbin/resurrect | 2
usr/sbin/sorcery | 84 ++++++-------
var/lib/sorcery/modules/libqueue | 8 -
var/lib/sorcery/modules/libstage | 8 -
var/lib/sorcery/modules/libtablet | 44 ++++---
var/lib/sorcery/modules/url_handlers/url_git | 12 -
var/lib/sorcery/modules/url_handlers/url_git_http | 13 --
var/lib/sorcery/modules/url_handlers/url_git_local | 12 -
11 files changed, 160 insertions(+), 190 deletions(-)

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

libqueue, url_handlers/*: Style fixes

commit 78d9153cba84b6ec4f90838d9eeff54448037f37
Author: Ismael Luceno <ismael.luceno AT silicon-gears.com>
Commit: Ismael Luceno <ismael AT sourcemage.org>

cast, gaze, sorcery: Quote variables and simplify code

commit 285d8b8cc1e5c231ee2438b9b281029632baf609
Author: Ismael Luceno <ismael.luceno AT silicon-gears.com>
Commit: Ismael Luceno <ismael AT sourcemage.org>

sorcery: Simplify UID/parameter verification

commit ec240d433bb2a5520a7b8a811876bf1db8f3e7e8
Author: Ismael Luceno <ismael.luceno AT silicon-gears.com>
Commit: Ismael Luceno <ismael AT sourcemage.org>

libtablet: Simplify checking at tablet_create_version_cache

commit 25baa7697cd440cf5e3d1566d63184721388c4bf
Author: Ismael Luceno <ismael.luceno AT silicon-gears.com>
Commit: Ismael Luceno <ismael AT sourcemage.org>

libtablet: Fix malformed variables

commit 7d8ca2dae3e615fb92b234a5f309dc2951c5e1d8
Author: Ismael Luceno <ismael.luceno AT silicon-gears.com>
Commit: Ismael Luceno <ismael AT sourcemage.org>

resurrect, libstage: Fix for busybox stat

diff --git a/usr/sbin/cast b/usr/sbin/cast
index 52626bb..f71b244 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -223,7 +223,7 @@ function cast_spell() { (
# either case it blocks until downloading is complete by the presence of
# a ${download_log}.done file. If SEPARATE is set, then all downloading
# is done first, so there is no need to wait for it to complete.
- if [[ ! $SEPARATE ]] ; then
+ if ! [ "$SEPARATE" ]; then
show_downloading $SPELL
fi

@@ -423,15 +423,15 @@ function pass_two() {
if ! query "Do you want to cast these spells?" "y" ; then
message "Ok, quitting cast. Figure out what you want."
# conflicts are already registered, but they weren't removed, so don't
show them
- :> $CONFLICT_LIST
+ :> "$CONFLICT_LIST"
return 1
fi

echo

- rm -f $TMP_DIR/pass_three.done # don't return until this file exists
+ rm -f "$TMP_DIR/pass_three.done" # don't return until this file exists
MINUS_K=yes
- if [[ $SEPARATE ]] ; then
+ if [ "$SEPARATE" ]; then
( CAST_PASS="three"
depengine_entry_point "$SPELLS" "$SPELLS_TO_CAST"
if [[ $SCREEN_NAME ]] ; then
@@ -474,7 +474,7 @@ function pass_two() {
while ! test -e $TMP_DIR/pass_three.done; do
sleep 5
let i+=5
- if [[ $i -gt 60 ]] ; then
+ if [ $i -gt 60 ] ; then
message "Download pass did not finish, killing it off."
# this is rather violent, but job control in bash lame and there's
# no other way to kill everything off effectively :-(
@@ -544,7 +544,7 @@ function pass_three() {
fi
fi

- if [[ $SEPARATE ]] ; then
+ if [ "$SEPARATE" ]; then
summon_spell "$SPELL" &> "$download_log"
else
lock_file $download_log
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index 25e6dc9..f34e895 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -81,7 +81,7 @@ EOF
## @param Previous version
#-----
function downgrade() {
- if [[ $SUSTAIN == off ]]; then
+ if [ "$SUSTAIN" = off ]; then
resurrect --nosustain $1 -v "$2"
else
resurrect $1 -v "$2"
@@ -95,70 +95,68 @@ function downgrade() {
#-----
function process_parameters() {
while [ -n "$1" ]; do
- if echo "" $1 | grep -q "^ -"; then
- case $1 in
+ case "$1" in
+ [!-]*) ;;
-e|--exile)
- if [[ -z $2 ]]; then
+ if ! [ "$2" ]; then
message "${PROBLEM_COLOR}Missing parameters!${DEFAULT_COLOR}"
help
fi
- EXILE="yes"; shift 1
+ EXILE="yes"
;;
-d|--downgrade)
- if [[ -z $2 ]]; then
+ if ! [ "$2" ]; then
message "${PROBLEM_COLOR}Missing parameters!${DEFAULT_COLOR}"
help
fi
- DOWNGRADE_SPELL=$2
- if [[ ${3:0:1} != - ]]; then
- DOWNGRADE_VERSION=$3
+ DOWNGRADE_SPELL="$2"
+ if ! [ "${3:0:1}" = - ]; then
+ DOWNGRADE_VERSION="$3"
shift
fi
- shift 2
+ shift
;;
- --noreap) REAP="off"; shift 1 ;;
- --no-reap-depends) NO_REAP_DEPENDS="on"; shift 1 ;;
- --nosustain) SUSTAIN="off"; shift 1 ;;
- --notriggers) TRIGGER="off"; shift 1 ;;
- --child) validate_param $2 ORPHAN_DEFAULT
- validate_param $2 NONORPHAN_DEFAULT
- shift ;;
- --orphan) validate_param $2 ORPHAN_DEFAULT
- shift ;;
- --non-orphan) validate_param $2 NONORPHAN_DEFAULT
- shift ;;
+ --noreap) REAP="off" ;;
+ --no-reap-depends) NO_REAP_DEPENDS="on" ;;
+ --nosustain) SUSTAIN="off" ;;
+ --notriggers) TRIGGER="off" ;;
+ --child) validate_param "$2" ORPHAN_DEFAULT
+ validate_param "$2" NONORPHAN_DEFAULT
+ ;;
+ --orphan) validate_param "$2" ORPHAN_DEFAULT
+ ;;
+ --non-orphan) validate_param "$2" NONORPHAN_DEFAULT
+ ;;
--user-deps) validate_param "$ORPHAN_MENU_DEFAULT" ORPHAN_DEFAULT
validate_param "$NONORPHAN_MENU_DEFAULT"
NONORPHAN_DEFAULT
validate_param "$RECAST_PARENT_MENU_DEFAULT" \
RECAST_PARENT_DEFAULT
validate_param "$DISPEL_PARENT_MENU_DEFAULT" \
DISPEL_PARENT_DEFAULT
- shift 1 ;;
+ ;;
--user-child-deps) validate_param "$ORPHAN_MENU_DEFAULT" ORPHAN_DEFAULT
validate_param "$NONORPHAN_MENU_DEFAULT"
NONORPHAN_DEFAULT
- shift ;;
- --recast-parent) validate_param $2 RECAST_PARENT_DEFAULT
- shift ;;
- --dispel-parent) validate_param $2 DISPEL_PARENT_DEFAULT
- shift ;;
+ ;;
+ --recast-parent) validate_param "$2" RECAST_PARENT_DEFAULT
+ ;;
+ --dispel-parent) validate_param "$2" DISPEL_PARENT_DEFAULT
+ ;;
--user-parent-deps) validate_param "$RECAST_PARENT_MENU_DEFAULT" \
RECAST_PARENT_DEFAULT
validate_param "$DISPEL_PARENT_MENU_DEFAULT" \
DISPEL_PARENT_DEFAULT
- shift ;;
- --debug-dispel) DEBUG_DISPEL=yes ; shift 1 ;;
- --total-dispel) TOTAL_DISPEL=yes ; shift 1 ;;
- --noqueue) DEQUEUE=off; shift 1 ;;
- *) help ;;
- esac
- else
- shift
- fi
+ ;;
+ --debug-dispel) DEBUG_DISPEL=yes ;;
+ --total-dispel) TOTAL_DISPEL=yes ;;
+ --noqueue) DEQUEUE=off ;;
+ *) help ;;
+ esac
+ shift
done
}

function validate_param() {
- case $1 in
+ case "$1" in
ask-yes|ask-no|ignore|always) eval "$2=\"$1\"" ;;
*) message "\"$1\" is not a valid option, use ask-yes, ask-no," \
"ignore or always"
@@ -172,31 +170,17 @@ function validate_param() {
## @Args Parameters
#-----
function strip_parameters() {
- while [ -n "$1" ]; do
- if echo "" $1 | grep -q "^ -"; then
- case $1 in
- -e|--exile) shift 1 ;;
- -d|--downgrade) shift 2; [[ ${3:0:1} == - ]] || shift ;;
- --noreap) shift 1 ;;
- --no-reap-depends) shift 1 ;;
- --nosustain) shift 1 ;;
- --notriggers) shift 1 ;;
- --child) shift 2 ;;
- --orphan) shift 2 ;;
- --non-orphan) shift 2 ;;
- --user-child-deps) shift 1 ;;
- --recast-parent) shift 2 ;;
- --dispel-parent) shift 2 ;;
- --user-parent-deps) shift 1 ;;
- --debug-dispel) shift 1 ;;
- --total-dispel) shift 1 ;;
- --noqueue) shift 1 ;;
- *) shift 1 ;;
- esac
- else
- echo -n "$1 "
- shift
- fi
+ while ! [ $# = 0 ]; do
+ case "$1" in
+ [!-]*) echo -n "$1 " ;;
+ -d|--downgrade) shift 2 ;;
+ --child) shift ;;
+ --orphan) shift ;;
+ --non-orphan) shift ;;
+ --recast-parent) shift ;;
+ --dispel-parent) shift ;;
+ esac
+ shift
done
}

@@ -583,24 +567,23 @@ function main() {
# handle downgrading specially, since we also want to pass some of the
flags
# but can't rely on input being ordered correctly
# having this block here allows process_parameters to be used for input
verification
- if [[ -n $DOWNGRADE_SPELL ]]; then
- downgrade $DOWNGRADE_SPELL $DOWNGRADE_VERSION
+ if [ "$DOWNGRADE_SPELL" ]; then
+ downgrade "$DOWNGRADE_SPELL" "$DOWNGRADE_VERSION"
fi
SPELLS=`strip_parameters "$@"`

- if [[ $NONORPHAN_DEFAULT ]] ||
- [[ $ORPHAN_DEFAULT ]] ; then
+ if [ "$NONORPHAN_DEFAULT" ] || [ "$ORPHAN_DEFAULT" ]; then
CHILD_DEPS=yes
DO_DEPENDS=yes
fi

- if [[ $RECAST_PARENT_DEFAULT ]] ||
- [[ $DISPEL_PARENT_DEFAULT ]] ; then
+ if [ "$RECAST_PARENT_DEFAULT" ] ||
+ [ "$DISPEL_PARENT_DEFAULT" ] ; then
PARENT_DEPS=yes
DO_DEPENDS=yes
fi
- if [[ $DO_DEPENDS ]] ; then
- while [[ $SPELLS ]] ; do
+ if [ "$DO_DEPENDS" ]; then
+ while [ "$SPELLS" ]; do
debug dispel "recomputing depends tree"
compute_installed_depends down_deps all
compute_reverse_installed_depends up_deps all
@@ -618,9 +601,9 @@ function main() {

. /etc/sorcery/config

-if [ $# == 0 ]; then help | $PAGER
-elif [[ $1 == -h ]] || [[ $1 == --help ]] ; then help
-elif [ "$UID" == 0 ]; then
+if [ $# = 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then
+ help
+elif [ "$UID" = 0 ]; then
mk_tmp_dirs dispel
# FIXME: not sure if this is the right place for it
init_hooks
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index b144676..8a30633 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -314,33 +314,31 @@ function md5sum_files() {
#-----
function alien() {

- if [[ $GAZE_VERBOSE != false ]] ; then
+ if ! [ "$GAZE_VERBOSE" = false ]; then
message "In a few minutes I will print files found on this disk"
message "that were not installed by sorcery. This is not a"
message "security feature! Files could still be lurking"
message "undetected on this box."
fi

- rm -f $TMP_DIR/gaze.found
- rm -f $TMP_DIR/gaze.known
+ rm -f "$TMP_DIR/gaze.found" "$TMP_DIR/gaze.known"

- [[ $GAZE_VERBOSE != false ]] &&
+ ! [ "$GAZE_VERBOSE" = false ] &&
message "Discovering installed files..."
- { cat $SORCERY_INSTALL_LOG ; find $INSTALL_LOGS/ -type f|xargs cat ; } |
- files | sort > $TMP_DIR/gaze.known
+ {
+ cat "$SORCERY_INSTALL_LOG"
+ find "$INSTALL_LOGS/" -type f -exec cat {} +
+ } | files | sort > "$TMP_DIR/gaze.known"

- [[ $GAZE_VERBOSE != false ]] &&
+ ! [ "$GAZE_VERBOSE" = false ] &&
message "Discovering ambient files..."
- find $GAZE_ALIEN_PATHS 2>/dev/null | files | filter "$EXCLUDED" | sort
>$TMP_DIR/gaze.found
+ find $GAZE_ALIEN_PATHS 2>/dev/null | files | filter "$EXCLUDED" | sort
>"$TMP_DIR/gaze.found"

- diff -B -a -d $TMP_DIR/gaze.found $TMP_DIR/gaze.known |
- grep -v "^> " |
- grep "^< " |
- cut -c 3- |
+ diff -B -a -d "$TMP_DIR/gaze.found" "$TMP_DIR/gaze.known" |
+ awk 'sub(/^< /, "") { print }' |
filter "$PROTECTED"

- rm -f $TMP_DIR/gaze.found
- rm -f $TMP_DIR/gaze.known
+ rm -f "$TMP_DIR/gaze.found" "$TMP_DIR/gaze.known"

}

diff --git a/usr/sbin/resurrect b/usr/sbin/resurrect
index 415bf76..8bddb81 100755
--- a/usr/sbin/resurrect
+++ b/usr/sbin/resurrect
@@ -110,7 +110,7 @@ function do_resurrect() {
chosen_version=$(
for version in $versions; do
# output: mtime version
- stat --printf "%Y $version\n"
$INSTALL_CACHE/$spell-$version-$HOST.*
+ stat -c "%Y $version" $INSTALL_CACHE/$spell-$version-$HOST.*
done | sort -g -r | head -n1 | cut -d" " -f2
)
else
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index 3a5a168..f7dbde5 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -333,9 +333,9 @@ update_pkgs() {

message "${CHECK_COLOR}Updating ... please wait ... ${DEFAULT_COLOR}"

- local UPDATE_SCRIPT=$TMP_DIR/sorcery.update
- rm -rf $UPDATE_SCRIPT
- cat << EOF > $UPDATE_SCRIPT
+ local UPDATE_SCRIPT="$TMP_DIR"/sorcery.update
+ rm -rf "$UPDATE_SCRIPT"
+ cat << EOF > "$UPDATE_SCRIPT"
#!/bin/bash
############################################################
# Copyright 2001 by Kyle Sallee #
@@ -377,9 +377,9 @@ EOF

make_restore_script

- chmod 100 $RESTORE_SCRIPT
- chmod 100 $UPDATE_SCRIPT
- exec bash $UPDATE_SCRIPT $1
+ chmod 100 "$RESTORE_SCRIPT"
+ chmod 100 "$UPDATE_SCRIPT"
+ exec bash "$UPDATE_SCRIPT" "$1"
# run it via bash to bypass /tmp mounted with noexec option


@@ -392,8 +392,8 @@ function make_restore_script() {
# actually have their values filed in at script generation time
# everything else must be back-quoted to work properly

- rm -f $RESTORE_SCRIPT
- cat << EOF > $RESTORE_SCRIPT
+ rm -f "$RESTORE_SCRIPT"
+ cat << EOF > "$RESTORE_SCRIPT"
#!/bin/bash
############################################################
# This helper script /tmp/sorcery.restore can #
@@ -1943,29 +1943,36 @@ sorcery_queue_remove() {
## user is asked for the su password to avoid futile su-ing.
#---------------------------------------------------------------------
verify_parameters() {
- [[ -z $1 ]] && return 0
-
- case $1 in
- -u|update|-s|system-update|-g|upgrade) true ;;
- -q|queue|queue-security) true ;;
- -Z|queue-newer) true ;;
- -r|rebuild|-rr|rebuild-reconfigure) true ;;
- add-queue|remove-queue|review-queue) true ;;
- hold|unhold|exile|unexile) true ;;
- default*) true ;;
- *) help ;;
+ case "$1" in
+ -v|--version|version)
+ cat /etc/sorcery/version
+ exit 0
+ ;;
+ '' | \
+ -u | update | \
+ -s | system-update | \
+ -g | upgrade | \
+ -q | queue | \
+ queue-security | \
+ -Z | queue-newer | \
+ -r | rebuild | \
+ -rr | rebuild-reconfigure | \
+ add-queue | remove-queue | review-queue | \
+ hold | unhold | \
+ exile | unexile | \
+ default*) ;;
+ *) help ;;
esac
}


main() {
+ rm -f "$UPDATE_SCRIPT"

- rm -f $UPDATE_SCRIPT
-
- if [ -z $1 ]; then
+ if ! [ "$1" ]; then
main_menu
else
- case $1 in
+ case "$1" in
-u|update) update_sorcery ;;
-s|system-update) update_pkgs autoupdate ;;
-g|upgrade) update_pkgs upgrade ;;
@@ -1979,44 +1986,29 @@ main() {
remove-queue) shift; sorcery_queue_remove "$@" ;;
hold) shift; sorcery_hold_spells "$@" ;;
unhold) shift; sorcery_unhold_spells "$@" ;;
- exile) shift; set_exiled $@ ;;
- unexile) shift; set_unexiled $@ ;;
+ exile) shift; set_exiled "$@" ;;
+ unexile) shift; set_unexiled "$@" ;;
default*) shift; sorcery_cli_defaults "$@" ;;
-
- -h|--help|help) help ;;
- -v|--version|version) echo $SORCERY_VERSION ;;
- *) help ;;
esac
fi

}

. /etc/sorcery/config
-if [ "$UID" == 0 ]; then
- DIALOG='$DIALOGPROG --backtitle "Sorcery Spell Management Utility"
--stdout'
+verify_parameters "$@"

+if [ "$UID" = 0 ]; then
+ DIALOG='$DIALOGPROG --backtitle "Sorcery Spell Management Utility"
--stdout'
SORCERY_VERSION=`cat /etc/sorcery/version`
mk_tmp_dirs sorcery
init_hooks
main "$@"
rc=$?
- cleanup_tmp_dir $TMP_DIR
+ cleanup_tmp_dir "$TMP_DIR"
exit $rc
else
- if [[ $1 == -h ]] || [[ $1 == --help ]] || [[ $1 == help ]]; then
- help
- else
- if [[ $1 == -v ]] || [[ $1 == --version ]] || [[ $1 == version ]]; then
- cat /etc/sorcery/version
- else
- # validate the rest of the parameters before su-ing
- verify_parameters "$@"
-
- echo "Enter the root password, please."
- PARAMS=$(consolidate_params "$@")
- exec su -c "sorcery $PARAMS" root
- fi
- fi
+ echo "Enter the root password, please."
+ exec su -c "sorcery $(consolidate_params "$@")" root
fi


diff --git a/var/lib/sorcery/modules/libqueue
b/var/lib/sorcery/modules/libqueue
index 0c3a257..15775d2 100755
--- a/var/lib/sorcery/modules/libqueue
+++ b/var/lib/sorcery/modules/libqueue
@@ -175,7 +175,7 @@ function find_updates() {
local tmp_queue=$1
local recheck_queue=$2

- awk -v i=$VERSION_STATUS -v verbose=$VERBOSE_QUEUING
"$awk_version_compare"'
+ awk -v i="$VERSION_STATUS" -v verbose="$VERBOSE_QUEUING"
"$awk_version_compare"'
# decide what to print - just the spell or also the reason
function needs_update( reasons, diff) {
if (verbose == "on") {
@@ -207,10 +207,8 @@ function find_updates() {
}
}

- {
- if ( ! ($1 in map)) {
- map[$1]=$0;
- }
+ !($1 in map) {
+ map[$1] = $0
}

END {
diff --git a/var/lib/sorcery/modules/libstage
b/var/lib/sorcery/modules/libstage
index 77048d9..ca330ca 100755
--- a/var/lib/sorcery/modules/libstage
+++ b/var/lib/sorcery/modules/libstage
@@ -103,7 +103,7 @@ function stage_install_files()
function stage_install_directory()
{
local DIR=$1
- local stat=( $(stat --printf "%a\n%U\n%G\n" "$STAGE_DIRECTORY/TRANSL/$DIR"
) )
+ local stat=( $(stat -c '%a %U %G' "$STAGE_DIRECTORY/TRANSL/$DIR" ) )
local PERMISSION=${stat[0]}
local OWNER=${stat[1]}
local GROUP=${stat[2]}
@@ -128,7 +128,7 @@ function stage_install_directory()
function stage_install_file()
{
local FILE=$1
- local stat=( $(stat --printf "%a\n%U\n%G\n%h\n%i\n"
"$STAGE_DIRECTORY/TRANSL/$FILE" ) )
+ local stat=( $(stat -c '%a %U %G %h %i' "$STAGE_DIRECTORY/TRANSL/$FILE" ) )
local PERMISSION=${stat[0]}
local OWNER=${stat[1]}
local GROUP=${stat[2]}
@@ -194,7 +194,7 @@ function stage_install_fifo()
{
local FILE=$1
local SAVE=$CONFIG_STAGE_DIRECTORY/$FILE.$(date +%Y%m%d%H%M%S)
- local stat=( $(stat --printf "%a\n%U\n%G\n"
"$STAGE_DIRECTORY/TRANSL/$FILE" ) )
+ local stat=( $(stat -c '%a %U %G' "$STAGE_DIRECTORY/TRANSL/$FILE" ) )
local PERMISSION=${stat[0]}
local OWNER=${stat[1]}
local GROUP=${stat[2]}
@@ -225,7 +225,7 @@ function stage_install_fifo()
function stage_install_char_block()
{
local FILE=$1
- local stat=( $(stat --printf "%a\n%U\n%G\n%t\n%T\n"
"$STAGE_DIRECTORY/TRANSL/$FILE" ) )
+ local stat=( $(stat -c '%a %U %G %t %T' "$STAGE_DIRECTORY/TRANSL/$FILE" ) )
local PERMISSION=${stat[0]}
local OWNER=${stat[1]}
local GROUP=${stat[2]}
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index 02f9f2c..6a3d814 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -693,7 +693,7 @@ function tablet_check_repair_file() {
local replace=0
local tablet_file

- if ! [[ "$loaded" ]] ; then
+ if ! [ "$loaded" ] ; then
tablet_get_version "$page" spell_version
tablet_get_updated "$page" spell_updated
tablet_get_patchlevel "$page" spell_patchlevel
@@ -749,40 +749,46 @@ function tablet_create_version_cache() {
local rc=0
local ok_spells=( $(get_all_spells_with_status ok) )

- for spell in ${ok_spells[@]}; do
+ for spell in "${ok_spells[@]}"; do
# make sure we don't get any rare errors into our carefully crafted list
if tablet_find_spell_dir $spell page_dir > /dev/null; then
tablet_get_version $page_dir version > /dev/null
tablet_get_patchlevel $page_dir patchlevel > /dev/null
tablet_get_security_patch $page_dir security_patch > /dev/null
tablet_get_updated $page_dir updated > /dev/null
- elif [[ $spell == alter || $spell == smgl-prelink || $spell ==
smgl-strip ]]; then
- version=$(installed_version $spell)
else
- error_message "${PROBLEM_COLOR}Creation of the cache failed at
$spell," \
- "please run cleanse --tablet and retry. If some spells" \
- "have unfixable tablet pages, recast them.\n" \
- "If you're ok with slower queueing of everything just
run:" \
- "export OLD_QUEUING_METHOD=1 and you won't be bothered
again.$DEFAULT_COLOR"
- rc=1
- break
+ case "$spell" in
+ alter|smgl-prelink|smgl-strip)
+ version=$(installed_version $spell)
+ ;;
+ *)
+ error_message "${PROBLEM_COLOR}Creation of the cache failed at
$spell," \
+ "please run cleanse --tablet and retry. If some
spells" \
+ "have unfixable tablet pages, recast them.\n" \
+ "If you're ok with slower queueing of everything just
run:" \
+ "export OLD_QUEUING_METHOD=1 and you won't be
bothered again.$DEFAULT_COLOR"
+ rc=1
+ break
+ ;;
+ esac
fi
echo "$spell ${version:-0} ${patchlevel:-0} ${security_patch:-0}
${updated:-0}"
done > "$file"
-
- if [[ ${#ok_spells[@]} != $(wc -l < $file) ]]; then
- bad=$(tr ' ' '\n' <<< "${ok_spells[@]}" | sort - "$file" "$file" | uniq
-u)
- if [[ $rc == 0 && -n $bad ]]; then
- message "Spells with missing or corrupt tablet pages: $bad"
- fi
+ bad=$(awk '
+ BEGIN { for (i in ARGV) bad[ARGV[i]]; split("", ARGV) }
+ { delete bad[$0] }
+ END { for (i in bad) print i }
+ ' "${ok_spells[@]}" < "$file")
+ if [ "$bad" ]; then
+ message "Spells with missing or corrupt tablet pages: $bad"
rm "$file"
return 1
fi

# the rc of break 13 still does not match what is documented in bash 4.2.24
# (this is why we don't sort directly in the loop and have a separate rc
var)
- sort "$file" > "$TMP_DIR}/sorting.$$.tmp"
- mv "$TMP_DIR}/sorting.$$.tmp" "$file"
+ sort "$file" > "$TMP_DIR/sorting.$$.tmp"
+ mv "$TMP_DIR/sorting.$$.tmp" "$file"
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/url_handlers/url_git
b/var/lib/sorcery/modules/url_handlers/url_git
index f07dd76..a1ef161 100755
--- a/var/lib/sorcery/modules/url_handlers/url_git
+++ b/var/lib/sorcery/modules/url_handlers/url_git
@@ -32,13 +32,11 @@
##
#---------------------------------------------------------------------
function url_git_crack() {
-
- URL=`url_strip_prefix "$1" git`
- GIT_ROOT=`echo $URL | sed "s#\(^[^/]*[^:]*\):.*#\1#"`
- GIT_ROOT=git://$GIT_ROOT
- local GIT_DIRECTORY_TAG=`echo $URL | sed "s#^[^/]*[^:]*\(.*\)#\1#"`
- GIT_DIRECTORY=`echo $GIT_DIRECTORY_TAG | cut -d : -f2`
- local GIT_TAGNAME=`echo $GIT_DIRECTORY_TAG | cut -d : -f3`
+ URL=$(url_strip_prefix "$1" git)
+ GIT_ROOT=git://$(sed "s#\(^[^/]*[^:]*\):.*#\1#" <<< "$URL")
+ local GIT_DIRECTORY_TAG=$(sed "s#^[^/]*[^:]*\(.*\)#\1#" <<< "$URL")
+ GIT_DIRECTORY=$(cut -d : -f2 <<< "$GIT_DIRECTORY_TAG")
+ local GIT_TAGNAME=$(cut -d : -f3 <<< "$GIT_DIRECTORY_TAG")
GIT_TAG=${GIT_TAGNAME:=master}

}
diff --git a/var/lib/sorcery/modules/url_handlers/url_git_http
b/var/lib/sorcery/modules/url_handlers/url_git_http
index c88e073..e1d380a 100755
--- a/var/lib/sorcery/modules/url_handlers/url_git_http
+++ b/var/lib/sorcery/modules/url_handlers/url_git_http
@@ -32,15 +32,12 @@
##
#---------------------------------------------------------------------
function url_git_http_crack() {
-
- URL=`url_strip_prefix "$1" git_http`
- GIT_ROOT=`echo $URL | sed "s#\(^[^/]*[^:]*\):.*#\1#"`
- GIT_ROOT=http://$GIT_ROOT
- local GIT_DIRECTORY_TAG=`echo $URL | sed "s#^[^/]*[^:]*\(.*\)#\1#"`
- GIT_DIRECTORY=`echo $GIT_DIRECTORY_TAG | cut -d : -f2`
- local GIT_TAGNAME=`echo $GIT_DIRECTORY_TAG | cut -d : -f3`
+ URL=$(url_strip_prefix "$1" git_http)
+ GIT_ROOT=http://$(sed "s#\(^[^/]*[^:]*\):.*#\1#" <<< "$URL")
+ local GIT_DIRECTORY_TAG=$(sed "s#^[^/]*[^:]*\(.*\)#\1#" <<< "$URL")
+ GIT_DIRECTORY=$(cut -d : -f2 <<< $GIT_DIRECTORY_TAG)
+ local GIT_TAGNAME=$(cut -d : -f3 <<< $GIT_DIRECTORY_TAG)
GIT_TAG=${GIT_TAGNAME:=master}
-
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/url_handlers/url_git_local
b/var/lib/sorcery/modules/url_handlers/url_git_local
index 5dc2a0d..8523b8c 100644
--- a/var/lib/sorcery/modules/url_handlers/url_git_local
+++ b/var/lib/sorcery/modules/url_handlers/url_git_local
@@ -32,14 +32,12 @@
##
#---------------------------------------------------------------------
function url_git_local_crack() {
-
- URL=`url_strip_prefix "$1" git_local`
- GIT_ROOT=`echo $URL | sed "s#\(^[^/]*[^:]*\):.*#\1#"`
- local GIT_DIRECTORY_TAG=`echo $URL | sed "s#^[^/]*[^:]*\(.*\)#\1#"`
- GIT_DIRECTORY=`echo $GIT_DIRECTORY_TAG | cut -d : -f2`
- local GIT_TAGNAME=`echo $GIT_DIRECTORY_TAG | cut -d : -f3`
+ URL=$(url_strip_prefix "$1" git_local)
+ GIT_ROOT=$(sed "s#\(^[^/]*[^:]*\):.*#\1#" <<< "$URL")
+ local GIT_DIRECTORY_TAG=$(sed "s#^[^/]*[^:]*\(.*\)#\1#" <<< "$URL")
+ GIT_DIRECTORY=$(cut -d : -f2 <<< "$GIT_DIRECTORY_TAG")
+ local GIT_TAGNAME=$(cut -d : -f3 <<< "$GIT_DIRECTORY_TAG")
GIT_TAG=${GIT_TAGNAME:=master}
-
}

#---------------------------------------------------------------------



  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (35cf760e92fb4d3798d23c032e0290bcacadf0d8), Ismael Luceno, 02/04/2019

Archive powered by MHonArc 2.6.24.

Top of Page