Report debuginfo size in kilobytes
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Oct 2018 10:41:45 +0000 (13:41 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 1 Oct 2018 10:41:45 +0000 (13:41 +0300)
By standard, 'du' defaults to 512 byte units, but this differs between
implementations: GNU du defaults to 1024 unless POSIXLY_CORRECT is set
and also allows overriding via number of environment variables. It also
supports various other ways of controlling the block size, but the
only standard means to control the size is -k, and we really don't
want to break portability for the sake of FYI statistics.

Inspired by Marxim Liska's patch at in #554.

scripts/find-debuginfo.sh

index 51cea86668b17d7c0ce61cb840c7b9f886f319a8..967814509bbe36774e626a09a6b65e644a9aa35e 100755 (executable)
@@ -486,7 +486,7 @@ if $run_dwz \
    && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then
   readarray dwz_files < <(cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug | LC_ALL=C sort)
   if [ ${#dwz_files[@]} -gt 0 ]; then
-    size_before=$(du -s ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
+    size_before=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
     dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}"
     dwz_multifile_suffix=
     dwz_multifile_idx=0
@@ -509,8 +509,8 @@ if $run_dwz \
       echo >&2 "*** ERROR: DWARF compression requested, but no dwz installed"
       exit 2
     fi
-    size_after=$(du -s ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
-    echo "original debug info size: ${size_before}, size after compression: ${size_after}"
+    size_after=$(du -sk ${RPM_BUILD_ROOT}/usr/lib/debug | cut -f1)
+    echo "original debug info size: ${size_before}kB, size after compression: ${size_after}kB"
     # Remove .dwz directory if empty
     rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null
     if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then
This page took 0.057153 seconds and 5 git commands to generate.