Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (df20dcd12fcfe75ef29536e7ff452e14756151c9)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (df20dcd12fcfe75ef29536e7ff452e14756151c9)
  • Date: Thu, 27 Mar 2008 12:46:38 -0500

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 6 ++++++
usr/sbin/alter | 10 +++++-----
usr/sbin/cabal | 3 ++-
usr/sbin/cast | 14 ++++++++------
usr/sbin/cleanse | 14 +++++++-------
usr/sbin/dispel | 36
++++++++++++++++++++++--------------
usr/sbin/gaze | 8 +++++---
usr/sbin/sorcery | 4 ++--
var/lib/sorcery/modules/libcodex | 2 +-
var/lib/sorcery/modules/libdepends | 14 +++++++++-----
var/lib/sorcery/modules/libmisc | 2 +-
var/lib/sorcery/modules/libsorcery | 12 ++++++------
var/lib/sorcery/modules/libstate | 4 ++--
var/lib/sorcery/modules/libtrack | 3 +--
var/lib/sorcery/modules/libtriggers | 2 +-
15 files changed, 78 insertions(+), 56 deletions(-)

New commits:
commit df20dcd12fcfe75ef29536e7ff452e14756151c9
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

* cast, dispel, gaze, sorcery, libdepends: use hash_get_ref some more
* dispel: commented out four debug statements with inline code

commit bca191bd92b6824c80652c0f6428d4641c491cc4
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

and then the same for uses of plain sort file|uniq

commit 0148c5c5a54fb5dd5707329eb2b136c5d817d633
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

changed uses of plain sort|uniq to the featurewise equivalent sort -u

