This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] use gzip compression with --no-name to create identicals steps backups


# HG changeset patch
# User Bruno Tarquini <btarquini@gmail.com>
# Date 1268929495 -3600
# Node ID 2bee3a840078d91cf31ae7342a2ed0aad5da2d5a
# Parent  2abad517a563df3b624d2d80e5d67ba1d0f14d0e
use gzip compression with --no-name to create identicals steps backups.
So backups created from an identical directory are really identicals.

Calling gzip by passing '-z' to tar is not good enough: by default, gzip
saves the archive's mtime as metadata (--name) and preventing us to generate
the exact same state when no files have been modified between the two steps.

Later, by removing the duplicates files, it will be possible to
decreasing the backup directory to around 20% of it actual size.

At the same time, we pass -3 to gzip as it is said in Kbuild help.

diff --git a/scripts/functions b/scripts/functions
--- a/scripts/functions
+++ b/scripts/functions
@@ -916,11 +916,6 @@
     rm -rf "${state_dir}"
     mkdir -p "${state_dir}"
 
-    case "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" in
-        y)  tar_opt=z; tar_ext=.gz;;
-        *)  tar_opt=;  tar_ext=;;
-    esac
-
     CT_DoLog DEBUG "  Saving environment and aliases"
     # We must omit shell functions, and some specific bash variables
     # that break when restoring the environment, later. We could do
@@ -936,22 +931,33 @@
 
     CT_DoLog DEBUG "  Saving CT_CONFIG_DIR='${CT_CONFIG_DIR}'"
     CT_Pushd "${CT_CONFIG_DIR}"
-    CT_DoExecLog DEBUG tar cv${tar_opt}f "${state_dir}/config_dir.tar${tar_ext}" .
+    # Calling gzip by passing '-z' to tar is not good enough: by default, gzip
+    # saves the archive's mtime as metadata, preventing us to generate
+    # the exact same state when no file have been modified between the two steps
+    CT_DoExecLog DEBUG tar cvf "${state_dir}/config_dir.tar" .
+    [ "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" = "y" ] && \
+        CT_DoExecLog DEBUG gzip -3 --force --no-name "${state_dir}/config_dir.tar"
     CT_Popd
 
     CT_DoLog DEBUG "  Saving CT_CC_CORE_STATIC_PREFIX_DIR='${CT_CC_CORE_STATIC_PREFIX_DIR}'"
     CT_Pushd "${CT_CC_CORE_STATIC_PREFIX_DIR}"
-    CT_DoExecLog DEBUG tar cv${tar_opt}f "${state_dir}/cc_core_static_prefix_dir.tar${tar_ext}" .
+    CT_DoExecLog DEBUG tar cvf "${state_dir}/cc_core_static_prefix_dir.tar" .
+    [ "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" = "y" ] && \
+        CT_DoExecLog DEBUG gzip -3 --force --no-name "${state_dir}/cc_core_static_prefix_dir.tar"
     CT_Popd
 
     CT_DoLog DEBUG "  Saving CT_CC_CORE_SHARED_PREFIX_DIR='${CT_CC_CORE_SHARED_PREFIX_DIR}'"
     CT_Pushd "${CT_CC_CORE_SHARED_PREFIX_DIR}"
-    CT_DoExecLog DEBUG tar cv${tar_opt}f "${state_dir}/cc_core_shared_prefix_dir.tar${tar_ext}" .
+    CT_DoExecLog DEBUG tar cvf "${state_dir}/cc_core_shared_prefix_dir.tar" .
+    [ "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" = "y" ] && \
+        CT_DoExecLog DEBUG gzip -3 --force --no-name "${state_dir}/cc_core_shared_prefix_dir.tar"
     CT_Popd
 
     CT_DoLog DEBUG "  Saving CT_PREFIX_DIR='${CT_PREFIX_DIR}'"
     CT_Pushd "${CT_PREFIX_DIR}"
-    CT_DoExecLog DEBUG tar cv${tar_opt}f "${state_dir}/prefix_dir.tar${tar_ext}" --exclude '*.log' .
+    CT_DoExecLog DEBUG tar cvf "${state_dir}/prefix_dir.tar" --exclude '*.log' .
+    [ "${CT_DEBUG_CT_SAVE_STEPS_GZIP}" = "y" ] && \
+        CT_DoExecLog DEBUG gzip -3 --force --no-name "${state_dir}/prefix_dir.tar"
     CT_Popd
 
     if [ "${CT_LOG_TO_FILE}" = "y" ]; then

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]