Merge "Revert "EFI: Move patches to Fuel@OPNFV, upstream prep""
[armband.git] / patches / opnfv-fuel / 0033-bootstrap-Use-gzip-instead-of-xz-compression.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Fri, 10 Jun 2016 22:30:29 +0200
3 Subject: [PATCH] bootstrap: Use gzip instead of xz compression.
4
5 bootstrap mksquashfs using qemu-user-static is extremely slow,
6 taking up to one hour. gzip, on the other hand, is reasonably fast.
7 According to [1], xz is slower, with not much size gain.
8
9 [1] https://jonathancarter.org/2015/04/06/squashfs-performance-testing/
10
11 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
12 ---
13  .../post-scripts/80_prepare_cross_builds.sh           | 19 +++++++++++++++++++
14  1 file changed, 19 insertions(+)
15
16 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
17 index 3839d62..7ceaacc 100755
18 --- a/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
19 +++ b/build/f_isoroot/f_bootstrap/post-scripts/80_prepare_cross_builds.sh
20 @@ -27,6 +27,11 @@ if which dpkg > /dev/null 2>&1; then
21        exit 1
22      fi
23  
24 +    # Determine python site-packages directory location
25 +    PYTHON_SITEPKGS_DIR=$(python -c \
26 +      "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
27 +    [ -d ${PYTHON_SITEPKGS_DIR} ] || exit 1
28 +
29      # Cross-build timeout adjustments
30      #
31      # Since `execute_shell_command` mcagent is used for building the target
32 @@ -40,6 +45,20 @@ if which dpkg > /dev/null 2>&1; then
33      # the maximum timeout value for mcagent has to be increased (use 2h).
34      sed -i.bak -r 's/^(\s+:timeout\s*=>)\s*[[:digit:]]+$/\1 7200/' \
35        /usr/libexec/mcollective/mcollective/agent/execute_shell_command.ddl
36 +
37 +    # Bootstrap: Use gzip instead of xz compression.
38 +    #
39 +    # bootstrap mksquashfs via `qemu-user-static` is extremely slow,
40 +    # taking up to one hour. gzip, on the other hand, is reasonably fast.
41 +
42 +    # See the following article for a comparison between gzip and xz
43 +    # https://jonathancarter.org/2015/04/06/squashfs-performance-testing/
44 +    # xz is slower, with very little size gain.
45 +    if [ -f ${PYTHON_SITEPKGS_DIR}/fuel_bootstrap/consts.py ]; then
46 +      sed -i.bak -r "s/^(\s+'compress_format'\s*:\s*').*?('.*)$/\1gzip\2/g" \
47 +        ${PYTHON_SITEPKGS_DIR}/fuel_bootstrap/consts.py
48 +      echo "INFO: [xz] => [gzip] updated bootstrap initrd / rootfs compression."
49 +    fi
50    fi
51  fi
52