[pacman-dev] [MAKEPKG][PATCH] makepkg-do-not-count-hard-links-multiple-times
Uses stat -c '%i %s' and sort -u to count hardlink one time. Gives same result than cat | wc -c without harlinks and good result with hardlinks. Doesn't use filenames
Uses stat -c '%i %s' and sort -u to count hardlink one time. Gives same result than cat | wc -c without harlinks and good result with hardlinks. Doesn't use filenames
From cf4ef0333ccc6f080882ee9f3c27049be41bce67 Mon Sep 17 00:00:00 2001 From: nenesse
Date: Sun, 27 Oct 2019 12:08:36 +0100 Subject: [PATCH] makepkg-do-not-count-hard-links-multiple-times. uses stat -c '%i %s' and sort -u to count hardlink one time. Gives same result than cat | wc -c without harlinks and good result with hardlinks. Doesn't use filenames To: mailto:pacman-dev@archlinux.org
---
configure.ac | 6 ++---
scripts/libmakepkg/util/dirsize.sh.in | 35 +++++++++++++++++++++++++++
scripts/makepkg.sh.in | 2 +-
3 files changed, 39 insertions(+), 4 deletions(-)
create mode 100644 scripts/libmakepkg/util/dirsize.sh.in
diff --git a/configure.ac b/configure.ac
index d68b3591..5d8f8747 100644
--- a/configure.ac
+++ b/configure.ac
@@ -370,18 +370,18 @@ GCC_VISIBILITY_CC
# Host-dependant definitions
DEFAULT_SEDINPLACEFLAGS=" --follow-symlinks -i"
-INODECMD="stat -c '%i %n'"
+INODECMD="stat -c '%i %s'"
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
case "${host_os}" in
*bsd*)
- INODECMD="stat -f '%i %N'"
+ INODECMD="stat -f '%i %z'"
DEFAULT_SEDINPLACEFLAGS=" -i \"\""
;;
darwin*)
host_os_darwin=yes
- INODECMD="/usr/bin/stat -f '%i %N'"
+ INODECMD="/usr/bin/stat -f '%i %z'"
DEFAULT_SEDINPLACEFLAGS=" -i ''"
STRIP_BINARIES=""
STRIP_SHARED="-S"
diff --git a/scripts/libmakepkg/util/dirsize.sh.in b/scripts/libmakepkg/util/dirsize.sh.in
new file mode 100644
index 00000000..a0bd2b3f
--- /dev/null
+++ b/scripts/libmakepkg/util/dirsize.sh.in
@@ -0,0 +1,35 @@
+#!/usr/bin/bash
+#
+# dirsize.sh - calculate size of all files in a directory
+#
+# Copyright (c) 2019 Pacman Development Team
On 27/10/19 10:26 pm, la.luge@free.fr wrote:
Uses stat -c '%i %s' and sort -u to count hardlink one time. Gives same result than cat | wc -c without harlinks and good result with hardlinks. Doesn't use filenames
From cf4ef0333ccc6f080882ee9f3c27049be41bce67 Mon Sep 17 00:00:00 2001 From: nenesse
Date: Sun, 27 Oct 2019 12:08:36 +0100 Subject: [PATCH] makepkg-do-not-count-hard-links-multiple-times. uses stat -c '%i %s' and sort -u to count hardlink one time. Gives same result than cat | wc -c without harlinks and good result with hardlinks. Doesn't use filenames To: mailto:pacman-dev@archlinux.org --- configure.ac | 6 ++--- scripts/libmakepkg/util/dirsize.sh.in | 35 +++++++++++++++++++++++++++ scripts/makepkg.sh.in | 2 +- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 scripts/libmakepkg/util/dirsize.sh.in
diff --git a/configure.ac b/configure.ac index d68b3591..5d8f8747 100644 --- a/configure.ac +++ b/configure.ac @@ -370,18 +370,18 @@ GCC_VISIBILITY_CC
# Host-dependant definitions DEFAULT_SEDINPLACEFLAGS=" --follow-symlinks -i" -INODECMD="stat -c '%i %n'" +INODECMD="stat -c '%i %s'"
So... I'm assuming you did not look at where else INODECMD is used in the code base?
participants (2)
-
Allan McRae
-
la.luge@free.fr