File shunit2.spec of Package shunit2

#
# spec file for package shunit2
#
# Copyright (c) 2012 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.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define SHUNIT_HOME  /usr/share/shunit2

Name:     shunit2
Summary:  Test Framework for Bourne Based Shell Scripts
Version:  2.1.6
Release:  0
Source0:  %{name}-%{version}.tgz
Source1:  lgpl-2.1.txt
Patch0:   %{name}-gen_test_results.sh.diff
Patch1:   %{name}-examples.diff
License:  LGPL-2.1
Group:    Development/Languages/Other
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
# Vendor:  
URL:      http://code.google.com/p/shunit2
BuildRequires: bash


%description
shUnit2 is a xUnit unit test framework for Bourne based shell scripts, 
and it is designed to work in a similar manner to JUnit, PyUnit, etc. 
If you have ever had the desire to write a unit test for a shell 
script, shUnit2 can do the job. 


%prep
%setup -n %{name}-%{version}
# Use the correct version and overwrite it:
cp %{S:1} doc/LGPL-2.1

%patch0
%patch1

%build
# Add the correct basedir in our script:
sed -i 's#@SHUNIT_HOME@#%{SHUNIT_HOME}#g' bin/gen_test_results.sh
for i in examples/*.sh; do
  sed -i 's#@SHUNIT_HOME@#%{SHUNIT_HOME}#g' $i
done


%install
mkdir -p $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{SHUNIT_HOME}

install -m 755 bin/gen_test_results.sh $RPM_BUILD_ROOT%{_bindir}
cp -a lib src  $RPM_BUILD_ROOT%{SHUNIT_HOME}



%files 
%defattr(-,root,root)
%doc doc/* examples
%{_bindir}/*
%dir %{SHUNIT_HOME}
%dir %{SHUNIT_HOME}/src
%dir %{SHUNIT_HOME}/lib
%{SHUNIT_HOME}/src/*
%{SHUNIT_HOME}/lib/*


%changelog
openSUSE Build Service is sponsored by