File dd_rescue.spec of Package dd_rescue

#
# spec file for package dd_rescue
#
# Copyright (c) 2011 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/
#

%define ddrescuever 1.24
%define ddrhelpver 0.1.2

Name:           dd_rescue
Version:        %{ddrescuever}_%{ddrhelpver}
Release:        1
Summary:        Data Copying in the Presence of I/O Errors

License:        GPL-2.0
Url:            http://www.garloff.de/kurt/linux/ddrescue/
Group:          System/Base
Source0:        http://www.garloff.de/kurt/linux/ddrescue/%{name}-%{ddrescuever}.tar.gz
Source1:        http://www.kalysto.org/pkg/dd_rhelp-%{ddrhelpver}.tar.gz
# PATCH-FIX-OPENSUSE ddresc-112.diff garloff@suse.de -- Use -y0 if ddrescue is 1.12 or newer
Patch0:         ddresc-112.diff
# PATCH-FIX-OPENSUSE dd_rhelp_EOF.diff garloff@suse.de -- Adjust dd_rhelp to changes in dd_rescue
Patch1:         dd_rhelp_EOF.diff
# PATCH-FIX-OPENSUSE dd_rhelp_Summary.diff garloff@suse.de -- dd_rhelp adjusted for Summary change
Patch2:         dd_rhelp_Summary.diff
# PATCH-FIX-OPENSUSE dd_rhelp.test.diff garloff@suse.de -- Fix dd_rhelp.test script (basic regression test)
Patch3:		dd_rhelp.test.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  libfallocate-devel-static bc
Requires:       bc
Provides:       ddrescue = %{ddrescuever}
Obsoletes:      ddrescue < %{ddrescuever}

%description
dd_rescue helps when nothing else can: your disk has crashed and you
try to copy it over to another one. While standard Unix tools like cp,
cat, and dd wail "abort" on every I/O error, dd_rescue does not.

%prep
%setup -q -n dd_rescue -a1
cd dd_rhelp-%{ddrhelpver}
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
for name in AUTHORS COPYING ChangeLog FAQ NEWS README THANKS TODO; do
  cp -p $name ${name}.dd_rhelp
done
cd ..

# Remove build time references so build-compare can do its work
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -i "s/__TIME__/\"$FAKE_BUILDTIME\"/g" dd_rescue.c
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/g" dd_rescue.c

%build
make RPM_OPT_FLAGS="%{optflags}" libfalloc-static LIBDIR=%{_libdir} %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} INSTASROOT= INSTALLFLAGS=
cd dd_rhelp-%{ddrhelpver}
install -Dpm 0755 dd_rhelp %{buildroot}/bin
cd ..

%check
cd dd_rhelp-%{ddrhelpver}
export PATH=..:$PATH
./dd_rhelp.test
cd ..

%files
%defattr(-,root,root,-)
%doc COPYING README.dd_rescue
%doc dd_rhelp-%{ddrhelpver}/*.dd_rhelp
%doc dd_rhelp-%{ddrhelpver}/doc
/bin/dd_rescue
/bin/dd_rhelp

%changelog
openSUSE Build Service is sponsored by