forked from pool/fdupes
Accepting request 232080 from home:StefanBruens:branches:utilities
Just saw a false positive for rpm comparision, in this case Mesa: [ 1289s] /usr/share/man/man3/glColorTableParameter.3gl.gz 2 (none) 100444 root root 0 4294967295 [ 1289s] -/usr/share/man/man3/glColorTableParameterfv.3gl.gz 2 (none) 100444 root root 0 4294967295 [ 1289s] -/usr/share/man/man3/glColorTableParameteriv.3gl.gz 2 (none) 120777 root root 0 4294967295 glColorTableParameterfv.3gl.gz [ 1289s] +/usr/share/man/man3/glColorTableParameterfv.3gl.gz 2 (none) 120777 root root 0 4294967295 glColorTableParameteriv.3gl.gz [ 1289s] +/usr/share/man/man3/glColorTableParameteriv.3gl.gz 2 (none) 100444 root root 0 4294967295 [ 1289s] /usr/share/man/man3/glConvolutionFilter1D.3gl.gz 2 (none) 100444 root root 0 4294967295 Obviously, the parallel build changed the mtime order of the files. fdupes 1.40 had a patch from coolo to handle this (filename comparision with strcmp()) OBS-URL: https://build.opensuse.org/request/show/232080 OBS-URL: https://build.opensuse.org/package/show/utilities/fdupes?expand=0&rev=9
This commit is contained in:
parent
8a0ce1943d
commit
09c675b9c8
122
0011-add-an-option-to-sort-duplicate-files-by-name.patch
Normal file
122
0011-add-an-option-to-sort-duplicate-files-by-name.patch
Normal file
@ -0,0 +1,122 @@
|
||||
From a0b7fb219b8e5203ae9884871c61b7f064e45797 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||
Date: Tue, 29 Apr 2014 19:12:48 +0200
|
||||
Subject: [PATCH] add an option to sort duplicate files by name
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
|
||||
---
|
||||
fdupes.1 | 4 ++++
|
||||
fdupes.c | 30 ++++++++++++++++++++++++++++--
|
||||
2 files changed, 32 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fdupes.1 b/fdupes.1
|
||||
index e0516f1..b5fb0f6 100644
|
||||
--- a/fdupes.1
|
||||
+++ b/fdupes.1
|
||||
@@ -66,6 +66,10 @@ set of duplicates and delete the others without prompting the user
|
||||
.B -p --permissions
|
||||
don't consider files with different owner/group or permission bits as duplicates
|
||||
.TP
|
||||
+.B -o --order\fR=\fIWORD\fR
|
||||
+order files according to WORD:
|
||||
+time - sort by mtime, name - sort by filename
|
||||
+.TP
|
||||
.B -v --version
|
||||
display fdupes version
|
||||
.TP
|
||||
diff --git a/fdupes.c b/fdupes.c
|
||||
index b6aeaa7..08f9e2c 100644
|
||||
--- a/fdupes.c
|
||||
+++ b/fdupes.c
|
||||
@@ -55,6 +55,11 @@
|
||||
#define F_EXCLUDEHIDDEN 0x1000
|
||||
#define F_PERMISSIONS 0x2000
|
||||
|
||||
+typedef enum {
|
||||
+ ORDER_TIME = 0,
|
||||
+ ORDER_NAME
|
||||
+} ordertype_t;
|
||||
+
|
||||
char *program_name;
|
||||
|
||||
unsigned long flags = 0;
|
||||
@@ -918,6 +923,11 @@ int sort_pairs_by_mtime(file_t *f1, file_t *f2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int sort_pairs_by_filename(file_t *f1, file_t *f2)
|
||||
+{
|
||||
+ return strcmp(f1->d_name, f2->d_name);
|
||||
+}
|
||||
+
|
||||
void registerpair(file_t **matchlist, file_t *newmatch,
|
||||
int (*comparef)(file_t *f1, file_t *f2))
|
||||
{
|
||||
@@ -995,6 +1005,9 @@ void help_text()
|
||||
printf(" \teach set of duplicates and delete the rest without\n");
|
||||
printf(" \twithout prompting the user\n");
|
||||
printf(" -p --permissions \tdon't consider files with different owner/group or permission bits as duplicates\n");
|
||||
+ printf(" -o --order \tselect sort order for output, linking and deleting. One of:\n");
|
||||
+ printf(" time \torder by mtime (default)\n");
|
||||
+ printf(" name \torder by filename\n");
|
||||
printf(" -v --version \tdisplay fdupes version\n");
|
||||
printf(" -h --help \tdisplay this help message\n\n");
|
||||
#ifdef OMIT_GETOPT_LONG
|
||||
@@ -1015,6 +1028,7 @@ int main(int argc, char **argv) {
|
||||
int progress = 0;
|
||||
char **oldargv;
|
||||
int firstrecurse;
|
||||
+ ordertype_t ordertype = ORDER_TIME;
|
||||
|
||||
#ifndef OMIT_GETOPT_LONG
|
||||
static struct option long_options[] =
|
||||
@@ -1039,6 +1053,7 @@ int main(int argc, char **argv) {
|
||||
{ "summarize", 0, 0, 'm'},
|
||||
{ "summary", 0, 0, 'm' },
|
||||
{ "permissions", 0, 0, 'p' },
|
||||
+ { "order", 1, 0, 'o' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
#define GETOPT getopt_long
|
||||
@@ -1050,7 +1065,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
oldargv = cloneargs(argc, argv);
|
||||
|
||||
- while ((opt = GETOPT(argc, argv, "frRq1Ss::HlnAdvhNmp"
|
||||
+ while ((opt = GETOPT(argc, argv, "frRq1SsHlndvhNmpo:"
|
||||
#ifndef OMIT_GETOPT_LONG
|
||||
, long_options, NULL
|
||||
#endif
|
||||
@@ -1104,6 +1119,16 @@ int main(int argc, char **argv) {
|
||||
case 'p':
|
||||
SETFLAG(flags, F_PERMISSIONS);
|
||||
break;
|
||||
+ case 'o':
|
||||
+ if (!strcasecmp("name", optarg)) {
|
||||
+ ordertype = ORDER_NAME;
|
||||
+ } else if (!strcasecmp("time", optarg)) {
|
||||
+ ordertype = ORDER_TIME;
|
||||
+ } else {
|
||||
+ errormsg("invalid value for --order: '%s'\n", optarg);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Try `fdupes --help' for more information.\n");
|
||||
@@ -1179,7 +1204,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (confirmmatch(file1, file2)) {
|
||||
- registerpair(match, curfile, sort_pairs_by_mtime);
|
||||
+ registerpair(match, curfile,
|
||||
+ (ordertype == ORDER_TIME) ? sort_pairs_by_mtime : sort_pairs_by_filename );
|
||||
|
||||
//match->hasdupes = 1;
|
||||
//curfile->duplicates = match->duplicates;
|
||||
--
|
||||
1.8.4.5
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 29 16:08:34 UTC 2014 - stefan.bruens@rwth-aachen.de
|
||||
|
||||
- sort the output of fdupes by filename to make it deterministic
|
||||
for parallel builds
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 16 11:44:08 UTC 2012 - mvyskocil@suse.com
|
||||
|
||||
|
@ -49,6 +49,8 @@ Patch8: 0008-speedup-the-file-compare.patch
|
||||
Patch9: 0009-glibc-endianness-check-in-md5.patch
|
||||
#PATCH-FIX-OPENSUSE: -p/--permissions mode
|
||||
Patch10: 0010-add-permissions-mode.patch
|
||||
#PATCH-FIX-OPENSUSE: -o/--order mode
|
||||
Patch11: 0011-add-an-option-to-sort-duplicate-files-by-name.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora_version}
|
||||
@ -73,6 +75,7 @@ residing within specified directories
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
|
||||
%build
|
||||
echo -e "#!/bin/bash\n`which %__cc` \"\$@\"" >gcc
|
||||
|
@ -3,7 +3,7 @@
|
||||
_target=""; \
|
||||
_symlinks=0; \
|
||||
%{-s:_symlinks=1;} \
|
||||
fdupes -q -p -n -r %1 | \
|
||||
fdupes -q -p -n -o name -r %1 | \
|
||||
while read _file; do \
|
||||
if test -z "$_target" ; then \
|
||||
_target="$_file"; \
|
||||
|
Loading…
Reference in New Issue
Block a user