Skip to Content.
Sympa Menu

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

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 (d87ca025e71759df0b2e03dc22147388c9a3776a)
  • Date: Fri, 21 Jul 2017 01:40:28 +0000

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

var/lib/sorcery/modules/libsorcery | 72
++++++++++++++++---------------------
1 file changed, 33 insertions(+), 39 deletions(-)

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

libsorcery: Fix generate_keep_list

Broken by commit ffd9f321cdcbcc9e97f3c8db67f2e1a6a8d800f5.

The sources function is now inviable for this purpose, but the
get_spell_files is a drop-in replacement in this context.

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

libsorcery: Cleanup generate_keep_list a little bit

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

libsorcery: Clean up prune()

diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index 1d8bc1c..f3b0ff7 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -962,14 +962,14 @@ function source_urls() { (
##
#---------------------------------------------------------------------
function generate_keep_list() {
- local source_keep=$1
- local cache_keep=$2
- local type=$3
- if [[ $type == installed_only ]] ; then
+ local source_keep="$1"
+ local cache_keep="$2"
+ local type="$3"
+ if [[ "$type" == installed_only ]] ; then
get_all_spells_with_status ok |
sort -u |
while read spell; do
- codex_find_spell_by_name $spell
+ codex_find_spell_by_name "$spell"
done
else
codex_get_all_spells
@@ -977,8 +977,8 @@ function generate_keep_list() {
(
echo sorcery-$SORCERY_BRANCH.tar.bz2
while read SPELL_DIRECTORY ; do
- codex_set_current_spell_quick $SPELL_DIRECTORY &>/dev/null
- sources 2>/dev/null
+ codex_set_current_spell_quick "$SPELL_DIRECTORY" &>/dev/null
+ get_spell_files 2>/dev/null
ls $INSTALL_CACHE/$SPELL-$VERSION-* 1>&2 2>/dev/null
unset VERSION SPELL ${!SOURCE*}
done
@@ -1004,62 +1004,56 @@ function prune() {
message "${MESSAGE_COLOR}Generating list of files to
keep...${DEFAULT_COLOR}"
local SOURCE_KEEP="$TMP_DIR/prune-keep-source"
local CACHE_KEEP="$TMP_DIR/prune-keep-cache"
- rm -rf $CACHE_KEEP
- rm -rf $SOURCE_KEEP
- generate_keep_list $SOURCE_KEEP $CACHE_KEEP $1
+ rm -rf "$CACHE_KEEP"
+ rm -rf "$SOURCE_KEEP"
+ generate_keep_list "$SOURCE_KEEP" "$CACHE_KEEP" "$1"

message "${MESSAGE_COLOR}Cleaning up source cache" \

"(${DEFAULT_COLOR}$SOURCE_CACHE${MESSAGE_COLOR})...${DEFAULT_COLOR}"
local SOURCE_RM="$TMP_DIR/prune.rm.source"
- find $SOURCE_CACHE -follow -mindepth 1 -maxdepth 1 -type f|
+ find "$SOURCE_CACHE" -follow -mindepth 1 -maxdepth 1 -type f|
awk -F/ 'BEGIN {
- while ( getline < ARGV[1] ) {
- keep[$NF] = 1;
- }
- while ( getline < ARGV[2] ) {
- if ( keep[$NF] != 1 ) {
- print $0;
- }
- }
- }' $SOURCE_KEEP - |sort -u > $SOURCE_RM
- if test -s $SOURCE_RM ; then
- NUM_NO_KEEP=$(cat $SOURCE_RM|wc -l)
+ while ( getline < ARGV[1] )
+ keep[$NF]
+ while ( getline < ARGV[2] )
+ if (!($NF in keep))
+ print
+ }' "$SOURCE_KEEP" - |sort -u > "$SOURCE_RM"
+ if [ -s "$SOURCE_RM" ]; then
+ NUM_NO_KEEP=$(< "$SOURCE_RM" wc -l)

message "There are $NUM_NO_KEEP files that can be removed"
if query "Edit the list?" "n" ; then
- edit_file $SOURCE_RM
+ edit_file "$SOURCE_RM"
fi
if query "Remove the files?" "y" ; then
- cat $SOURCE_RM|xargs rm
+ < "$SOURCE_RM" xargs rm
fi
fi

message "${MESSAGE_COLOR}Cleaning up install cache" \

"(${DEFAULT_COLOR}$INSTALL_CACHE${MESSAGE_COLOR})...${DEFAULT_COLOR}"
local CACHE_RM="$TMP_DIR/prune.rm.cache"
- find $INSTALL_CACHE -mindepth 1 -maxdepth 1 -type f|
+ find "$INSTALL_CACHE" -mindepth 1 -maxdepth 1 -type f|
awk -F/ 'BEGIN {
- while ( getline < ARGV[1] ) {
- keep[$NF] = 1;
- }
- while ( getline < ARGV[2] ) {
- if ( keep[$NF] != 1 ) {
- print $0;
- }
- }
- }' $CACHE_KEEP - |sort -u > $CACHE_RM
- if test -s $CACHE_RM ; then
- NUM_NO_KEEP=$( cat $CACHE_RM | wc -l )
+ while ( getline < ARGV[1] )
+ keep[$NF]
+ while ( getline < ARGV[2] )
+ if (!($NF in keep))
+ print
+ }' "$CACHE_KEEP" - |sort -u > "$CACHE_RM"
+ if [ -s "$CACHE_RM" ]; then
+ NUM_NO_KEEP=$(< "$CACHE_RM" wc -l)
message "There are $NUM_NO_KEEP files that can be removed"
if query "Edit the list?" "n" ; then
- edit_file $CACHE_RM
+ edit_file "$CACHE_RM"
fi
if query "Remove the files?" "y" ; then
- cat $CACHE_RM|xargs rm
+ < "$CACHE_RM" xargs rm
fi
fi

- rm -f $SOURCE_KEEP $CACHE_KEEP $SOURCE_RM $CACHE_RM
+ rm -f "$SOURCE_KEEP" "$CACHE_KEEP" "$SOURCE_RM" "$CACHE_RM"

}




  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (d87ca025e71759df0b2e03dc22147388c9a3776a), Ismael Luceno, 07/20/2017

Archive powered by MHonArc 2.6.24.

Top of Page