From a8b6c2fefe516feb048c10612ecd94d0c9ab3876 Mon Sep 17 00:00:00 2001 From: "Richard M. Shaw" Date: Tue, 15 May 2012 16:20:48 -0500 Subject: [PATCH] Add RPM macro. --- fdupes.spec | 64 +++++++++++++++++++++++++++------------------------ macros.fdupes | 21 +++++++++++++++++ 2 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 macros.fdupes diff --git a/fdupes.spec b/fdupes.spec index 8dfcef9..3ff13b3 100644 --- a/fdupes.spec +++ b/fdupes.spec @@ -1,62 +1,66 @@ -Summary: Finds duplicate files in a given set of directories -Name: fdupes -Version: 1.50 -Release: 0.4.PR2%{?dist} -License: MIT -Group: Applications/File -URL: http://netdial.caribe.net/~adrian2/fdupes.html -Source0: http://netdial.caribe.net/~adrian2/programs/fdupes/beta/%{name}-%{version}-PR2.tar.gz - -Patch0: %{name}-%{version}-destdir.patch +Name: fdupes +Summary: Finds duplicate files in a given set of directories +Version: 1.50 +Release: 0.5.PR2%{?dist} +License: MIT +Group: Applications/File +URL: http://netdial.caribe.net/~adrian2/fdupes.html +Source0: http://netdial.caribe.net/~adrian2/programs/fdupes/beta/%{name}-%{version}-PR2.tar.gz +Source1: macros.fdupes + +Patch0: %{name}-%{version}-destdir.patch # http://bugs.debian.org/213385 -Patch1: %{name}-%{version}-compare-file.patch +Patch1: %{name}-%{version}-compare-file.patch # http://bugs.debian.org/447601 -Patch2: %{name}-%{version}-lfs.patch +Patch2: %{name}-%{version}-lfs.patch # http://bugs.debian.org/353789 -Patch3: %{name}-%{version}-typo.patch +Patch3: %{name}-%{version}-typo.patch -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description FDUPES is a program for identifying duplicate files residing within specified directories. + %prep %setup -q -n %{name}-%{version}-PR2 -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 +%patch0 -p1 -b .destdir +%patch1 -p1 -b .cmp +%patch2 -p1 -b .lfs +%patch3 -p1 -b .typo + %build -make %{?_smp_mflags} COMPILER_OPTIONS="$RPM_OPT_FLAGS" +make %{?_smp_mflags} COMPILER_OPTIONS="%{optflags}" + %check ./%{name} testdir ./%{name} --omitfirst testdir ./%{name} --recurse testdir ./%{name} --size testdir -# ... etc.. + %install -rm -rf $RPM_BUILD_ROOT +make install INSTALL="%{__install} -p" \ + BIN_DIR=%{_bindir} \ + MAN_BASE_DIR=%{_mandir} \ + DESTDIR=%{buildroot} -make install INSTALL="%{__install} -p" BIN_DIR=%{_bindir} \ - MAN_BASE_DIR=%{_mandir} DESTDIR=$RPM_BUILD_ROOT +mkdir -p %{buildroot}%{_sysconfdir}/rpm +install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/rpm/ -%clean -rm -rf $RPM_BUILD_ROOT %files -%defattr(-,root,root,-) -%doc CHANGES -%doc CONTRIBUTORS -%doc README -%doc TODO +%doc CHANGES CONTRIBUTORS README TODO %doc %{_mandir}/man1/%{name}.1* %{_bindir}/%{name} +%{_sysconfdir}/rpm/macros.fdupes %changelog +* 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 diff --git a/macros.fdupes b/macros.fdupes new file mode 100644 index 0000000..a847ac8 --- /dev/null +++ b/macros.fdupes @@ -0,0 +1,21 @@ +%fdupes(s) \ + _target=""; \ + _symlinks=0; \ + %{-s:_symlinks=1;} \ + fdupes -q -n -r %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}