Skip to Content.
Sympa Menu

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

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 (a4368f3ee26df2f3fe20e904d9db4f398a30e847)
  • Date: Mon, 6 May 2019 18:01:51 +0000

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

var/lib/sorcery/modules/dl_handlers/dl_wget | 4 --
var/lib/sorcery/modules/libresurrect | 14 ++++----
var/lib/sorcery/modules/libtablet | 45
++++++++++++----------------
var/lib/sorcery/modules/libtrack | 15 +--------
4 files changed, 31 insertions(+), 47 deletions(-)

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

libtablet: Reimplement tablet_import_repair_files using find

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

libtablet: Replace ksh syntax in tablet_create_version_cache

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

libtablet: Fix version cache creation, awk snippet

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

libtablet: Fix quoting of variables at tablet_get_tb_version

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

libresurrect: replace non-standard cp flags

-p replaces --preserve=mode,timestamp
-d replaces --no-dereference

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

libtrack: Reimplement make_safe_dir using mktemp

Let's not reinvent the wheel, mktemp does exactly what we need, and
date may not support %N.

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

dl_wget: Remove --retr-symlinks, not needed

The flag has no effect for files specified on the command line, and
may be unsupported (e.g. by busybox).

diff --git a/var/lib/sorcery/modules/dl_handlers/dl_wget
b/var/lib/sorcery/modules/dl_handlers/dl_wget
index 85a7c06..db27746 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_wget
+++ b/var/lib/sorcery/modules/dl_handlers/dl_wget
@@ -120,9 +120,7 @@ dl_wget_set_options() {
check_certificate=--no-check-certificate
fi

- DEREF_SYM="--retr-symlinks"
-
- WGET_OPTIONS="$URL_HTTP_TIMEOUT $URL_HTTP_RETRIES $RATE $PASSIVE $CONTINUE
$DEREF_SYM $check_certificate"
+ WGET_OPTIONS="$URL_HTTP_TIMEOUT $URL_HTTP_RETRIES $RATE $PASSIVE $CONTINUE
$check_certificate"
debug 'dl_wget' "wget options: $WGET_OPTIONS"
}
#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index 583c5c1..7c37f76 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -467,7 +467,7 @@ internal_install_config_file() {
# out where it points to and so something, but thats too annoying
if test -h "$from" ; then
mkdir -p "$(smgl_dirname "$to")" &&
- cp -v --no-dereference --preserve=mode,timestamps "$from" "$to"
+ cp -vdp "$from" "$to"
return $?
fi

@@ -475,7 +475,7 @@ internal_install_config_file() {
if ! test -e "$to" || [[ $STAGED_INSTALL == on ]] ; then
# copy the new one in (plus leading directories)
mkdir -p "$(smgl_dirname "$to")" &&
- cp -v --preserve=mode,timestamps "$from" "$to"
+ cp -vp "$from" "$to"
# to get here the file must exist
elif test -d "$to"; then
message "Trying to install a file ($from) to what was a directory ($to),
I dont know what to do!"
@@ -503,7 +503,7 @@ internal_install_config_file() {
else
# replace the file
mkdir -p "$(smgl_dirname "$to")" &&
- cp -v --preserve=mode,timestamps "$from" "$to"
+ cp -vp "$from" "$to"
fi
fi
}
@@ -551,12 +551,12 @@ real_handle_changed_config() {
done
echo
case $number in
- 0) cp -v --preserve=mode,timestamps "$from" "$to"
+ 0) cp -vp "$from" "$to"
break ;;
- 1) cp -v --preserve=mode,timestamps "$to" "$to.$savetime.old"
- cp -v --preserve=mode,timestamps "$from" "$to"
+ 1) cp -vp "$to" "$to.$savetime.old"
+ cp -vp "$from" "$to"
break ;;
- 2) cp -v --preserve=mode,timestamps "$from" "$to.$savetime.new"
+ 2) cp -vp "$from" "$to.$savetime.new"
mark_file_modified "$to"
# this is deliberatly not track_manual, if this is run from
# FINAL the user might not have wanted the files tracked
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index b531646..ee31394 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -337,17 +337,17 @@ tablet_unload_roots() {
}

