diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..35706ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +fdupes-1.50-PR2.tar.gz +/fdupes-1.51.tar.gz +/fdupes-1.6.1.tar.gz diff --git a/Makefile b/Makefile deleted file mode 100644 index df05e98..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: fdupes -# $Id$ -NAME := fdupes -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/fdupes-1.6.1-allow_a_instead_of_all.patch b/fdupes-1.6.1-allow_a_instead_of_all.patch new file mode 100644 index 0000000..89115e0 --- /dev/null +++ b/fdupes-1.6.1-allow_a_instead_of_all.patch @@ -0,0 +1,24 @@ +From 88f3d2dd31fbef7e539b2523724221e8e8e5a9f0 Mon Sep 17 00:00:00 2001 +From: Falk +Date: Thu, 27 Oct 2016 18:10:48 +0200 +Subject: [PATCH] allow to type just a instead of all + +Typing all many times can be boring/annoying, So I propose to allow people to type just a for all. +(sometimes there can be very large duplicate sets) +--- + fdupes.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fdupes.c b/fdupes.c +index 7eee165..7a8a6ed 100644 +--- a/fdupes.c ++++ b/fdupes.c +@@ -886,7 +886,7 @@ void deletefiles(file_t *files, int prompt, FILE *tty) + token = strtok(preservestr, " ,\n"); + + while (token != NULL) { +- if (strcasecmp(token, "all") == 0) ++ if (strcasecmp(token, "all") == 0 || strcasecmp(token, "a") == 0) + for (x = 0; x <= counter; x++) preserve[x] = 1; + + number = 0; diff --git a/fdupes-1.6.1-delete_old_TODO.patch b/fdupes-1.6.1-delete_old_TODO.patch new file mode 100644 index 0000000..ac9ad2d --- /dev/null +++ b/fdupes-1.6.1-delete_old_TODO.patch @@ -0,0 +1,88 @@ +From 315f6702f1cc37036d9f826314245b44a781c387 Mon Sep 17 00:00:00 2001 +From: Adrian Lopez +Date: Sun, 21 Aug 2016 02:04:15 -0400 +Subject: [PATCH] Delete old TODO file. + +--- + TODO | 72 -------------------------------------------------------------------- + 1 file changed, 72 deletions(-) + delete mode 100644 TODO + +diff --git a/TODO b/TODO +deleted file mode 100644 +index f7f77c4..0000000 +--- a/TODO ++++ /dev/null +@@ -1,72 +0,0 @@ +-- A bug with -S shows wrong results. +- +-- A bug causes the following behavior: +- +- $ fdupes --symlinks testdir +- testdir/with spaces b +- testdir/with spaces a +- +- testdir/zero_b +- testdir/zero_a +- +- testdir/symlink_two +- testdir/twice_one +- +- $ cp testdir/two testdir/two_again +- $ fdupes --symlinks testdir +- testdir/two_again +- testdir/two +- testdir/twice_one +- testdir/symlink_two +- +- testdir/with spaces b +- testdir/with spaces a +- +- testdir/zero_b +- testdir/zero_a +- +- ** This is not the desired behavior. Likewise: +- +- $ fdupes testdir +- testdir/with spaces b +- testdir/with spaces a +- +- testdir/zero_b +- testdir/zero_a +- +- testdir/twice_one +- testdir/two +- +- $ fdupes --symlinks testdir +- testdir/with spaces b +- testdir/with spaces a +- +- testdir/zero_b +- testdir/zero_a +- +- testdir/symlink_two +- testdir/twice_one +- +-- Don't assume that stat always works. +- +-- Add partial checksumming where instead of MD5ing whole +- files we MD5 and compare every so many bytes, caching +- these partial results for subsequent comparisons. +- +-- Option -R should not have to be separated from the rest, +- such that "fdupes -dR testdir", "fdupes -d -R testdir", +- "fdupes -Rd testdir", etc., all yield the same results. +- +-- Add option to highlight or identify symlinked files (suggest +- using --classify to identify symlinks with @ suffix... when +- specified, files containing @ are listed using \@). +- +-- Consider autodeletion option without user intervention. +- +-- Consider option to match only to files in specific directory. +- +-- Do a little commenting, to avoid rolling eyes and/or snickering. +- +-- Fix problem where MD5 collisions will result in one of the +- files not being registered (causing it to be ignored). +- diff --git a/fdupes-1.6.1-option_sort_by_ctime.patch b/fdupes-1.6.1-option_sort_by_ctime.patch new file mode 100644 index 0000000..8529323 --- /dev/null +++ b/fdupes-1.6.1-option_sort_by_ctime.patch @@ -0,0 +1,167 @@ +From e95ec42dc178eff0410880c3dc4c0dac3df442df Mon Sep 17 00:00:00 2001 +From: Adrian Lopez +Date: Tue, 23 Aug 2016 18:21:18 -0400 +Subject: [PATCH] Add an option to sort duplicate files by ctime. + +--- + README | 5 +++-- + fdupes.1 | 2 +- + fdupes.c | 49 +++++++++++++++++++++++++++++++++++++------------ + 3 files changed, 41 insertions(+), 15 deletions(-) + +diff --git a/README b/README +index c748d05..c27f043 100644 +--- a/README ++++ b/README +@@ -37,8 +37,9 @@ Usage: fdupes [options] DIRECTORY... + grouping into sets; implies --noprompt + -p --permissions don't consider files with different owner/group or + permission bits as duplicates +- -o --order=BY select sort order for output, linking and deleting; by +- mtime (BY='time'; default) or filename (BY='name') ++ -o --order=BY select sort order for output and deleting; by file ++ modification time (BY='time'; default), status ++ change time (BY='ctime'), or filename (BY='name') + -i --reverse reverse order while sorting + -v --version display fdupes version + -h --help display this help message +diff --git a/fdupes.1 b/fdupes.1 +index 5ddad87..969a5d8 100644 +--- a/fdupes.1 ++++ b/fdupes.1 +@@ -72,7 +72,7 @@ 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 ++time - sort by modification time, ctime - sort by status change time, name - sort by filename + .TP + .B -i --reverse + reverse order while sorting +diff --git a/fdupes.c b/fdupes.c +index ef64c45..7eee165 100644 +--- a/fdupes.c ++++ b/fdupes.c +@@ -56,7 +56,8 @@ + #define F_IMMEDIATE 0x8000 + + typedef enum { +- ORDER_TIME = 0, ++ ORDER_MTIME = 0, ++ ORDER_CTIME, + ORDER_NAME + } ordertype_t; + +@@ -64,6 +65,8 @@ char *program_name; + + unsigned long flags = 0; + ++ordertype_t ordertype = ORDER_MTIME; ++ + #define CHUNK_SIZE 8192 + + #define INPUT_SIZE 256 +@@ -97,7 +100,7 @@ typedef struct _file { + md5_byte_t *crcsignature; + dev_t device; + ino_t inode; +- time_t mtime; ++ time_t sorttime; + int hasdupes; /* true only if file is first on duplicate chain */ + struct _file *duplicates; + struct _file *next; +@@ -183,6 +186,14 @@ time_t getmtime(char *filename) { + return s.st_mtime; + } + ++time_t getctime(char *filename) { ++ struct stat s; ++ ++ if (stat(filename, &s) != 0) return 0; ++ ++ return s.st_ctime; ++} ++ + char **cloneargs(int argc, char **argv) + { + int x; +@@ -435,7 +446,17 @@ void getfilestats(file_t *file) + file->size = filesize(file->d_name); + file->inode = getinode(file->d_name); + file->device = getdevice(file->d_name); +- file->mtime = getmtime(file->d_name); ++ ++ switch (ordertype) ++ { ++ case ORDER_CTIME: ++ file->sorttime = getctime(file->d_name); ++ break; ++ case ORDER_MTIME: ++ default: ++ file->sorttime = getmtime(file->d_name); ++ break; ++ } + } + + int registerfile(filetree_t **branch, file_t *file) +@@ -911,11 +932,11 @@ int sort_pairs_by_arrival(file_t *f1, file_t *f2) + return !ISFLAG(flags, F_REVERSE) ? -1 : 1; + } + +-int sort_pairs_by_mtime(file_t *f1, file_t *f2) ++int sort_pairs_by_time(file_t *f1, file_t *f2) + { +- if (f1->mtime < f2->mtime) ++ if (f1->sorttime < f2->sorttime) + return !ISFLAG(flags, F_REVERSE) ? -1 : 1; +- else if (f1->mtime > f2->mtime) ++ else if (f1->sorttime > f2->sorttime) + return !ISFLAG(flags, F_REVERSE) ? 1 : -1; + + return 0; +@@ -1038,8 +1059,9 @@ void help_text() + printf(" \tgrouping into sets; implies --noprompt\n"); + printf(" -p --permissions \tdon't consider files with different owner/group or\n"); + printf(" \tpermission bits as duplicates\n"); +- printf(" -o --order=BY \tselect sort order for output, linking and deleting; by\n"); +- printf(" \tmtime (BY='time'; default) or filename (BY='name')\n"); ++ printf(" -o --order=BY \tselect sort order for output and deleting; by file\n"); ++ printf(" \tmodification time (BY='time'; default), status\n"); ++ printf(" \tchange time (BY='ctime'), or filename (BY='name')\n"); + printf(" -i --reverse \treverse order while sorting\n"); + printf(" -v --version \tdisplay fdupes version\n"); + printf(" -h --help \tdisplay this help message\n\n"); +@@ -1061,7 +1083,6 @@ 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[] = +@@ -1161,7 +1182,9 @@ int main(int argc, char **argv) { + if (!strcasecmp("name", optarg)) { + ordertype = ORDER_NAME; + } else if (!strcasecmp("time", optarg)) { +- ordertype = ORDER_TIME; ++ ordertype = ORDER_MTIME; ++ } else if (!strcasecmp("ctime", optarg)) { ++ ordertype = ORDER_CTIME; + } else { + errormsg("invalid value for --order: '%s'\n", optarg); + exit(1); +@@ -1247,10 +1270,12 @@ int main(int argc, char **argv) { + if (confirmmatch(file1, file2)) { + if (ISFLAG(flags, F_DELETEFILES) && ISFLAG(flags, F_IMMEDIATE)) + deletesuccessor(match, curfile, +- (ordertype == ORDER_TIME) ? sort_pairs_by_mtime : sort_pairs_by_filename ); ++ (ordertype == ORDER_MTIME || ++ ordertype == ORDER_CTIME) ? sort_pairs_by_time : sort_pairs_by_filename ); + else + registerpair(match, curfile, +- (ordertype == ORDER_TIME) ? sort_pairs_by_mtime : sort_pairs_by_filename ); ++ (ordertype == ORDER_MTIME || ++ ordertype == ORDER_CTIME) ? sort_pairs_by_time : sort_pairs_by_filename ); + } + + fclose(file1); diff --git a/fdupes.spec b/fdupes.spec new file mode 100644 index 0000000..0f25b62 --- /dev/null +++ b/fdupes.spec @@ -0,0 +1,201 @@ +# Place rpm-macros into proper location. +%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; /bin/echo $d) + +Name: fdupes +Epoch: 1 +Version: 1.6.1 +Release: 6%{?dist} +Summary: Finds duplicate files in a given set of directories + +License: MIT +URL: https://github.com/adrianlopezroche/%{name} +Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: macros.%{name} + +BuildRequires: gcc + +# From upstream. +Patch0: %{url}/commit/315f6702f1cc37036d9f826314245b44a781c387.patch#/%{name}-1.6.1-delete_old_TODO.patch +Patch1: %{url}/commit/e95ec42dc178eff0410880c3dc4c0dac3df442df.patch#/%{name}-1.6.1-option_sort_by_ctime.patch +Patch2: %{url}/commit/88f3d2dd31fbef7e539b2523724221e8e8e5a9f0.patch#/%{name}-1.6.1-allow_a_instead_of_all.patch + +%description +FDUPES is a program for identifying duplicate files residing within specified +directories. + + +%prep +%autosetup -p 1 + +# From README. +%{__cat} << EOF > LICENSE +FDUPES Copyright (c) 1999 Adrian Lopez + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +EOF + + +%build +%make_build \ + COMPILER_OPTIONS="%{?optflags}" \ + LDFLAGS="%{?__global_ldflags}" + + +%install +%make_install \ + INSTALL="%{__install} -p" \ + BIN_DIR=%{_bindir} \ + MAN_BASE_DIR=%{_mandir} + +%{__install} -Dpm 0644 %{SOURCE1} \ + %{buildroot}%{macrosdir}/macros.%{name} + + +%check +./%{name} testdir +./%{name} --omitfirst testdir +./%{name} --recurse testdir +./%{name} --size testdir + + +%files +%license CONTRIBUTORS LICENSE +%doc CHANGES README +%doc %{_mandir}/man1/%{name}.1* +%{_bindir}/%{name} +%{macrosdir}/macros.fdupes + + +%changelog +* Thu Jan 31 2019 Fedora Release Engineering - 1:1.6.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 1:1.6.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering - 1:1.6.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Aug 02 2017 Fedora Release Engineering - 1:1.6.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1:1.6.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sun Apr 09 2017 Björn Esser - 1:1.6.1-1 +- Updated to new upstream-release +- Upstream changed versioning-scheme, Epoch is needed +- Drop old patches, applied upstream +- Update spec-file to recent guidelines +- Drop el5-bits + +* Fri Feb 10 2017 Fedora Release Engineering - 1.51-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 03 2016 Fedora Release Engineering - 1.51-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Jon Schlueter - 1.51-10 +- Rebaseline using github which is new home of fdupes +- source tarball has unusual folder naming of fdupes-fdupes-1.51 instead of normal fdupes-1.51 + +* Wed Jun 17 2015 Fedora Release Engineering - 1.51-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Aug 16 2014 Fedora Release Engineering - 1.51-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 1.51-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Apr 18 2014 Björn Esser - 1.51-6 +- remove duplicated `macros.d`-dir (#1088566) + +* Tue Mar 18 2014 Björn Esser - 1.51-5 +- Add needed bits for el5 +- Fix `mixed use of spaces-and tabs` +- Minor cleanup and improved readability + +* Tue Mar 18 2014 Björn Esser - 1.51-4 +- Place rpm-macros into proper location using %%global macrosdir +- Apply proper LDFLAGS +- Fix offset in Patch1 and renamed it to match current version + +* Sun Jan 19 2014 Ville Skyttä - 1.51-3 +- Move macros to %%{_rpmconfigdir}/macros.d. + +* Sat Aug 03 2013 Fedora Release Engineering - 1.51-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Tue Jul 16 2013 Richard Shaw - 1.51-1 +- Update to latest upstream release. +- Fixes security bugs BZ#865591 & 865592. + +* Wed Feb 13 2013 Fedora Release Engineering - 1.50-0.7.PR2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - 1.50-0.6.PR2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue May 15 2012 Richard Shaw - 1.50-0.5.PR2 +- Add RPM macro. + +* Fri Jan 13 2012 Fedora Release Engineering - 1.50-0.4.PR2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Feb 08 2011 Fedora Release Engineering - 1.50-0.3.PR2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Jul 24 2009 Fedora Release Engineering - 1.50-0.2.PR2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Sun Feb 01 2009 Debarshi Ray - 1.50-0.1.PR2 +- Version bump to 1.50 PR2. + * Added --noprompt, --recurse and --summarize options + * Now sorts duplicates (old to new) for consistent order when listing or + deleting duplicate files. + * Now tests for early matching of files, which should help speed up the + matching process when large files are involved. + * Added warning whenever a file cannot be deleted. + * Fixed bug where some files would not be closed after failure. + * Fixed bug where confirmmatch() function wouldn't always deal properly with + zero-length files. + * Fixed bug where progress indicator would not be cleared when no files were + found. +- Inclusion of string.h now added by upstream. +- Added patch to fix file comparisons from Debian. (Debian BTS #213385) +- Added patch to enable large file support on 32-bit systems from Debian. + (Debian BTS #447601) +- Added patch to fix typo in the online manual page from Debian. (Debian BTS + #353789) + +* Tue Feb 19 2008 Release Engineering - 1.40-12 +- Autorebuild for gcc-4.3. + +* Thu Dec 27 2007 Debarshi Ray - 1.40-11 +- Fixed Makefile to preserve timestamps using 'cp -p'. + +* Thu Nov 29 2007 Debarshi Ray - 1.40-10 +- Release bumped to overcome spurious build. + +* Sun Nov 25 2007 Debarshi Ray - 1.40-9 +- Initial build. Imported SPEC from Rawhide. +- Fixed Makefile to use DESTDIR correctly. +- Fixed sources to include string.h. diff --git a/macros.fdupes b/macros.fdupes new file mode 100644 index 0000000..d01d65c --- /dev/null +++ b/macros.fdupes @@ -0,0 +1,21 @@ +%fdupes(s) \ + _target=""; \ + _symlinks=0; \ + %{-s:_symlinks=1;} \ + fdupes -q -n -r -p %1 | \ + 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#%{buildroot}}" "$_file"; \ + else \ + ln -f "$_target" "$_file"; \ + fi ;\ + fi ; \ + done \ +%{nil} diff --git a/sources b/sources index e69de29..1fc4c22 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (fdupes-1.6.1.tar.gz) = 6c6662b70068c2f48f4be64a6830c81a66852d650391d0756f20b9ac0df7d70c1a32918bd7cbd50e19de524d9ebc09ea338c19636e1807b071eb96b325e641db