I noticed in 1 rpm, there was a comment next to an %fdupes line -- which I guess is a macro(?) saying: # Hardlink duplicate files %fdupes ${RPM_BUILD_ROOT} Is it still used for purposes of hardlinking dupes? If so, how does that work? when I looked at fdupes, I didn't see an option to hardlink dups, only options to delete dups. Anyway, would it be useful if that was about 40% faster?
On Thu, 2021-03-18 at 00:12 -0700, L A Walsh wrote:
I noticed in 1 rpm, there was a comment next to an %fdupes line -- which I guess is a macro(?) saying:
# Hardlink duplicate files %fdupes ${RPM_BUILD_ROOT}
Is it still used for purposes of hardlinking dupes?
If so, how does that work? when I looked at fdupes, I didn't see an option to hardlink dups, only options to delete dups.
Anyway, would it be useful if that was about 40% faster?
You can check out what the macro expands to using:
rpm -E "%fdupes /usr/foo"
_target=""; _symlinks=0; fdupes -q -p -n -H -o name -r /usr/foo | while read _file; do if test -z "$_target" ; then _target="$_file"; else if test -z "$_file" ; then _target=""; continue ; fi ; if test "$_symlinks" = 1; then ln -sf "${_target#/home/abuild/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64}" "$_file"; else ln -f "$_target" "$_file"; fi ; fi ; done $_symlinks is set to 1 when using fdupes -s Cheers, Dominique
On Thu, Mar 18, 2021 at 12:12:16AM -0700, L A Walsh wrote:
I noticed in 1 rpm, there was a comment next to an %fdupes line -- which I guess is a macro(?) saying:
# Hardlink duplicate files %fdupes ${RPM_BUILD_ROOT}
Aside, this is also not the correct way to run this macro at all. It's intended only for specific subdirectories, like for example to deduplicate some manpage directory or for header file deduplication. Never run this with for something like /usr/bin or other executables. You may end up with something you did not expect. - Adam
Hello, On 2021-03-30 11:32, Adam Majer wrote:
On Thu, Mar 18, 2021 at 12:12:16AM -0700, L A Walsh wrote:
I noticed in 1 rpm, there was a comment next to an %fdupes line -- which I guess is a macro(?) saying:
# Hardlink duplicate files %fdupes ${RPM_BUILD_ROOT}
Aside, this is also not the correct way to run this macro at all. It's intended only for specific subdirectories, like for example to deduplicate some manpage directory or for header file deduplication.
Never run this with for something like /usr/bin or other executables. You may end up with something you did not expect.
Cf. my rather old comments about "fdupes" in https://build.opensuse.org/package/view_file/Printing/hplip/hplip.spec?expan... that read: --------------------------------------------------------------------------- # Do not run "fdupes buildroot/_datadir/hplip" because # fdupes will link any files with same content there # which can have unexpected side-effects, compare # https://bugzilla.opensuse.org/show_bug.cgi?id=784670 ... # Run fdupes: # The RPM macro fdupes runs /usr/bin/fdupes that links files # with identical content. # Never run fdupes carelessly over the whole buildroot directory # because in older openSUSE and SLE11 versions fdupes # links files with different owner, group, or permissions # see https://bugzilla.novell.com/show_bug.cgi?id=784670 # and even in current openSUSE versions fdupes links across # sub-package boundaries, # compare https://bugzilla.novell.com/show_bug.cgi?id=784869 # so that fdupes can only run for specific directories # where linking files is safe: %fdupes -s %{buildroot}%{_datadir}/hplip/data/images --------------------------------------------------------------------------- The old "bugzilla.novell.com" URLs are now https://bugzilla.opensuse.org/show_bug.cgi?id=784670 https://bugzilla.opensuse.org/show_bug.cgi?id=784869 which are "RESOLVED FIXED" and "RESOLVED WORKSFORME" so nowadays fdupes should behave better by default but I don't know how much better in practice. Kind Regards Johannes Meixner -- SUSE Software Solutions Germany GmbH Maxfeldstr. 5 - 90409 Nuernberg - Germany (HRB 36809, AG Nuernberg) GF: Felix Imendoerffer
participants (4)
-
Adam Majer
-
Dominique Leuenberger / DimStar
-
Johannes Meixner
-
L A Walsh