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

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,
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.

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

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

LD_PRELOAD=$RPM_BUILD_DIR/%{name}-%{version}/obj-sysv/.libs/ ./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