forked from pool/fdupes
This commit is contained in:
parent
9c3fe56e51
commit
9749d71940
64
fdupes-sort-output.diff
Normal file
64
fdupes-sort-output.diff
Normal file
@ -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;
|
||||||
|
}
|
@ -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
|
Thu Sep 6 18:41:37 CEST 2007 - mls@suse.de
|
||||||
|
|
||||||
|
30
fdupes.spec
30
fdupes.spec
@ -1,25 +1,34 @@
|
|||||||
#
|
#
|
||||||
# spec file for package fdupes (Version 1.40)
|
# spec file for package fdupes (Version 1.40)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2009 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.
|
|
||||||
#
|
#
|
||||||
|
# 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/
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
# norootforbuild
|
# norootforbuild
|
||||||
|
|
||||||
|
|
||||||
Name: fdupes
|
Name: fdupes
|
||||||
URL: http://premium.caribe.net/~adrian2/fdupes.html
|
Url: http://premium.caribe.net/~adrian2/fdupes.html
|
||||||
Group: Productivity/Archiving/Compression
|
Group: Productivity/Archiving/Compression
|
||||||
Summary: Identifying or deleting duplicate files
|
Summary: Identifying or deleting duplicate files
|
||||||
Version: 1.40
|
Version: 1.40
|
||||||
Release: 42
|
Release: 109
|
||||||
License: X11/MIT
|
License: X11/MIT
|
||||||
Source0: %name-%{version}.tar.bz2
|
Source0: %name-%{version}.tar.bz2
|
||||||
Source1: macros.fdupes
|
Source1: macros.fdupes
|
||||||
Patch0: %name.diff
|
Patch0: %name.diff
|
||||||
|
Patch1: fdupes-sort-output.diff
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -35,6 +44,7 @@ Authors:
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch
|
%patch
|
||||||
|
%patch1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make
|
make
|
||||||
@ -55,11 +65,13 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/etc/rpm
|
/etc/rpm
|
||||||
|
|
||||||
%changelog
|
%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
|
- 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]
|
- 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
|
- 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)
|
- Initial package (1.40)
|
||||||
|
Loading…
Reference in New Issue
Block a user