tablet_get_tb_version() {
- local tb_dir=$1
- if ! [[ $tb_dir ]] ; then
+ local tb_dir="$1"
+ if [ -z "$tb_dir" ] ; then
error_message "nothing passed in!"
return 1
fi
- if ! test -f $tb_dir/tb_version ||
- [[ "$(< $tb_dir/tb_version)" == 0 ]] ; then
- tablet_0_repair $tb_dir || return 1
+ if ! [ -f "$tb_dir"/tb_version ] ||
+ [ "$(< "$tb_dir"/tb_version)" = 0 ]; then
+ tablet_0_repair "$tb_dir" || return 1
fi
- local ____tb_version=$(<$tb_dir/tb_version)
- if test $____tb_version -gt $TABLET_MAX_VERSION; then
+ local ____tb_version=$(<"$tb_dir"/tb_version)
+ if [ "$____tb_version" -gt "$TABLET_MAX_VERSION" ]; then
error_message "${PROBLEM_COLOR}This sorcery is too old for tablet
version" \
"$tb_version! Please update to the newer version of sorcery" \
"or recast this spell${DEFAULT_COLOR}"
@@ -625,19 +625,14 @@ tablet_set_spell() {
## Import repair files for all tablet pages
#---------------------------------------------------------------------
tablet_import_repair_files() { (
- local tablet_path=$1
- local dir rc chapter page
+ local page

codex_create_in_memory_cache_all -i spell_lookup_hash

- shopt -s nullglob # so REPAIR^* evaluates to nothing if no REPAIR files
-
- for chapter in $tablet_path/* ; do
- test -d $chapter || continue
- for page in $chapter/*; do
- test -d $page || continue
- tablet_import_repair_files_page "$page" spell_lookup_hash
- done
+ # iterate through pages ({tabletdir}/{chapters}/{pages})
+ find "$1" -mindepth 2 -maxdepth 2 -type d |
+ while read page; do
+ tablet_import_repair_files_page "$page" spell_lookup_hash
done
) }

@@ -776,7 +771,7 @@ tablet_create_version_cache() {
done > "$file"
bad=$(awk '
BEGIN { for (i in ARGV) bad[ARGV[i]]; split("", ARGV) }
- { delete bad[$0] }
+ { delete bad[$1] }
END { for (i in bad) print i }
' "${ok_spells[@]}" < "$file")
if [ "$bad" ]; then
@@ -797,19 +792,19 @@ tablet_create_version_cache() {
## @param cache file (usually $VERSION_STATUS)
#---------------------------------------------------------------------
tablet_check_version_cache() {
- [[ -z $1 ]] && return 1
- [[ -n $OLD_QUEUING_METHOD ]] && return 0
- local file=$1
+ [ -n "$OLD_QUEUING_METHOD" ] && return 0
+ local file="$1"

- if [[ -f $file ]] &&
- [[ $file == $VERSION_STATUS ]] &&
- [[ $(wc -l < $file) != $(get_all_spells_with_status ok | wc -l) ]]; then
+ [ -z "$file" ] && return 1
+ if [ -f "$file" ] &&
+ [ "$file" = "$VERSION_STATUS" ] &&
+ [ $(wc -l < "$file") != $(get_all_spells_with_status ok | wc -l) ]; then
error_message "${PROBLEM_COLOR}The tablet version cache is damaged,
removing it!"
error_message "$DEFAULT_COLOR"
rm "$file"
fi

- if [[ ! -f $file ]]; then
+ if ! [ -f "$file" ]; then
message "${MESSAGE_COLOR}Creating the tablet version cache, this" \
"can take a while ...$DEFAULT_COLOR"
tablet_create_version_cache "$file"
diff --git a/var/lib/sorcery/modules/libtrack
b/var/lib/sorcery/modules/libtrack
index 3460f42..67f0651 100755
--- a/var/lib/sorcery/modules/libtrack
+++ b/var/lib/sorcery/modules/libtrack
@@ -617,18 +617,9 @@ seperate_state_files() {
## are usually going to be different between forks so the liklihood
## of a collision is greatly reduced.
#---------------------------------------------------------------------
-make_safe_dir() { (
- RANDOM=$(date "+%N")
- local TMP_SSF=$TMP_DIR/$RANDOM
- while ! mkdir "$TMP_SSF" &> /dev/null; do
- RANDOM=$(date "+%N")
- TMP_SSF=$TMP_DIR/$RANDOM
- sleep .1
- debug "libtrack" "safe dir collision on $TMP_SSF"
- done
- echo $TMP_SSF
- return 0
-) }
+make_safe_dir() {
+ mktemp -d -p "$TMP_DIR"
+}

#---------------------------------------------------------------------
## @License



  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (a4368f3ee26df2f3fe20e904d9db4f398a30e847), Ismael Luceno, 05/06/2019

Archive powered by MHonArc 2.6.24.

Top of Page