From 9749d719401836ec080636baab243ebc8bfce6981b162f2a09ee1cafd170eeb2 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Thu, 22 Jan 2009 12:03:22 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/fdupes?expand=0&rev=5 --- fdupes-sort-output.diff | 64 +++++++++++++++++++++++++++++++++++++++++ fdupes.changes | 5 ++++ fdupes.spec | 30 +++++++++++++------ 3 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 fdupes-sort-output.diff diff --git a/fdupes-sort-output.diff b/fdupes-sort-output.diff new file mode 100644 index 0000000..67df261 --- /dev/null +++ b/fdupes-sort-output.diff @@ -0,0 +1,64 @@ +--- fdupes.c ++++ fdupes.c +@@ -581,24 +581,45 @@ + return 1; + } + ++/* from qsort man page */ ++static int ++cmpstringp(const void *p1, const void *p2) ++{ ++ /* The actual arguments to this function are "pointers to ++ pointers to char", but strcmp(3) arguments are "pointers ++ to char", hence the following cast plus dereference */ ++ ++ return strcmp(* (char * const *) p1, * (char * const *) p2); ++} ++ + void printmatches(file_t *files) + { + file_t *tmpfile; + + while (files != NULL) { + if (files->hasdupes) { ++ char **names = (char**)malloc(sizeof(char*)*(files->hasdupes+1)); ++ int count = 0, index; ++ names[count++] = files->d_name; ++ tmpfile = files->duplicates; ++ while (tmpfile != NULL) { ++ names[count++] = tmpfile->d_name; ++ tmpfile = tmpfile->duplicates; ++ } ++ qsort(names, count, sizeof(char *), cmpstringp); ++ + if (!ISFLAG(flags, F_OMITFIRST)) { + if (ISFLAG(flags, F_SHOWSIZE)) printf("%ld byte%seach:\n", files->size, + (files->size != 1) ? "s " : " "); +- if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &files->d_name); +- printf("%s%c", files->d_name, ISFLAG(flags, F_DSAMELINE)?' ':'\n'); ++ if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &names[0]); ++ printf("%s%c", names[0], ISFLAG(flags, F_DSAMELINE)?' ':'\n'); + } +- tmpfile = files->duplicates; +- while (tmpfile != NULL) { +- if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &tmpfile->d_name); +- printf("%s%c", tmpfile->d_name, ISFLAG(flags, F_DSAMELINE)?' ':'\n'); +- tmpfile = tmpfile->duplicates; ++ for (index = 1; index < count; index++) { ++ if (ISFLAG(flags, F_DSAMELINE)) escapefilename("\\ ", &names[index]); ++ printf("%s%c", names[index], ISFLAG(flags, F_DSAMELINE)?' ':'\n'); ++ + } ++ free(names); + printf("\n"); + + } +@@ -869,7 +890,7 @@ + } + + if (confirmmatch(file1, file2)) { +- match->hasdupes = 1; ++ match->hasdupes++; + curfile->duplicates = match->duplicates; + match->duplicates = curfile; + } diff --git a/fdupes.changes b/fdupes.changes index 765ecba..79ced7f 100644 --- a/fdupes.changes +++ b/fdupes.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jan 15 17:05:36 CET 2009 - coolo@suse.de + +- sort the output of fdupes to make it deterministic + ------------------------------------------------------------------- Thu Sep 6 18:41:37 CEST 2007 - mls@suse.de diff --git a/fdupes.spec b/fdupes.spec index 93762b4..a6509da 100644 --- a/fdupes.spec +++ b/fdupes.spec @@ -1,25 +1,34 @@ # # spec file for package fdupes (Version 1.40) # -# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. -# This file and all modifications and additions to the pristine -# package are under the same license as the package itself. +# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild + Name: fdupes -URL: http://premium.caribe.net/~adrian2/fdupes.html +Url: http://premium.caribe.net/~adrian2/fdupes.html Group: Productivity/Archiving/Compression Summary: Identifying or deleting duplicate files Version: 1.40 -Release: 42 +Release: 109 License: X11/MIT Source0: %name-%{version}.tar.bz2 Source1: macros.fdupes Patch0: %name.diff +Patch1: fdupes-sort-output.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -35,6 +44,7 @@ Authors: %prep %setup -q %patch +%patch1 %build make @@ -55,11 +65,13 @@ rm -rf $RPM_BUILD_ROOT /etc/rpm %changelog -* Thu Sep 06 2007 - mls@suse.de +* Thu Jan 15 2009 coolo@suse.de +- sort the output of fdupes to make it deterministic +* Thu Sep 06 2007 mls@suse.de - do not hardlink empty files in %%fdupes macro -* Wed Sep 05 2007 - nadvornik@suse.cz +* Wed Sep 05 2007 nadvornik@suse.cz - support filenames with spaces in %%fdupes macro [#307727] -* Tue May 15 2007 - coolo@suse.de +* Tue May 15 2007 coolo@suse.de - add an RPM macro to make use of it in spec files -* Thu Nov 16 2006 - dmueller@suse.de +* Thu Nov 16 2006 dmueller@suse.de - Initial package (1.40)