rpm-ostree/tests/compose/yum/empty.spec
Jonathan Lebon d9e8535bcf treecompose: fix crash when "remove-from-packages" used
This works around a potential issue with libsolv if we go down the
rpmostree_get_pkglist_for_root() path. Though rpm has been using the
/usr/share/rpm location (since the RpmOstreeContext set the _dbpath
macro), the /var/lib/rpm directory will still exist, but be empty.
libsolv gets confused because it sees the /var/lib/rpm dir and doesn't
even try the /usr/share/rpm location, and eventually dies when it tries
to load the data.

So we set the symlink now. This is also what we do on boot anyway for
compatibility reasons using tmpfiles.

This also means we don't have to do the /var/lib/rpm --> /usr/share/rpm
transition during the rootfs postprocess (but we still have to clean up
db and lock files).

Also get rid of the unused pkglist variable.

NB: I used the GFile & gs APIs to mesh with the surrounding code.

Closes: #290
Approved by: cgwalters
2016-05-27 17:06:08 +00:00

63 lines
1.2 KiB
RPMSpec

%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress
Summary: A very (un)useful package
Name: empty
Version: 1.0
Release: 1
License: GPL+
Group: Development/Tools
URL: http://foo.bar.com
BuildArch: x86_64
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
%{summary}
%prep
%build
%install
mkdir -p %{buildroot}/boot
mkdir -p %{buildroot}/var/lib
mkdir -p %{buildroot}/var/share/
mkdir -p %{buildroot}/var/tmp/
mkdir -p %{buildroot}/usr/sbin
mkdir -p %{buildroot}/etc
mkdir -p %{buildroot}/usr/lib
mkdir -p %{buildroot}/usr/lib/tmpfiles.d
for i in foo bar hello world; do
echo $i > %{buildroot}/var/share/$i
done
touch %{buildroot}/boot/vmlinuz-kernel
echo "nobody:x:99:99:Nobody:/:/sbin/nologin" > %{buildroot}/etc/passwd
touch %{buildroot}/etc/group
touch %{buildroot}/etc/nsswitch.conf
cp empty %{buildroot}/usr/sbin/depmod
cp empty %{buildroot}/usr/sbin/dracut
touch %{buildroot}/var/tmp/initramfs.img
%clean
rm -rf %{buildroot}
%files
/var/lib
/var/share/*
/boot/*
/usr/sbin/*
/usr/lib/*
/var/tmp/*
/etc/*
%changelog
* Tue Mar 17 2015 Giuseppe Scrivano <gscrivan@redhat.com> 1.0-1
- First Build
EOF