Blob Blame History Raw
%global deb_ver 1.7.5-5

Name:            pseudo
Version:         1.8.1
Release:         3%{?dist}
Summary:         Advanced tool for simulating superuser privileges

License:         GPLv3+ and LGPLv2+
URL:             https://www.yoctoproject.org/tools-resources/projects/pseudo
Source0:         https://downloads.yoctoproject.org/releases/pseudo/pseudo-%{version}.tar.bz2
Source1:         http://http.debian.net/debian/pool/main/p/pseudo/pseudo_%{deb_ver}.debian.tar.xz
# fix passing our CFLAGS
# https://bugzilla.yoctoproject.org/show_bug.cgi?id=10403
Patch0:          pseudo-comma-in-cflags.patch

BuildRequires:   attr
BuildRequires:   libattr-devel
BuildRequires:   python
BuildRequires:   sqlite-devel
Requires(post):  %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives

%global __provides_exclude_from ^(%{_libdir}/pseudo/.*\\.so)$

%description
The pseudo utility offers a way to run commands in a virtualized "root"
environment, allowing ordinary users to run commands which give the illusion of
creating device nodes, changing file ownership, and otherwise doing things
necessary for creating distribution packages or filesystems.

Pseudo has a lot of similarities to fakeroot but is a new implementation that
improves on the problems seen using fakeroot. Pseudo is now extensively used by
Poky as a replacement to fakeroot but can also be used standalone in many other
use cases.

%prep
%autosetup -a1
patch -p1 < debian/patches/0000-manpage.patch
sed -e 's,@LIBDIR@,%{_libdir}/pseudo,g' debian/fakeroot-pseudo.in > debian/fakeroot-pseudo

%build
# custom configure script
export LDFLAGS="%{__global_ldflags}"
./configure                  \
  --bits=%{__isa_bits}       \
  --cflags="%{optflags}"     \
  --enable-memory-db         \
  --enable-xattr             \
  --enable-xattrdb           \
  --libdir=%{_libdir}/pseudo \
  --prefix=%{_prefix}        \
  --without-rpath
%{make_build}

%install
%make_install
install -pm0755 debian/fakeroot-pseudo %{buildroot}%{_bindir}
install -Dpm0644 debian/fakeroot-pseudo.1 %{buildroot}%{_mandir}/man1/fakeroot-pseudo.1
install -pm0644 pseudolog.1 %{buildroot}%{_mandir}/man1/pseudolog.1
# For alternatives support
touch %{buildroot}%{_bindir}/fakeroot %{buildroot}%{_mandir}/man1/fakeroot.1

%check
./run_tests.sh -v

%post
%if 0%{?rhel} && 0%{?rhel} < 7
# fakeroot in RHEL < 7 doesn't support alternatives
link=$(readlink -e "%{_bindir}/fakeroot")
if [ "$link" = "%{_bindir}/fakeroot" ]; then
  rm -f %{_bindir}/fakeroot
fi
%endif
%{_sbindir}/update-alternatives --install %{_bindir}/fakeroot fakeroot \
  %{_bindir}/fakeroot-pseudo 5 \
  --slave %{_mandir}/man1/fakeroot.1.gz fakeroot.1.gz %{_mandir}/man1/fakeroot-pseudo.1.gz

%preun
if [ $1 = 0 ]; then
  %{_sbindir}/alternatives --remove fakeroot %{_bindir}/fakeroot-pseudo
fi

%files
%license COPYING
%doc ChangeLog.txt Futures.txt README
%ghost %{_bindir}/fakeroot
%{_bindir}/fakeroot-pseudo
%{_bindir}/pseudo
%{_bindir}/pseudodb
%{_bindir}/pseudolog
%{_libdir}/pseudo
%ghost %{_mandir}/man1/fakeroot.1*
%{_mandir}/man1/fakeroot-pseudo.1*
%{_mandir}/man1/pseudolog.1*

%changelog
* Tue Oct 11 2016 Dominik Mierzejewski <dominik@greysector.net> 1.8.1-3
- fix condition on Fedora

* Mon Oct 10 2016 Dominik Mierzejewski <dominik@greysector.net> 1.8.1-2
- make sure _libdir/pseudo is owned
- fakeroot without alternatives support exists on RHEL < 7 only

* Sun Oct 09 2016 Dominik Mierzejewski <dominik@greysector.net> 1.8.1-1
- update to 1.8.1
- use upstream release tarball
- add missing NAME section to manpage (patch from Debian)
- fix passing CFLAGS containing commas via --cflags
- install missing pseudolog(1) manpage

* Thu Apr 07 2016 Dominik Mierzejewski <dominik@greysector.net> 1.7.5-1
- update to 1.7.5

* Mon Nov 30 2015 Dominik Mierzejewski <dominik@greysector.net> 1.7.4-1
- initial build
- filter private library from Provides:
- filter -m32/-m64 option from compiler flags on arm and s390