summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0033-bootstrap-Use-gzip-instead-of-xz-compression.patch
blob: e7b176b90832e98146df1c63450671006f1ab93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Fri, 10 Jun 2016 22:30:29 +0200
Subject: [PATCH] bootstrap: Use gzip instead of xz compression.

bootstrap mksquashfs using qemu-user-static is extremely slow,
taking up to one hour. gzip, on the other hand, is reasonably fast.
According to [1], xz is slower, with not much size gain.

[1] https://jonathancarter.org/2015/04/06/squashfs-performance-testing/

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 .../post-scripts/80_prepare_cross_builds.sh           | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh b/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
index 3839d62..7ceaacc 100755
--- a/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
+++ b/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
@@ -27,6 +27,11 @@ if which dpkg > /dev/null 2>&1; then
       exit 1
     fi
 
+    # Determine python site-packages directory location
+    PYTHON_SITEPKGS_DIR=$(python -c \
+      "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
+    [ -d ${PYTHON_SITEPKGS_DIR} ] || exit 1
+
     # Cross-build timeout adjustments
     #
     # Since `execute_shell_command` mcagent is used for building the target
@@ -40,6 +45,20 @@ if which dpkg > /dev/null 2>&1; then
     # the maximum timeout value for mcagent has to be increased (use 2h).
     sed -i.bak -r 's/^(\s+:timeout\s*=>)\s*[[:digit:]]+$/\1 7200/' \
       /usr/libexec/mcollective/mcollective/agent/execute_shell_command.ddl
+
+    # Bootstrap: Use gzip instead of xz compression.
+    #
+    # bootstrap mksquashfs via `qemu-user-static` is extremely slow,
+    # taking up to one hour. gzip, on the other hand, is reasonably fast.
+
+    # See the following article for a comparison between gzip and xz
+    # https://jonathancarter.org/2015/04/06/squashfs-performance-testing/
+    # xz is slower, with very little size gain.
+    if [ -f ${PYTHON_SITEPKGS_DIR}/fuel_bootstrap/consts.py ]; then
+      sed -i.bak -r "s/^(\s+'compress_format'\s*:\s*').*?('.*)$/\1gzip\2/g" \
+        ${PYTHON_SITEPKGS_DIR}/fuel_bootstrap/consts.py
+      echo "INFO: [xz] => [gzip] updated bootstrap initrd / rootfs compression."
+    fi
   fi
 fi