diff --git a/ChangeLog b/ChangeLog
index 232b2b3..5e4e431 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-27 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * changed uses of plain sort|uniq to the featurewise equivalent sort
-u
+ and then the same for uses of plain sort file|uniq
+ * cast, dispel, gaze, sorcery, libdepends: use hash_get_ref some more
+ * dispel: commented out four debug statements with inline code
+
2008-03-26 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* libsorcery: deprecated dirnames() for get_dirnames() in libmisc
cleaned up guess_filename
diff --git a/usr/sbin/alter b/usr/sbin/alter
index 1d702d7..cc76bdb 100755
--- a/usr/sbin/alter
+++ b/usr/sbin/alter
@@ -60,7 +60,7 @@ EOF
create_install_log $IW_LOG $INST_LOG
[ -n "$MD5_DATA" ] && echo "$MD5_DATA" | cut -c35- |
exists | grep -v "^$LOG_DIRECTORY" > "$TMP_LOG.2" &&
- cat "$TMP_LOG.2" "$INST_LOG" | sort | uniq > "$TMP_LOG.3" ||
+ cat "$TMP_LOG.2" "$INST_LOG" | sort -u > "$TMP_LOG.3" ||
cp "$INST_LOG" "$TMP_LOG.3"
rm "$TMP_LOG.2" 2> /dev/null
mv "$TMP_LOG.3" "$INST_LOG"
@@ -115,9 +115,9 @@ function alter_md5_mend() {

if [ -n "$RESULTS" ]; then
TOTAL="$(echo "$RESULTS" | wc -l)"
- SPELLS="$(echo "$RESULTS" | cut -d' ' -f1 | sort | uniq)"
+ SPELLS="$(echo "$RESULTS" | cut -d' ' -f1 | sort -u)"
TOTSP="$(echo "$SPELLS" | wc -l)"
- FILES="$(echo "$RESULTS" | cut -d' ' -f2 | sort | uniq)"
+ FILES="$(echo "$RESULTS" | cut -d' ' -f2 | sort -u)"
if [ "$ARCHIVE" != "off" ]; then
STORE=$STORE_BASE/$SPELL-$VERSION.$$
mkdir -p "$STORE"
@@ -225,7 +225,7 @@ function alter_gather_bins() {
done |
grep -v '/src/\|/lib/modules\|/root/\|/home/' |
sed -e 's/[^/]*$//' | uniq |
- sort | uniq > /etc/prelink.conf
+ sort -u > /etc/prelink.conf
fi

}
@@ -239,7 +239,7 @@ function alter_pre_link() {
alter_alter -n smgl-prelink '
/usr/sbin/prelink -v '"$ARGS"' | tee $TMP_DIR/prelink.$$.output
grep "Prelinking\\|Linking" $TMP_DIR/prelink.$$.output |cut -d" " -f2 |
- sort | uniq |
+ sort -u |
while read PRELINKED; do
touch "$PRELINKED"
done
diff --git a/usr/sbin/cabal b/usr/sbin/cabal
index 0b42fd3..dd0eebd 100755
--- a/usr/sbin/cabal
+++ b/usr/sbin/cabal
@@ -155,7 +155,8 @@ function distribute_cabal_key() {
fi

AK2="/root/.ssh/authorized_keys2"
-
+ # TODO check that the following works, since it is reading and writing to
+ # the same file - $AK2
cat $CABAL_DIRECTORY/$SELECTED |
while read BOX
do cat $CABAL_KEYS/$SELECTED.pub |
diff --git a/usr/sbin/cast b/usr/sbin/cast
index 3459443..e6c70e0 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -338,10 +338,12 @@ function pass_one() {
local dep_spell
SPELLS=$(
for spell in $SPELLS; do
- for dep_spell in $(hash_get to_cast $spell); do
+ local dep_spells
+ hash_get_ref to_cast $spell dep_spells
+ for dep_spell in $dep_spells; do
spell_ok $dep_spell || echo $dep_spell
done
- done|sort|uniq)
+ done|sort -u)
spells=( $SPELLS )
hash_reset deps_only
hash_reset looked_at
@@ -351,9 +353,7 @@ function pass_one() {
hash_put looked_at "${spells[$i]}" done
if ! spell_ok ${spells[$i]}; then
hash_put deps_only ${spells[$i]} done
- new_spells=$(for each in $(hash_get to_cast "${spells[$i]}"); do
- echo $each
- done)
+ hash_get_ref to_cast "${spells[$i]}" new_spells
fi
spells=( ${spells[@]} $new_spells )
unset new_spells
@@ -378,7 +378,9 @@ function pass_one() {

# have new depends overwrite existing ones
for i in $SPELLS_TO_CAST; do
- hash_put dep_f_hash $i "$(hash_get to_cast $i)"
+ local dependencies
+ hash_get_ref to_cast $i dependencies
+ hash_put dep_f_hash $i "$dependencies"
done

debug "cast" "pass_one, done with SPELLS=$SPELLS"
diff --git a/usr/sbin/cleanse b/usr/sbin/cleanse
index a861eeb..e71d297 100755
--- a/usr/sbin/cleanse
+++ b/usr/sbin/cleanse
@@ -402,9 +402,9 @@ function prune_depends()
# put the spells in two files for later perusal
if [[ $action ]] ; then
[ -s $TMP_DIR/prune.dispel ] &&
- dispel $( sort $TMP_DIR/prune.dispel | uniq )
+ dispel $(sort -u $TMP_DIR/prune.dispel)
[ -s $TMP_DIR/prune.cast ] &&
- cast -c $( sort $TMP_DIR/prune.cast | uniq )
+ cast -c $(sort -u $TMP_DIR/prune.cast)
else
local prune_dispel prune_cast t
prune_dispel=$(sort -u $TMP_DIR/prune.dispel 2>/dev/null)
@@ -571,13 +571,13 @@ function cleanse_fix()
if [[ $PASSED ]] ; then
message "${MESSAGE_COLOR}The following spells passed the" \
"check:${SPELL_COLOR}"
- echo "$PASSED"|sort|uniq|column
+ echo "$PASSED"|sort -u|column
message "${DEFAULT_COLOR}"
fi
if [[ $FIXED ]] ; then
message "${MESSAGE_COLOR}The following spells were broken and" \
"fixed:${QUERY_COLOR}"
- echo "$FIXED"|sort|uniq|column
+ echo "$FIXED"|sort -u|column
message "${DEFAULT_COLOR}"
fi
if [[ $HOPELESS ]] ; then
@@ -588,7 +588,7 @@ function cleanse_fix()
message "${MESSAGE_COLOR}The following spells were broken and" \
"could not be fixed:${PROBLEM_COLOR}"
fi
- echo "$HOPELESS"|sort|uniq|column
+ echo "$HOPELESS"|sort -u|column
message "${DEFAULT_COLOR}"
return 1
fi
@@ -757,7 +757,7 @@ function cleanse_fix_init_ldd_check() {
done
for SPELL in $* ; do
I_LOG=$INSTALL_LOGS/$SPELL-$(private_installed_version $SPELL)
- hash_put ldd_hash $SPELL "$(grep '\.so$'
$I_LOG|get_dirnames|sort|uniq|tr '\n' :)"
+ hash_put ldd_hash $SPELL "$(grep '\.so$' $I_LOG|get_dirnames|sort -u|tr
'\n' :)"
progress_bar $count $size 50
let count++
done
@@ -1011,7 +1011,7 @@ function cleanse_fix_md5sum_check() {
echo $LINE >> $tfile
# remove duplicates
cp $tfile $TMP_DIR/$SPELL.possessed.$$
- sort $TMP_DIR/$SPELL.possessed.$$|uniq > $tfile
+ sort -u $TMP_DIR/$SPELL.possessed.$$ > $tfile
rm $TMP_DIR/$SPELL.possessed.$$
lock_commit_transaction $possessed

diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index b5007c6..d3a0de7 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -314,20 +314,25 @@ function dispel_children() {
local our_children
for spell in $spells; do
# this assumes list_add remains idempotent, which it is
- list_add our_children $(hash_get down_deps $spell)
+ local dependencies
+ hash_get_ref down_deps $spell dependencies
+ list_add our_children $dependencies
done
debug "children of $1 -> $our_children"

- local is_orphan
+ local is_orphan is_gone
local orphan_list non_orphan_list
for child in $our_children; do
- if [[ $(hash_get ALL_DISPELS $child) == "yes" ]] ; then
+ hash_get_ref ALL_DISPELS $child is_gone
+ if [[ $is_gone == yes ]]; then
debug "someone depends on $child but it was already removed"
continue
fi
# determine if this child is becomming an orphan or not
is_orphan="yes"
- for parent in $(hash_get up_deps $child); do
+ local parents
+ hash_get_ref up_deps $child parents
+ for parent in $parents; do
if ! list_find "$spells" "$parent"; then
is_orphan=no
break
@@ -342,9 +347,9 @@ function dispel_children() {

local removed_children
for child in $orphan_list; do
- debug dispel "looking at $child:"
- debug dispel "parents: $(hash_get up_deps $child)"
- debug "children: $(hash_get down_deps $child)"
+ debug dispel "looking at orphan $child:"
+ #debug dispel "parents: $(hash_get up_deps $child)"
+ #debug "children: $(hash_get down_deps $child)"
if dispel_child_query "$child" "is an orphan" \
"Would you like to dispel it" \
"${ORPHAN_DEFAULT}" ; then
@@ -353,9 +358,9 @@ function dispel_children() {
fi
done
for child in $non_orphan_list; do
- debug "looking at $child:"
- debug "parents: $(hash_get up_deps $child)"
- debug "children: $(hash_get down_deps $child)"
+ debug "looking at non-orphan $child:"
+ #debug "parents: $(hash_get up_deps $child)"
+ #debug "children: $(hash_get down_deps $child)"
if dispel_child_query "$child" "is not an orphan" \
"Would you like to dispel it" \
"${NONORPHAN_DEFAULT}" ; then
@@ -444,8 +449,10 @@ function remove_from_dep_trees() {
local down_dep_hash=$2
local up_dep_hash=$3
local foo
- for child in $(hash_get $down_dep_hash $spell); do
- foo=" $(hash_get $up_dep_hash $child) "
+ local children
+ hash_get_ref $down_dep_hash $spell children
+ for child in $children; do
+ hash_get_ref $up_dep_hash $child foo
list_remove foo $spell
hash_put $up_dep_hash $child "$foo"
done
@@ -466,9 +473,10 @@ function remove_from_dep_trees() {
function get_borked_parents() {
local spell=$1
local up_dep_hash=$2
- local parent
+ local parent parents
# get the spells that depend on us
- for parent in $(hash_get $up_dep_hash $spell); do
+ hash_get_ref $up_dep_hash $spell parents
+ for parent in $parents; do
debug dispel "hash_append $3 $parent $spell"
hash_append $3 $parent $spell
done
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index 471fc0a..8a62c53 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -895,11 +895,13 @@ function gaze_activate_voyeur() {
## Show spells that have no other spell depending on them
#-----
function show_orphans() {
+ local spell each
compute_reverse_installed_depends my_hash
for each in $(get_all_spells_with_status
'installed';get_all_spells_with_status 'held'); do
- if [[ ! $(hash_get my_hash $each) ]] ; then
- echo "$each"
- fi
+ hash_get_ref my_hash $each spell
+ if [[ ! $spell ]]; then
+ echo "$each"
+ fi
done|sort
}

diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index 2b05a7a..acbbe8e 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -202,7 +202,7 @@ show_spells() { (

show_sections() {

- LIST=`codex_get_all_section_names | sort | uniq`
+ LIST=`codex_get_all_section_names | sort -u`

for LINE in $LIST; do
echo $LINE
@@ -740,7 +740,7 @@ architecture_menu() {
# now that there archspecs have been found, build the dialog list
for specname in $(hash_get_table_fields archspec_hash|sort); do
CPUNAME=""
- SPECFILE=$(hash_get archspec_hash $specname) &&
+ hash_get_ref archspec_hash $specname SPECFILE &&
debug "sorcery" "architecture_menu() - $specname found at $SPECFILE"
CPUNAME=$( . $SPECFILE && echo $CPUNAME ) &&
LIST="$LIST $specname \"$CPUNAME\" \"$CPUNAME\""
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index e145253..e67c555 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -452,7 +452,7 @@ function codex_get_sections() {

# comes in the format
# spellname /path/to/section
- cut -d' ' -f2 "$GRIMOIRE/$SPELL_INDEX_FILE" | sort | uniq
+ cut -d' ' -f2 "$GRIMOIRE/$SPELL_INDEX_FILE" | sort -u
shift
done
}
diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index 26ffca9..74b843d 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -399,12 +399,14 @@ function compute_uninstalled_depends()
PRETEND_NOT_INSTALLED=" $@ "

local _idx
+ local looked_at

# All specified spells are assumed to be not installed, or else -c and -r
# would have to be specified all the time.

for (( _idx=0 ; _idx<${#spells[*]} ; _idx++ )) ; do
- if [[ ! $(hash_get depends_looked_at ${spells[$_idx]}) ]]; then
+ hash_get_ref depends_looked_at ${spells[$_idx]} looked_at
+ if [[ ! $looked_at ]]; then
if ! private_run_depends ${spells[$_idx]} ; then
# i dont know if this will work, but it will have to suffice
private_remove_dependees ${spells[$_idx]}
@@ -1588,11 +1590,13 @@ function real_show_up_depends()
local MAX_DEPTH=$2
local type=$3
function show_up_depends_sub() {
- local each
+ local each dependencies checked
let i++
[[ $MAX_DEPTH ]] && [[ $i -gt $MAX_DEPTH ]] && return
- for each in $(hash_get foo $1); do
- if ! [[ $(hash_get done $each) ]] ; then
+ hash_get_ref foo $1 dependencies
+ for each in $dependencies; do
+ hash_get_ref done $each checked
+ if ! [[ $checked ]] ; then
hash_put done $each done
echo $each:$1
show_up_depends_sub $each
@@ -1612,7 +1616,7 @@ function real_show_up_depends()
unlock_file "$DEPENDS_STATUS"
else
show_up_depends_sub "$1"|cut -f1 -d:
- fi|sort|uniq
+ fi|sort -u
hash_reset foo
hash_reset done
}
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 3c6dc99..fd5879a 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1042,7 +1042,7 @@ function real_config_query_list () {
function real_get_source_nums() {
local foo
compgen -v SOURCE |
- grep '^SOURCE[[:digit:]]*$'|sort|uniq|
+ grep '^SOURCE[[:digit:]]*$'|sort -u|
while read foo; do echo "${1}${foo/SOURCE/}"; done
}

diff --git a/var/lib/sorcery/modules/libsorcery
b/var/lib/sorcery/modules/libsorcery
index 075d76a..3f646d7 100755
--- a/var/lib/sorcery/modules/libsorcery
+++ b/var/lib/sorcery/modules/libsorcery
@@ -944,7 +944,7 @@ function update_install_queue() {
clear_line
lock_file $INSTALL_QUEUE
rm -f $INSTALL_QUEUE
- sort $tmp_queue | uniq > $INSTALL_QUEUE
+ sort -u $tmp_queue > $INSTALL_QUEUE
unlock_file $INSTALL_QUEUE

}
@@ -977,7 +977,7 @@ function update_security_install_queue() {

lock_file $INSTALL_QUEUE
rm -f $INSTALL_QUEUE
- sort $tmp_queue | uniq > $INSTALL_QUEUE
+ sort -u $tmp_queue > $INSTALL_QUEUE
unlock_file $INSTALL_QUEUE

}
@@ -1376,7 +1376,7 @@ function generate_keep_list() {
{
get_all_spells_with_status installed
get_all_spells_with_status held
- } | sort | uniq | while read spell ; do
+ } | sort -u | while read spell ; do
codex_find_spell_by_name $spell
done
else
@@ -1429,7 +1429,7 @@ function prune() {
print $0;
}
}
- }' $SOURCE_KEEP - |sort|uniq > $SOURCE_RM
+ }' $SOURCE_KEEP - |sort -u > $SOURCE_RM
if test -s $SOURCE_RM ; then
NUM_NO_KEEP=$(cat $SOURCE_RM|wc -l)

@@ -1455,7 +1455,7 @@ function prune() {
print $0;
}
}
- }' $CACHE_KEEP - |sort|uniq > $CACHE_RM
+ }' $CACHE_KEEP - |sort -u > $CACHE_RM
if test -s $CACHE_RM ; then
NUM_NO_KEEP=$( cat $CACHE_RM | wc -l )
message "There are $NUM_NO_KEEP files that can be removed"
@@ -1555,7 +1555,7 @@ function find_providers() {
for GRIMOIRE in $(codex_get_all_grimoires); do
gawk '/^'"$feature"'[[:blank:]]/ { print $2 }' \
"$GRIMOIRE/$PROVIDE_INDEX_FILE"
- done | get_basenames|sort|uniq)
+ done | get_basenames|sort -u)

# filter out providers we dont want, so far this is:
# a) do not provide something in the first grimoire they are found in
diff --git a/var/lib/sorcery/modules/libstate
b/var/lib/sorcery/modules/libstate
index dc0c658..a1537b3 100755
--- a/var/lib/sorcery/modules/libstate
+++ b/var/lib/sorcery/modules/libstate
@@ -683,7 +683,7 @@ function real_spell_ok() {
#---------------------------------------------------------------------
function real_provider_ok() {
for spell in $(search_depends_status_exact $DEPENDS_STATUS '.*' ".*($1)" \
- 'on' '.*' '.*' |cut -f2 -d:|cut -f1 -d\(|sort|uniq); do
+ 'on' '.*' '.*' |cut -f2 -d:|cut -f1 -d\(|sort -u); do
spell_ok $spell && return 0
done
return 1
@@ -708,7 +708,7 @@ function real_get_spell_provider() {
[[ $dep_status ]] || dep_status=$DEPENDS_STATUS
fi
search_depends_status_exact $dep_status "$1" ".*($2)" \
- 'on' '.*' '.*' '.*' |cut -f2 -d:|cut -f1 -d\(|sort|uniq
+ 'on' '.*' '.*' '.*' |cut -f2 -d:|cut -f1 -d\(|sort -u
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libtrack
b/var/lib/sorcery/modules/libtrack
index c9a2aa9..cf24b0a 100755
--- a/var/lib/sorcery/modules/libtrack
+++ b/var/lib/sorcery/modules/libtrack
@@ -227,8 +227,7 @@ function create_install_log() {
filter_excluded > $OUTPUT
else
parse_iw $INPUT |
- sort |
- uniq |
+ sort -u |
install_log_filter $INSTALL_ROOT "" |
grep -v -x "" |
filter_excluded |
diff --git a/var/lib/sorcery/modules/libtriggers
b/var/lib/sorcery/modules/libtriggers
index a42c099..58950e8 100755
--- a/var/lib/sorcery/modules/libtriggers
+++ b/var/lib/sorcery/modules/libtriggers
@@ -74,7 +74,7 @@ function get_triggerees() {
[ -f $TRIGGER_LIST ] || return 0
for each in $3 ; do
grep "[^:]*:$spell:$event:$each" $TRIGGER_LIST|cut -f1 -d:
- done|sort|uniq|grep -v '^$'
+ done|sort -u|grep -v '^$'
}

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



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (df20dcd12fcfe75ef29536e7ff452e14756151c9), Jaka Kranjc, 03/27/2008

Archive powered by MHonArc 2.6.24.

Top of Page