Skip to Content.
Sympa Menu

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

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 (550cb6ccfb8a785bb27efabca6853d85e9efad1d)
  • Date: Fri, 28 Mar 2008 08:04:39 -0500

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

ChangeLog | 1
usr/sbin/gaze | 51
++++++++++++++++++++++++++++++++++++++++++++++
usr/share/man/man1/gaze.1 | 5 ++--
3 files changed, 55 insertions(+), 2 deletions(-)

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

gaze, gaze.1: added size -all, initial patch from Danilo Vidovic #13556

diff --git a/ChangeLog b/ChangeLog
index 609e424..98a6e85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
* api2: added some more messages to cast stages, initial patch from
Sergey
Lipnevich #8521
* libgrimoire: real_rm_source_dir: use local variables and a simpler
loop
+ * gaze, gaze.1: added size -all, initial patch from Danilo Vidovic
#13556

2008-03-27 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* changed uses of plain sort|uniq to the featurewise equivalent sort
-u
diff --git a/usr/sbin/gaze b/usr/sbin/gaze
index 8a62c53..76a8962 100755
--- a/usr/sbin/gaze
+++ b/usr/sbin/gaze
@@ -58,6 +58,8 @@ sum [spell] Prints checksums.
md5sum [spell] Prints md5sums.
size spell Prints total size of all files installed
by this spell
+size -all Prints total size of all spells, as well
+ as size of the largest spell
export Makes snapshot of box's configuration.
import snapshot Restores snapshot.

@@ -1629,6 +1631,45 @@ function gaze_show_dependencies() {

#-----
##
+## Display the size all installed spell use and the largest among them
+##
+#-----
+function gaze_show_size_all () {
+ local each date status version install_log
+ local current_spell=0 current_size=0 current_info
+ local max_size=0 max_spell total_size=0 total_files=0
+ local installed_spells=$(all_spell_status | sed -n '/:exiled:/! s,:, ,gp')
+ local spell_count=$(wc -l <<< "$installed_spells")
+
+ echo "This will take a while and cause lots of disk I/O..."
+ while read each date status version; do
+ let current_spell++
+ install_log="$INSTALL_LOGS/$each-$version"
+ current_info=$(
+ while read entry; do
+ test -f "$entry" && echo "'$entry'"
+ done < $install_log | xargs du -b -c | awk 'END {print $1,NR-1}'
+ )
+ current_info=( $current_info )
+ current_size=${current_info[0]}
+ if [[ $current_size -gt $max_size ]]; then
+ max_size=$current_size
+ max_spell=$each
+ fi
+ let total_size+=$current_size
+ let total_files+=${current_info[1]}
+ progress_bar $current_spell $spell_count
+ done <<< "$installed_spells"
+ clear_line
+ echo $spell_count $total_size $total_files | awk \
+ 'END { print $1" spells -> "$2" bytes ("int($2/1024+0.5)" K,
"int($2/1024/1024+0.5)" M, "int($2/1024/1024/1024+0.5)" G) in "$3" files." }'
+ echo
+ echo "Largest spell:"
+ gaze_show_size $max_spell
+}
+
+#-----
+##
## Display the space an installed spell uses
## @param Spell
## @param ...
@@ -1636,6 +1677,16 @@ function gaze_show_dependencies() {
#-----
function gaze_show_size () {
local spell each
+
+ if [[ $1 == "-all" ]]; then
+ if [[ $# == 1 ]]; then
+ gaze_show_size_all
+ else
+ help
+ fi
+ exit 0
+ fi
+
for spell in "$@"; do
if ! spell_ok $spell ; then
message "$spell is not installed"
diff --git a/usr/share/man/man1/gaze.1 b/usr/share/man/man1/gaze.1
index 1af5a97..13dd4d7 100644
--- a/usr/share/man/man1/gaze.1
+++ b/usr/share/man/man1/gaze.1
@@ -144,9 +144,10 @@ print CRC checksums for spells(s). If no spell is given
it default to all.
print spell MD5 message digests (fingerprints). If no spell is given it
default
to all
.PP
-.SS size <spell>
+.SS size <spell>|-all
.IP
-print the size of the installed spell(s).
+print the sizes and file counts of the passed installed spell(s) or if -all
is
+specified, of all the spells. In addition, this will print the largest spell.
.PP
.SS export
.IP



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

Archive powered by MHonArc 2.6.24.

Top of Page