[Lunar-commits] <lunar> Use xz for compile logs
Peter de Ridder
peter at lunar-linux.org
Sun Jan 6 01:48:29 CET 2013
commit b14c8d6beb4a890f30c5cbccd93671adf6d219db
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Sat, 05 Jan 2013 16:48:29 -0800
URL: https://github.com/lunar-linux/lunar/commit/b14c8d6beb4a890f30c5cbccd93671adf6d219db
Use xz for compile logs
---
libs/download.lunar | +3/-0
libs/logging.lunar | +5/-5
libs/main.lunar | +5/-13
libs/misc.lunar | +26/-6
libs/prune.lunar | +4/-4
libs/tracking.lunar | +1/-1
libs/view.lunar | +1/-1
prog/lrm | +4/-12
prog/lunar | +4/-5
prog/lvu | +5/-4
10 files changed, 58 insertions(+), 51 deletions(-)
--- a/libs/download.lunar
+++ b/libs/download.lunar
@@ -184,6 +184,9 @@ testpack () {
*.CAB|*.cab)
echo $FILEMAGIC | grep -qw "Cabinet"
;;
+ *.xz|*.XZ)
+ echo $FILEMAGIC | grep -qw "XZ"
+ ;;
*)
# we don't know how to handle this type of file
true
--- a/libs/logging.lunar
+++ b/libs/logging.lunar
@@ -29,10 +29,10 @@ stop_logging() {
echo > $C_FIFO
echo "++ Mark Compile stop : \"$MODULE\" \"$VERSION\" \"$(date -Ru)\"" >> $C_LOG
message "${MESSAGE_COLOR}Creating" \
- "${FILE_COLOR}$COMPILE_LOGS/$MODULE-$VERSION.bz2" \
+ "${FILE_COLOR}$COMPILE_LOGS/$MODULE-$VERSION.xz" \
"${DEFAULT_COLOR}"
- bzip2 -9f < $C_LOG > $COMPILE_LOGS/$MODULE-$VERSION.bz2
+ xz -9f < $C_LOG > $COMPILE_LOGS/$MODULE-$VERSION.xz
temp_destroy $C_LOG
temp_destroy $C_FIFO
}
@@ -40,13 +40,13 @@ stop_logging() {
progress() {
local OLDLOG OLDSZ S PC
- OLDLOG=$(ls -1d $COMPILE_LOGS/$MODULE-*.bz2 2>&- | head -n 1)
+ OLDLOG=$(ls -1d $COMPILE_LOGS/$MODULE-*.{xz,bz2} 2>&- | head -n 1)
STIME=$(date +%s)
if [[ -f $OLDLOG ]]; then
X="############################################################"
Y=" "
- OLDSZ=$(bzcat $OLDLOG | wc -c)
- OLDTIMES=($(bzcat $OLDLOG | grep 'Mark Compile ' | cut -d \" -f6 | while read TIME ; do date +%s -d "$TIME" ; done))
+ OLDSZ=$(xzbz -dc $OLDLOG | wc -c)
+ OLDTIMES=($(xzbz -dc $OLDLOG | grep 'Mark Compile ' | cut -d \" -f6 | while read TIME ; do date +%s -d "$TIME" ; done))
CTIME=$((${OLDTIMES[1]} - ${OLDTIMES[0]}))
echo "Last compile time: $((CTIME / 60))m$((CTIME % 60))s"
while true ; do
--- a/libs/main.lunar
+++ b/libs/main.lunar
@@ -198,17 +198,9 @@ resurrect() {
lrm --keepconfig $MODULE
fi &&
- CACHE_XZ="$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.xz"
- XZBZ=xz
- if [ ! -f "$CACHE_XZ" ] ; then
- CACHE_BZ="$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.bz2"
- if [ -f "$CACHE_BZ" ] ; then
- CACHE_XZ="$CACHE_BZ"
- XZBZ=bzip2
- fi
- fi
+ CACHE_XZ=$(xzbz_file "$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar")
- if [ -f "$CACHE_XZ" ] && $XZBZ -tf $CACHE_XZ ; then
+ if [ -f "$CACHE_XZ" ] && xzbz -tf $CACHE_XZ ; then
message "${RESURRECT_COLOR}Resurrecting ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR} ${MESSAGE_COLOR}version ${VERSION_COLOR}${VERSION}${DEFAULT_COLOR}"
expand_cache_safe $CACHE_XZ &&
add_module $MODULE $STATUS $VERSION &&
@@ -324,7 +316,7 @@ lin_module() {
sound FAILURE
message "${PROBLEM_COLOR}! Problem detected during ${FILE_COLOR}$LIN_ERROR${DEFAULT_COLOR}"
rm -f $linING
- report $COMPILE_LOGS/$MODULE-$VERSION.bz2 "compile log" $MODULE $VERSION
+ report $COMPILE_LOGS/$MODULE-$VERSION.xz "compile log" $MODULE $VERSION
activity_log "lin" "$MODULE" "$VERSION" "failed" "Due to build errors during $LIN_ERROR"
return 1
fi
@@ -345,7 +337,7 @@ lin_module() {
sound FAILURE
message "${PROBLEM_COLOR}! Problem detected during ${FILE_COLOR}$LIN_ERROR${DEFAULT_COLOR}"
rm -f $linING
- report $COMPILE_LOGS/$MODULE-$VERSION.bz2 "compile log" $MODULE $VERSION
+ report $COMPILE_LOGS/$MODULE-$VERSION.xz "compile log" $MODULE $VERSION
activity_log "lin" "$MODULE" "$VERSION" "failed" "Due to build errors during $LIN_ERROR"
return 1
fi
@@ -360,7 +352,7 @@ lin_module() {
sound FAILURE
message "${PROBLEM_COLOR}! Problem detected${DEFAULT_COLOR}"
rm -f $linING
- report $COMPILE_LOGS/$MODULE-$VERSION.bz2 "compile log" $MODULE $VERSION
+ report $COMPILE_LOGS/$MODULE-$VERSION.xz "compile log" $MODULE $VERSION
activity_log "lin" "$MODULE" "$VERSION" "failed" "Due to build errors during or after $LIN_ERROR"
return 1
fi
--- a/libs/misc.lunar
+++ b/libs/misc.lunar
@@ -204,12 +204,6 @@ custom_filters()
}
-source_basename()
-{
- echo $1 | sed 's/.tar.\(bz2\|gz\)$//g'
-}
-
-
last_kernel()
{
if [ -f /usr/src/linux/include/linux/utsrelease.h ]; then
@@ -218,3 +212,29 @@ last_kernel()
grep UTS_RELEASE /usr/src/linux/include/linux/version.h | cut -d'"' -f2
fi
}
+
+
+xzbz_file()
+{
+ local FILE FILE_BZ
+ FILE="$1.xz"
+ if [ ! -f $FILE ] ; then
+ FILE_BZ="$1.bz2"
+ if [ -f $FILE_BZ ] ; then
+ FILE="$FILE_BZ"
+ fi
+ fi
+ echo $FILE
+}
+
+xzbz()
+{
+ local XZBZ
+ case $(file -b $2 | cut -d' ' -f1) in
+ bzip2) XZBZ=bzip2 ;;
+ gzip) XZBZ=gzip ;;
+ XZ) XZBZ=xz ;;
+ *) XZBZ=xz ;;
+ esac
+ $XZBZ "$@"
+}
--- a/libs/prune.lunar
+++ b/libs/prune.lunar
@@ -70,10 +70,10 @@ prune() {
done
verbose_msg "finding stale compile logs"
- for FILE in $(ls -1 $COMPILE_LOGS | sed "s/\.bz2//") ; do
- if ! echo -e "$LOGS" | grep -q $FILE ; then
- message "Removing stale log: $COMPILE_LOGS/$FILE.bz2"
- rm $COMPILE_LOGS/$FILE.bz2
+ for FILE in $(ls -1 $COMPILE_LOGS) ; do
+ if ! echo -e "$LOGS" | grep -q $(echo $FILE | sed "s/\.\(xz\|bz2\)$//") ; then
+ message "Removing stale log: $COMPILE_LOGS/$FILE"
+ rm $COMPILE_LOGS/$FILE
fi
done
--- a/libs/tracking.lunar
+++ b/libs/tracking.lunar
@@ -75,7 +75,7 @@ create_install_log() {
parse_iw | sort | uniq | filter "$LOCAL_EXCLUDED" | custom_filters | exists > $TMP_INST_LOG
echo "$INSTALL_LOGS/$MODULE-$VERSION" >> $TMP_INST_LOG
- echo "$COMPILE_LOGS/$MODULE-$VERSION.bz2" >> $TMP_INST_LOG
+ echo "$COMPILE_LOGS/$MODULE-$VERSION.xz" >> $TMP_INST_LOG
echo "$MD5SUM_LOGS/$MODULE-$VERSION" >> $TMP_INST_LOG
MISOWNED_SYMLINKS=$(syms_not_owned $TMP_INST_LOG
--- a/libs/view.lunar
+++ b/libs/view.lunar
@@ -15,7 +15,7 @@ view_file() {
case $(file -b $1 | cut -d' ' -f1) in
bzip2) bzcat $1 | ${PAGER:-less} ;;
gzip) zcat $1 | ${PAGER:-less} ;;
- xz) xzcat $1 | ${PAGER:-less} ;;
+ XZ) xzcat $1 | ${PAGER:-less} ;;
*)
# default fallback
cat "$1" | ${PAGER:-less} ;;
--- a/prog/lrm
+++ b/prog/lrm
@@ -240,7 +240,7 @@ check_status() {
downgrade() {
- local CACHE_XZ XZBZ
+ local CACHE_XZ
# a local function for listing the contents of install cache
list_available_cache() {
@@ -261,15 +261,7 @@ downgrade() {
list_available_cache
fi
- CACHE_XZ="$INSTALL_CACHE/$MODULE-$1-$BUILD.tar.xz"
- XZBZ=xzcat
- if [ ! -f $CACHE_XZ ] ; then
- CACHE_BZ="$INSTALL_CACHE/$MODULE-$1-$BUILD.tar.bz"
- if [ -f $CACHE_BZ ] ; then
- CACHE_XZ="$CACHE_BZ"
- XZBZ=bzcat
- fi
- fi
+ CACHE_XZ=$(xzbz_file "$INSTALL_CACHE/$MODULE-$1-$BUILD.tar")
if [ ! -s $CACHE_XZ ] ; then
message "Desired version is not available. Here is the available files"
@@ -297,10 +289,10 @@ downgrade() {
verbose_msg "installing \"$MODULE-$1\""
verbose_msg "extracting cached install file..."
- $XZBZ $CACHE_XZ | tar -kt $TAR_P -C / >/dev/null
+ xzbz -dc $CACHE_XZ | tar -kt $TAR_P -C / >/dev/null
verbose_msg "adding module to installed list"
- $XZBZ $CACHE_XZ | tar -kx $TAR_P -C / 2>/dev/null >/dev/null
+ xzbz -dc $CACHE_XZ | tar -kx $TAR_P -C / 2>/dev/null >/dev/null
verbose_msg "adding module to installed list"
add_module $MODULE installed $1
activity_log "lrm downgrade" "$MODULE" "$1" "success"
--- a/prog/lunar
+++ b/prog/lunar
@@ -136,11 +136,10 @@ add_pkgs() { (
show_file() {
if [ -f $1 ]; then
- if [ "`file -b $1 | cut -d ' ' -f1`" == "bzip2" ]; then
- bzcat $1 | view_file
- else
- $DIALOG --textbox $1 10 0
- fi
+ case `file -b $1 | cut -d ' ' -f1` in
+ bzip2|gzip|XZ) view_file $1 ;;
+ *) $DIALOG --textbox $1 10 0 ;;
+ esac
else
$DIALOG --msgbox "File not found." 0 0
return 1
--- a/prog/lvu
+++ b/prog/lvu
@@ -1535,11 +1535,12 @@ main() {
compile)
if [ ! -z "$2" ]; then
if run_details $2 ; then
- if [ -f $COMPILE_LOGS/$2-$(module_version $2).bz2 ] ; then
- view_file "$COMPILE_LOGS/$2-$(module_version $2).bz2"
+ LOG_FILE=$(xzbz_file "$COMPILE_LOGS/$2-$(module_version $2)")
+ if [ -f "$LOG_FILE" ] ; then
+ view_file "$LOG_FILE"
else
- VERSION=$(installed_version $2)
- view_file "$COMPILE_LOGS/$2-$(installed_version $2).bz2" \
+ LOG_FILE=$(xzbz_file "$COMPILE_LOGS/$2-$(installed_version $2)")
+ view_file "$LOG_FILE" \
"Compile log for $2 does not exist"
fi
fi
More information about the Lunar-commits
mailing list