Skip to Content.
Sympa Menu

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

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 (7beca7719c3214ce87971127b863b1f4c783592f)
  • Date: Tue, 7 May 2019 22:43:08 +0000

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

var/lib/sorcery/modules/liboscompat | 4 +-
var/lib/sorcery/modules/libtablet | 60
+++++++++++++++++-------------------
2 files changed, 31 insertions(+), 33 deletions(-)

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

libtablet: Reimplement tablet_create_version_cache

This version uses a simpler stream-based approach to process the spell
list.

The use of the FNR AWK variable still ties us to GAWK/MAWK.

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

liboscompat: install: Ignore -v flag

diff --git a/var/lib/sorcery/modules/liboscompat
b/var/lib/sorcery/modules/liboscompat
index 5bc110e..6c7eb23 100644
--- a/var/lib/sorcery/modules/liboscompat
+++ b/var/lib/sorcery/modules/liboscompat
@@ -18,11 +18,11 @@ if ! type install >/dev/null 2>/dev/null; then
while case "$1" in
-o|-g|-m) eval ${1#-}'="$2"'; shift;;
-p|-D) ;; # always
- -d) eval ${1#-}=1 ;;
+ -d|-v) eval ${1#-}=1 ;;
*) false ;;
esac
do shift; done
- if [ "$d" ]; then
+ if [ -n "$d" ]; then
mkdir -p "$1"
else
mkdir -p "${2%/*}"
diff --git a/var/lib/sorcery/modules/libtablet
b/var/lib/sorcery/modules/libtablet
index ee31394..7b782a4 100755
--- a/var/lib/sorcery/modules/libtablet
+++ b/var/lib/sorcery/modules/libtablet
@@ -737,53 +737,51 @@ tablet_check_repair_file() {
## @param file that will hold the cache
#---------------------------------------------------------------------
tablet_create_version_cache() {
- [[ -f "$1" ]] && return 0
+ [ -f "$1" ] && return 0
local file="$1"
local page_dir
local spell version patchlevel security_patch updated
- local rc=0
- local ok_spells=( $(get_all_spells_with_status ok) )
+ local ok_spells="$(mktemp -u)"

- for spell in "${ok_spells[@]}"; do
+ get_all_spells_with_status ok | sort | tee "$ok_spells" |
+ while read spell; 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
+ 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
else
case "$spell" in
alter|smgl-prelink|smgl-strip)
- version=$(installed_version $spell)
+ 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
+ continue
;;
esac
fi
echo "$spell ${version:-0} ${patchlevel:-0} ${security_patch:-0}
${updated:-0}"
done > "$file"
- bad=$(awk '
- BEGIN { for (i in ARGV) bad[ARGV[i]]; split("", ARGV) }
- { delete bad[$1] }
- END { for (i in bad) print i }
- ' "${ok_spells[@]}" < "$file")
- if [ "$bad" ]; then
- message "Spells with missing or corrupt tablet pages: $bad"
- rm "$file"
+ awk -v WARN="$PROBLEM_COLOR" -v NORMAL="$DEFAULT_COLOR" '
+ FNR == 1 { do { bad[$0]; getline } while (FNR > 1) }
+ { delete bad[$1] }
+ END {
+ if (!length(bad)) exit(0)
+ print WARN "Spells with missing or corrupt tablet pages:"
+ for (i in bad) print i
+ print "please run cleanse --tablet and retry. If some spells have " \
+ "unfixable tablet pages, recast them.\n" \
+ "If you are ok with slower queueing of everything just run:\n" \
+ "export OLD_QUEUING_METHOD=1 and you will not be bothered " \
+ "again." NORMAL
+ exit(1)
+ }
+ ' "$ok_spells" "$file" || {
+ rm "$file" "$ok_spells"
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"
+ }
+ rm "$ok_spells"
}

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



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

Archive powered by MHonArc 2.6.24.

Top of Page