[Lunar-commits] <lunar> Configurable xz compression

Peter de Ridder peter at lunar-linux.org
Tue Jun 11 07:50:30 CEST 2013


commit acf8a3ac066f29f4715f24507b122ab3ecf8008d
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Sat, 08 Jun 2013 10:50:19 -0700
URL: https://github.com/lunar-linux/lunar/commit/acf8a3ac066f29f4715f24507b122ab3ecf8008d

Configurable xz compression
---
  libs/logging.lunar  | +2/-2     
  libs/main.lunar     | +4/-4     
  libs/tracking.lunar | +3/-3     
  prog/lunar          | +12/-1    
  4 files changed, 21 insertions(+), 10 deletions(-)

--- 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.xz"  \
+           "${FILE_COLOR}$COMPILE_LOGS/$MODULE-$VERSION.${COMPRESS_METHOD:=xz}"  \
            "${DEFAULT_COLOR}"
 
-  xz -9f < $C_LOG > $COMPILE_LOGS/$MODULE-$VERSION.xz
+  ${COMPRESS_METHOD/bz2/bzip2} -9f < $C_LOG > $COMPILE_LOGS/$MODULE-$VERSION.${COMPRESS_METHOD}
   temp_destroy $C_LOG
   temp_destroy $C_FIFO
 }
--- a/libs/main.lunar
+++ b/libs/main.lunar
@@ -200,7 +200,7 @@ resurrect()  {
 
   CACHE_XZ=$(xzbz_file "$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar")
 
-  if [ -f "$CACHE_XZ" ] && xzbz -tf $CACHE_XZ ; then
+  if [ -f "$CACHE_XZ" ] && xzbz -t $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 &&
@@ -319,7 +319,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.xz "compile log" $MODULE $VERSION
+      report $COMPILE_LOGS/$MODULE-$VERSION.${COMPRESS_METHOD:-xz} "compile log" $MODULE $VERSION
       activity_log  "lin"  "$MODULE"  "$VERSION"  "failed" "Due to build errors during $LIN_ERROR"
       return 1
     fi
@@ -340,7 +340,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.xz "compile log" $MODULE $VERSION
+      report $COMPILE_LOGS/$MODULE-$VERSION.${COMPRESS_METHOD:-xz} "compile log" $MODULE $VERSION
       activity_log  "lin"  "$MODULE"  "$VERSION"  "failed" "Due to build errors during $LIN_ERROR"
       return 1
     fi
@@ -355,7 +355,7 @@ lin_module()  {
       sound FAILURE
       message "${PROBLEM_COLOR}! Problem detected${DEFAULT_COLOR}"
       rm -f $linING
-      report $COMPILE_LOGS/$MODULE-$VERSION.xz "compile log" $MODULE $VERSION
+      report $COMPILE_LOGS/$MODULE-$VERSION.${COMPRESS_METHOD:-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/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.xz"              >> $TMP_INST_LOG
+  echo "$COMPILE_LOGS/$MODULE-$VERSION.${COMPRESS_METHOD:-xz}" >> $TMP_INST_LOG
   echo "$MD5SUM_LOGS/$MODULE-$VERSION"                  >> $TMP_INST_LOG
 
   install -m644 $TMP_INST_LOG $INST_LOG
@@ -101,8 +101,8 @@ create_install_cache() {
     return
   fi
 
-  message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.xz${DEFAULT_COLOR}"
-  tar cPJf "$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.xz" --no-recursion -T $INSTALL_LOGS/$MODULE-$VERSION
+  message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.${COMPRESS_METHOD:=xz}${DEFAULT_COLOR}"
+  tar cP --no-recursion -T $INSTALL_LOGS/$MODULE-$VERSION | ${COMPRESS_METHOD/bz2/bzip2} > "$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.${COMPRESS_METHOD}"
 
 }
 
--- a/prog/lunar
+++ b/prog/lunar
@@ -526,6 +526,7 @@ feature_menu()  {
   W_HELP="Verbose display of compilation process?"
   X_HELP="When using --probe, also recompile modules if a newer version is available?"
   Z_HELP="Custom modules in zlocal override equally named ones (NOT RECOMMENDED) ?"
+  L_HELP="Use xz compression for logs and caches?"
 
          ARCHIVE=${ARCHIVE:-on}
    AUTORESURRECT=${AUTORESURRECT:-on}
@@ -549,6 +550,12 @@ feature_menu()  {
     *)   VOYEUR=on  ; VOYEUR_progress=off  ;;
   esac
 
+  case  $COMPRESS_METHOD  in
+    xz)  COMPRESS_XZ=on   ;;
+    bz2) COMPRESS_XZ=off  ;;
+    *)   COMPRESS_XZ=on   ;;
+  esac
+
   if  TOGGLES=`$DIALOG  --title "Feature Menu"  \
                         --no-cancel             \
                         --item-help             \
@@ -573,7 +580,8 @@ feature_menu()  {
       "REAP"             "Toggle"  "$REAP"          "$E_HELP"   \
       "VERBOSE"          "Toggle"  "$VERBOSE"       "$W_HELP"   \
       "ZLOCAL_OVERRIDES" "Toggle"  "$ZLOCAL_OVERRIDES" "$Z_HELP" \
-      "PROBE_EXPIRED"    "Toggle"  "$PROBE_EXPIRED" "$X_HELP"`
+      "PROBE_EXPIRED"    "Toggle"  "$PROBE_EXPIRED" "$X_HELP"   \
+      "COMPRESS_XZ"      "Toggle"  "$COMPRESS_XZ"   "$L_HELP"`
 
   then
   
@@ -594,6 +602,7 @@ feature_menu()  {
 	 VERBOSE=off
 ZLOCAL_OVERRIDES=off
    PROBE_EXPIRED=off
+ COMPRESS_METHOD=bz2
 
     for  TOGGLE  in  $TOGGLES;  do
       case  $TOGGLE  in
@@ -619,6 +628,7 @@ ZLOCAL_OVERRIDES=off
 	     VERBOSE)       VERBOSE=on  ;;
     ZLOCAL_OVERRIDES) ZLOCAL_OVERRIDES=on ;;
        PROBE_EXPIRED)  PROBE_EXPIRED=on ;;
+         COMPRESS_XZ) COMPRESS_METHOD=xz ;;
       esac
     done
 
@@ -639,6 +649,7 @@ ZLOCAL_OVERRIDES=off
     set_local_config "ZLOCAL_OVERRIDES" "$ZLOCAL_OVERRIDES"
     set_local_config "PROBE_EXPIRED" "$PROBE_EXPIRED"
     set_local_config "COLOR" "$COLOR"
+    set_local_config "COMPRESS_METHOD" "$COMPRESS_METHOD"
 
   fi
 }




More information about the Lunar-commits mailing list