sm-sorcery-bugs AT lists.ibiblio.org
Subject: Bugs for Sorcery are reported here
List archive
[Sm-Sorcery-Bugs] [Bug 2054] New: added gzip compression option
- From: bugzilla-daemon AT metalab.unc.edu
- To: sm-sorcery-bugs AT lists.ibiblio.org
- Subject: [Sm-Sorcery-Bugs] [Bug 2054] New: added gzip compression option
- Date: Mon, 30 Dec 2002 02:38:34 -0500
http://bugs.sourcemage.org/show_bug.cgi?id=2054
Summary: added gzip compression option
Product: Sorcery
Version: Devel
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Sorcery
AssignedTo: sm-sorcery-bugs AT lists.ibiblio.org
ReportedBy: sybex AT hotmail.com
Added a new option in the sorcery menu "Compression Type" with
options for bzip2 and gzip. This patch was made against the
Sorcery 20021212 devel branch. It patches the following files:
cast
dispel
gaze
sorcery
libsorcery
/etc/sorcery/config
This option will result in compressing all of the file in:
/var/cache/sorcery
/var/log/sorcery/compile
After talking with many sourcemage users it became evident that
many would benefit from a gzip compression option. Compressing
in bzip2 is many times slower than gzip while the benefits are
minimal. In my tests using gzip is several times faster and
compile logs are actually smaller! It appears that bzip2 is not
as efficient for smaller files due to the nature of the
compression algorithms, ie larger overhead.
let me know what you think.
-aaron
--- patch [sorcery-gzip.patch] follows ---
diff -Naur sorcery/etc/sorcery/config sorcery.sav/etc/sorcery/config
--- sorcery/etc/sorcery/config2002-10-07 02:38:46.000000000 +0000
+++ sorcery.sav/etc/sorcery/config2002-12-13 20:22:08.000000000 +0000
@@ -88,6 +88,8 @@
NET_SELECT=${NET_SELECT:=off}
MD5SUM_DL=${MD5SUM_DL:=off}
CLEAN_SOURCE=${CLEAN_SOURCE:=off}
+ COMPRESSBIN=${COMPRESSBIN:=bzip2}
+ EXTENSION=${EXTENSION:=bz2}
LDD_CHECK=${LDD_CHECK:=on}
FIND_CHECK=${FIND_CHECK:=on}
diff -Naur sorcery/usr/sbin/cast sorcery.sav/usr/sbin/cast
--- sorcery/usr/sbin/cast2002-12-02 21:00:09.000000000 +0000
+++ sorcery.sav/usr/sbin/cast2002-12-13 20:19:50.000000000 +0000
@@ -166,11 +166,11 @@
rack() {
- message "${MESSAGE_COLOR}Creating" \
- "${FILE_COLOR}$COMPILE_LOGS/$SPELL-$VERSION.bz2" \
+ message "${MESSAGE_COLOR}Creating" \
+ "${FILE_COLOR}$COMPILE_LOGS/$SPELL-$VERSION.$EXTENSION" \
"${DEFAULT_COLOR}"
- bzip2 -9f < $C_LOG > $COMPILE_LOGS/$SPELL-$VERSION.bz2
+ $COMPRESSBIN -9f < $C_LOG > $COMPILE_LOGS/$SPELL-$VERSION.$EXTENSION
rm $C_LOG
rm $C_FIFO
@@ -822,15 +822,15 @@
dispel $SPELL
fi
- CACHE_BZ="$INSTALL_CACHE/$SPELL-$VERSION-$BUILD.tar.bz2"
+ CACHE_COMP="$INSTALL_CACHE/$SPELL-$VERSION-$BUILD.tar.$EXTENSION"
- if [ -f $CACHE_BZ ] &&
- bzip2 -tf $CACHE_BZ
+ if [ -f $CACHE_COMP ] &&
+ $COMPRESSBIN -tf $CACHE_COMP
then
run_conflicts &&
satisfy_depends &&
- bzip2 -cd $CACHE_BZ | tar -Pkx 1>/dev/null 2>&1
+ $COMPRESSBIN -cd $CACHE_BZ | tar -Pkx 1>/dev/null 2>&1
run_post_install #bug 199
add_spell "$SPELL" "$STATUS" "$VERSION"
diff -Naur sorcery/usr/sbin/dispel sorcery.sav/usr/sbin/dispel
--- sorcery/usr/sbin/dispel2002-11-13 02:20:54.000000000 +0000
+++ sorcery.sav/usr/sbin/dispel2002-12-13 20:20:08.000000000 +0000
@@ -82,16 +82,16 @@
SPELL=$1
REQUESTED_VERSION=$2
- CACHE_BZ="$INSTALL_CACHE/$SPELL-$REQUESTED_VERSION-$BUILD.tar.bz2"
+
CACHE_COMP="$INSTALL_CACHE/$SPELL-$REQUESTED_VERSION-$BUILD.tar.$EXTENSION"
- if [ -e $CACHE_BZ ] &&
- bzip2 -tf $CACHE_BZ; then
+ if [ -e $CACHE_COMP ] &&
+ $COMPRESSBIN -tf $CACHE_COMP; then
if spell_installed $SPELL; then
dispel $SPELL
fi
- bzcat $CACHE_BZ | tar -Pkx 2>/dev/null
+ $COMPRESSBIN -cd $CACHE_COMP | tar -Pkx 2>/dev/null
codex_set_current_spell_by_name $SPELL
diff -Naur sorcery/usr/sbin/gaze sorcery.sav/usr/sbin/gaze
--- sorcery/usr/sbin/gaze2002-11-30 02:10:06.000000000 +0000
+++ sorcery.sav/usr/sbin/gaze2002-12-13 20:20:48.000000000 +0000
@@ -113,11 +113,11 @@
fi
done
- SNAPSHOT="/root/snapshot-$HOSTNAME-`date -u +%Y%m%d`.tar.bz2"
+ SNAPSHOT="/root/snapshot-$HOSTNAME-`date -u +%Y%m%d`.tar.$EXTENSION"
cd $BUILD_DIRECTORY
tar -c snapshot |
- bzip2 -9 > $SNAPSHOT
+ $COMPRESSBIN -9 > $SNAPSHOT
rm_source_dir $SOURCE_DIRECTORY
echo "$SNAPSHOT created."
@@ -134,7 +134,7 @@
cd $BUILD_DIRECTORY
mk_source_dir $SOURCE_DIRECTORY
- bzcat $SNAPSHOT | tar -x
+ $COMPRESSBIN -dc $SNAPSHOT | tar -x
cd $SOURCE_DIRECTORY
for LINE in `cat install`; do
@@ -297,8 +297,9 @@
if [ -f "$1" ]; then
case `file -b $1 | cut -d ' ' -f1` in
- ASCII) cat $1 | $PAGER ;;
- bzip2) bzcat $1 | $PAGER ;;
+ ASCII) cat $1 | $PAGER ;;
+ bzip2) bzcat $1 | $PAGER ;;
+ gzip) gzip -cd $1 | $PAGER ;;
esac
else
message "$2"
@@ -1061,7 +1062,7 @@
compile) if [ -z "$VERSION" ]; then
codex_set_current_spell_by_name $2
fi
- display $COMPILE_LOGS/$SPELL-$VERSION.bz2 \
+ display $COMPILE_LOGS/$SPELL-$VERSION.$EXTENSION \
"Compile log for $SPELL does not exist"
;;
diff -Naur sorcery/usr/sbin/sorcery sorcery.sav/usr/sbin/sorcery
--- sorcery/usr/sbin/sorcery2002-12-01 20:04:10.000000000 +0000
+++ sorcery.sav/usr/sbin/sorcery2002-12-13 20:21:20.000000000 +0000
@@ -231,6 +231,10 @@
bzcat $1 | $PAGER
+ elif [ "`file -b $1 | cut -d ' ' -f1`" == "gzip" ]; then
+
+ gzip -cd $1 | $PAGER
+
else
eval $DIALOG '--textbox $1 0 0'
@@ -878,6 +882,40 @@
}
+set_compression_type() {
+
+
+ while
+
+ B_HELP="bzip2 compression (slow, small files)"
+ G_HELP="gzip compression (fast, larger files)"
+
+ COMMAND=`eval $DIALOG ' --title "Currently using : $COMPRESSBIN " \
+ --item-help \
+ --ok-label "Select" \
+ --cancel-label "Exit" \
+ --menu \
+ "" \
+ 0 0 0 \
+ "B" "bzip2 compression" "$B_HELP" \
+ "G" "gzip compression" "$G_HELP"'`
+
+ do
+
+ case $COMMAND in
+
+ B) modify_local_config "COMPRESSBIN" "bzip2" &&
+ COMPRESSBIN="bzip2" &&
+ modify_local_config "EXTENSION" "bz2" ;;
+ G) modify_local_config "COMPRESSBIN" "gzip" &&
+ COMPRESSBIN="gzip" &&
+ modify_local_config "EXTENSION" "gz" ;;
+
+ esac
+
+ done
+
+}
#---------------------------------------------------------------------
##=item sorcery_set_jobs
@@ -1228,6 +1266,7 @@
J_HELP="Enter the number of jobs 'make' should run at the same time"
C_HELP="Setup distributed compilation"
R_HELP="Enter the maximum rate for downloading"
+ T_HELP="Select compression program for logs and archives"
COMMAND=`eval $DIALOG ' --title "Option Menu" \
@@ -1246,7 +1285,8 @@
"J" "Number of \"make\" Jobs" "$J_HELP" \
"C" "Distributed compilation" "$C_HELP" \
"M" "Software Mirrors" "$M_HELP" \
- "O" "Optimize Architecture" "$O_HELP"'`
+ "O" "Optimize Architecture" "$O_HELP" \
+ "T" "Compression Type" "$T_HELP"'`
do
@@ -1262,6 +1302,7 @@
C) sorcery_distcc ;;
M) mirror_menu ;;
O) optimize_architecture ;;
+ T) set_compression_type ;;
esac
diff -Naur sorcery/var/lib/sorcery/modules/libsorcery
sorcery.sav/var/lib/sorcery/modules/libsorcery
--- sorcery/var/lib/sorcery/modules/libsorcery2002-12-01 21:21:10.000000000
+0000
+++ sorcery.sav/var/lib/sorcery/modules/libsorcery2002-12-13
20:30:50.000000000 +0000
@@ -437,12 +437,12 @@
"${MESSAGE_COLOR} and recovering${DEFAULT_COLOR}"
CURRENT_VERSION=$(installed_version $SPELL)
- CACHE_BZ="$INSTALL_CACHE/$SPELL-$CURRENT_VERSION-$BUILD.tar.bz2"
+ CACHE_COMP="$INSTALL_CACHE/$SPELL-$CURRENT_VERSION-$BUILD.tar.$EXTENSION"
- if [ -e $CACHE_BZ ] &&
- bzip2 -tf $CACHE_BZ; then
+ if [ -e $CACHE_COMP ] &&
+ $COMPRESSBIN -tf $CACHE_COMP; then
- bzcat $CACHE_BZ | tar -Pkx 2>/dev/null
+ $COMPRESSBIN -cd $CACHE_COMP | tar -Pkx 2>/dev/null
add_spell $SPELL installed $CURRENT_VERSION
fi
@@ -1099,7 +1099,7 @@
SPELL=`echo $LINE | cut -d : -f1`
VER=`echo $LINE | cut -d : -f4`
echo "$SPELL-$VER"
- echo "$SPELL-$VER.bz2"
+ echo "$SPELL-$VER.$EXTENSION"
done
}
@@ -1339,7 +1339,7 @@
filter "$LOCAL_EXCLUDED" |
exists > $TMP_LOG
- echo "$C_LOG_BZ" >> $TMP_LOG
+ echo "$C_LOG_COMP" >> $TMP_LOG
echo "$MD5_LOG" >> $TMP_LOG
echo "$INST_LOG" >> $TMP_LOG
@@ -1359,8 +1359,8 @@
#---------------------------------------------------------------------
##=item archive
##
-## Creates a bzip'ed tar file containing an archived backup of every
-## file installed by a spell.
+## Creates a bzip/gzip'ed tar file containing an archived backup of
+## every file installed by a spell.
##
#---------------------------------------------------------------------
archive() {
@@ -1408,8 +1408,8 @@
done
- message "${MESSAGE_COLOR}Creating
${FILE_COLOR}${CACHE_BZ}${DEFAULT_COLOR}"
- bzip2 -9f < $CACHE > $CACHE_BZ
+ message "${MESSAGE_COLOR}Creating
${FILE_COLOR}${CACHE_COMP}${DEFAULT_COLOR}"
+ $COMPRESSBIN -9f < $CACHE > $CACHE_COMP
rm -f $CACHE
}
@@ -1429,8 +1429,8 @@
debug "libsorcery" "Running boost() on $SPELL"
CACHE="/tmp/$SPELL-$VERSION-$BUILD.tar"
- CACHE_BZ="$INSTALL_CACHE/$SPELL-$VERSION-$BUILD.tar.bz2"
- C_LOG_BZ="$COMPILE_LOGS/$SPELL-$VERSION.bz2"
+CACHE_COMP="$INSTALL_CACHE/$SPELL-$VERSION-$BUILD.tar.$EXTENSION"
+C_LOG_COMP="$COMPILE_LOGS/$SPELL-$VERSION.$EXTENSION"
TMP_LOG="/tmp/$SPELL-$VERSION"
INST_LOG="$INSTALL_LOGS/$SPELL-$VERSION"
MD5_LOG="$MD5SUM_LOGS/$SPELL-$VERSION"
@@ -1551,7 +1551,7 @@
(
codex_set_current_spell $SPELL_DIRECTORY
sources $SPELL
- echo $SPELL-$VERSION-$BUILD.tar.bz2
+ echo $SPELL-$VERSION-$BUILD.tar.$EXTENSION
)
done
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
- [Sm-Sorcery-Bugs] [Bug 2054] New: added gzip compression option, bugzilla-daemon, 12/30/2002
Archive powered by MHonArc 2.6.24.