File fakeroot.spec of Package fakeroot

Name:           fakeroot
License:        GNU General Public License (GPL)
Version:        1.7.1
Release:        4.2
Group:          Development/Tools
Summary:        Gives a fake root environment
BuildRequires:  dpkg-devel sharutils gnupg
AutoReqProv:    on
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        fakeroot_1.7.1.dsc
Source1:        fakeroot_1.7.1.tar.gz

%description
This package is intended to enable something like:
  dpkg-buildpackage -rfakeroot
i.e. to remove the need to become root for a package build.
This is done by setting LD_PRELOAD to libfakeroot.so,
which provides wrappers around getuid, chown, chmod, mknod,
stat, and so on, thereby creating a fake root environment.
.
fakeroot requires SYSV IPC or TCP to operate.

%prep
rm -Rf $RPM_BUILD_DIR/%{name}-%{version}
dpkg-source -x %{S:0}
%setup -D -T -n %{name}-%{version}

%build
sed -i -e 's/debian\/rules binary-biarch/#debian\/rules binary-biarch/' \
	debian/rules
./debian/rules build

%install
LD_PRELOAD=$RPM_BUILD_DIR/%{name}-%{version}/obj-sysv/.libs/libfakeroot.so ./debian/rules binary
dpkg -X ../%{name}*.deb $RPM_BUILD_ROOT | sed \
	-e 's/^\.//' \
	-e 's/\(.*\)\/$/%dir \1/' > %{name}.files
ln -s /usr/bin/fakeroot-sysv $RPM_BUILD_ROOT/usr/bin/fakeroot

%files -f %{name}.files
%defattr(-,root,root)
/usr/bin/fakeroot

%changelog