2019-09-06 22:25:27 +03:00
# The canonical copy of this spec file is upstream at:
2021-05-07 17:12:45 +03:00
# https://github.com/coreos/rpm-ostree/blob/main/packaging/rpm-ostree.spec.in
2019-09-06 22:25:27 +03:00
2017-03-07 17:00:56 +03:00
Summary : Hybrid image/package system
2014-01-16 06:54:48 +04:00
Name : rpm-ostree
2021-05-11 16:56:26 +03:00
Version : 2021.5
2014-01-16 06:54:48 +04:00
Release : 1%{?dist}
License : LGPLv2+
2020-12-22 17:21:01 +03:00
URL : https://github.com/coreos/rpm-ostree
# This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot"
# in the upstream git. It also contains vendored Rust sources.
Source0 : https://github.com/coreos/rpm-ostree/releases/download/v%{version} /rpm-ostree-%{version} .tar.xz
2019-09-06 22:25:27 +03:00
ExclusiveArch : %{rust_arches}
2021-01-19 18:25:43 +03:00
BuildRequires : make
2020-05-22 21:33:46 +03:00
%if 0%{?rhel} && !0%{?eln}
BuildRequires : rust-toolset
%else
2020-12-16 18:24:10 +03:00
BuildRequires : rust-packaging
2019-09-06 22:25:27 +03:00
BuildRequires : cargo
BuildRequires : rust
%endif
Add --enable-sanitizers (not on by default yet)
This way we at least get unit test coverage (which...
our unit test coverage doesn't do much because our
main code paths require privileges or virt).
One main blocker to this is that rustc doesn't expose
first-class support for this yet:
https://github.com/rust-lang/rust/issues/39699
At a practical level this works when building in release
mode but fails with `cargo test` for some reason; linker
arguments being pruned? Not sure.
So I was able to use this when composing to find a bug,
but then for some other reason the client
side apparently infinite loops inside libsolv.
So we're not enabling this yet for those reasons, but
let's land the build infrastructure now.
```
(lldb) thread backtrace
* thread #4, name = 'pool-/usr/bin/r'
* frame #0: 0x00007fd61b97200f libc.so.6`__memcpy_sse2_unaligned_erms + 623
frame #1: 0x00007fd61cbc88e6 libasan.so.6`__asan::asan_realloc(void*, unsigned long, __sanitizer::BufferedStackTrace*) + 214
frame #2: 0x00007fd61cc4b725 libasan.so.6`__interceptor_realloc + 245
frame #3: 0x00007fd61baec43e libsolv.so.1`solv_realloc + 30
frame #4: 0x00007fd61baf0414 libsolv.so.1`repodata_add_dirstr + 276
frame #5: 0x00007fd61bb6f755 libsolvext.so.1`end_element + 53
frame #6: 0x00007fd61b05855d libxml2.so.2`xmlParseEndTag1.constprop.0 + 317
frame #7: 0x00007fd61b063548 libxml2.so.2`xmlParseTryOrFinish.isra.0 + 888
frame #8: 0x00007fd61af7ed20 libxml2.so.2`xmlParseChunk + 560
frame #9: 0x00007fd61bb727e7 libsolvext.so.1`solv_xmlparser_parse + 183
frame #10: 0x00007fd61bb5ea0e libsolvext.so.1`repo_add_rpmmd + 254
frame #11: 0x000055a4fce7a5f5 rpm-ostree`::load_filelists_cb(repo=<unavailable>, fp=<unavailable>) at dnf-sack.cpp:444:23
frame #12: 0x000055a4fce7cad6 rpm-ostree`load_ext(_DnfSack*, libdnf::Repo*, _hy_repo_repodata, char const*, char const*, int (*)(s_Repo*, _IO_FILE*), _GError**) at dnf-sack.cpp:430:13
frame #13: 0x000055a4fce7df60 rpm-ostree`dnf_sack_load_repo at dnf-sack.cpp:1789:26
frame #14: 0x000055a4fce7eee9 rpm-ostree`dnf_sack_add_repo at dnf-sack.cpp:2217:28
frame #15: 0x000055a4fce7f0fb rpm-ostree`dnf_sack_add_repos at dnf-sack.cpp:2271:32
frame #16: 0x000055a4fce870ee rpm-ostree`dnf_context_setup_sack_with_flags at dnf-context.cpp:1796:29
frame #17: 0x000055a4fcdf757f rpm-ostree`rpmostree_context_download_metadata at rpmostree-core.cxx:1206:44
frame #18: 0x000055a4fcdf95c3 rpm-ostree`rpmostree_context_prepare at rpmostree-core.cxx:2001:48
frame #19: 0x000055a4fce54ab7 rpm-ostree`rpmostree_sysroot_upgrader_prep_layering at rpmostree-sysroot-upgrader.cxx:1018:38
frame #20: 0x000055a4fcdcb143 rpm-ostree`deploy_transaction_execute(_RpmostreedTransaction*, _GCancellable*, _GError**) at rpmostreed-transaction-types.cxx:1445:49
frame #21: 0x000055a4fcdba4cd rpm-ostree`transaction_execute_thread(_GTask*, void*, void*, _GCancellable*) at rpmostreed-transaction.cxx:340:34
frame #22: 0x00007fd61c58f7e2 libgio-2.0.so.0`g_task_thread_pool_thread + 114
frame #23: 0x00007fd61c3d7e54 libglib-2.0.so.0`g_thread_pool_thread_proxy.lto_priv.0 + 116
frame #24: 0x00007fd61c3d52b2 libglib-2.0.so.0`g_thread_proxy + 82
frame #25: 0x00007fd61b8af3f9 libpthread.so.0`start_thread + 233
frame #26: 0x00007fd61b9c9903 libc.so.6`__clone + 67
(lldb)
```
2021-02-03 00:54:38 +03:00
# Enable ASAN + UBSAN
%bcond_with sanitizers
2019-10-17 00:02:45 +03:00
# RHEL8 doesn't ship zchunk today. See also the comments
# in configure.ac around this as libdnf/librepo need to be in
# sync, and today we bundle libdnf but not librepo.
2020-05-22 21:33:46 +03:00
%if 0%{?rhel} && 0%{?rhel} <= 8
2019-10-17 00:02:45 +03:00
%bcond_with zchunk
%else
%bcond_without zchunk
%endif
2020-12-22 01:27:52 +03:00
%if 0%{?fedora} >= 34
%define sqlite_rpmdb_default "--enable-sqlite-rpmdb-default"
%endif
2019-09-06 22:25:27 +03:00
# For the autofiles bits below
BuildRequires : /usr/bin/python3
2014-01-16 06:54:48 +04:00
# We always run autogen.sh
2017-03-07 17:00:56 +03:00
BuildRequires : autoconf automake libtool git
2014-01-16 06:54:48 +04:00
# For docs
2017-03-07 17:00:56 +03:00
BuildRequires : chrpath
2014-01-16 06:54:48 +04:00
BuildRequires : gtk-doc
BuildRequires : gnome-common
2019-09-06 22:25:27 +03:00
BuildRequires : /usr/bin/g-ir-scanner
2017-03-07 17:00:56 +03:00
# Core requirements
2019-09-06 22:25:27 +03:00
# One way to check this: `objdump -p /path/to/rpm-ostree | grep LIBOSTREE` and pick the highest (though that might miss e.g. new struct members)
2021-05-26 22:07:52 +03:00
BuildRequires : pkgconfig(ostree-1) >= 2021.1
2019-09-06 22:25:27 +03:00
BuildRequires : pkgconfig(polkit-gobject-1)
2014-02-13 03:26:31 +04:00
BuildRequires : pkgconfig(json-glib-1.0)
2021-05-31 13:18:18 +03:00
BuildRequires : pkgconfig(rpm) >= 4.14.0
2017-03-07 17:00:56 +03:00
BuildRequires : pkgconfig(libarchive)
BuildRequires : pkgconfig(libsystemd)
2014-11-15 02:07:47 +03:00
BuildRequires : libcap-devel
2017-03-07 17:00:56 +03:00
BuildRequires : libattr-devel
2021-03-27 16:41:33 +03:00
# We currently interact directly with librepo (libdnf below also pulls it in,
# but duplicating to be clear)
2017-03-07 17:00:56 +03:00
BuildRequires : pkgconfig(librepo)
2014-01-16 07:22:49 +04:00
2019-09-06 22:25:27 +03:00
# Needed by curl-rust
BuildRequires : pkgconfig(libcurl)
2017-03-07 17:00:56 +03:00
BuildRequires : cmake
BuildRequires : pkgconfig(expat)
BuildRequires : pkgconfig(check)
2021-03-27 16:41:33 +03:00
# We use some libsolv types directly too (libdnf below also pulls it in,
# but duplicating to be clear)
2017-03-07 17:00:56 +03:00
BuildRequires : pkgconfig(libsolv)
2019-09-06 22:25:27 +03:00
# We need g++ for libdnf
BuildRequires : gcc-c++
2021-04-12 21:00:14 +03:00
# more libdnf build deps (see libdnf's spec for versions; maintain ordering)
%global libsolv_version 0.7.17
2021-03-27 16:41:33 +03:00
%global libmodulemd_version 2.11.2-2
%global librepo_version 1.13.0
2021-04-12 21:00:14 +03:00
%global swig_version 3.0.12
2019-09-06 22:25:27 +03:00
BuildRequires : swig >= %{swig_version}
2020-02-21 18:58:31 +03:00
BuildRequires : pkgconfig(modulemd-2.0) >= %{libmodulemd_version}
2021-03-27 16:41:33 +03:00
BuildRequires : pkgconfig(librepo) >= %{librepo_version}
BuildRequires : libsolv-devel >= %{libsolv_version}
2019-09-06 22:25:27 +03:00
BuildRequires : pkgconfig(json-c)
BuildRequires : pkgconfig(cppunit)
BuildRequires : pkgconfig(sqlite3)
BuildRequires : pkgconfig(smartcols)
2019-10-17 00:02:45 +03:00
%if %{with zchunk}
BuildRequires : pkgconfig(zck) >= 0.9.11
%endif
2019-09-06 22:25:27 +03:00
BuildRequires : gpgme-devel
2021-03-27 16:41:33 +03:00
# Runtime libdnf deps
2020-02-21 18:58:31 +03:00
Requires : libmodulemd%{?_isa} >= %{libmodulemd_version}
2021-03-27 16:41:33 +03:00
Requires : libsolv%{?_isa} >= %{libsolv_version}
Requires : librepo%{?_isa} >= %{librepo_version}
2017-03-07 17:00:56 +03:00
# For now...see https://github.com/projectatomic/rpm-ostree/pull/637
# and https://github.com/fedora-infra/fedmsg-atomic-composer/pull/17
# etc. We'll drop this dependency at some point in the future when
# rpm-ostree wraps more of ostree (such as `ostree admin unlock` etc.)
Requires : ostree
Requires : bubblewrap
Requires : fuse
2014-01-16 06:54:48 +04:00
2019-09-06 22:25:27 +03:00
Requires : %{name} -libs%{?_isa} = %{version} -%{release}
2014-01-16 06:54:48 +04:00
%description
2017-03-07 17:00:56 +03:00
rpm-ostree is a hybrid image/package system. It supports
" c o m p o s i n g " packages on a build server into an OSTree repository,
which can then be replicated by client systems with atomic upgrades.
Additionally, unlike many " p u r e " image systems, with rpm-ostree
each client system can layer on additional packages, providing
a " b e s t o f b o t h w o r l d s " approach.
2014-01-16 06:54:48 +04:00
2019-09-06 22:25:27 +03:00
%package libs
Summary : Shared library for rpm-ostree
%description libs
The %{name} -libs package includes the shared library for %{name} .
2015-04-09 00:20:50 +03:00
%package devel
Summary : Development headers for %{name}
2019-09-06 22:25:27 +03:00
Requires : %{name} -libs%{?_isa} = %{version} -%{release}
2015-04-09 00:20:50 +03:00
%description devel
2019-09-06 22:25:27 +03:00
The %{name} -devel package includes the header files for %{name} -libs.
2015-04-09 00:20:50 +03:00
2014-01-16 06:54:48 +04:00
%prep
2017-03-07 17:00:56 +03:00
%autosetup -Sgit -n %{name} -%{version}
2014-01-16 06:54:48 +04:00
%build
2020-07-29 18:44:39 +03:00
# gobject introspection does not work with LTO. There is an effort to fix this
# in the appropriate project upstreams, so hopefully LTO can be enabled someday
# Disable LTO.
%define _lto_cflags %{nil}
2014-01-16 06:54:48 +04:00
env NOCONFIGURE=1 ./autogen.sh
2020-12-16 18:24:10 +03:00
# Since we're hybrid C++/Rust we need to propagate this manually;
# the %%configure macro today assumes (reasonably) that one is building
# C/C++ and sets C{,XX}FLAGS
export RUSTFLAGS=" %{build_rustflags} "
Add --enable-sanitizers (not on by default yet)
This way we at least get unit test coverage (which...
our unit test coverage doesn't do much because our
main code paths require privileges or virt).
One main blocker to this is that rustc doesn't expose
first-class support for this yet:
https://github.com/rust-lang/rust/issues/39699
At a practical level this works when building in release
mode but fails with `cargo test` for some reason; linker
arguments being pruned? Not sure.
So I was able to use this when composing to find a bug,
but then for some other reason the client
side apparently infinite loops inside libsolv.
So we're not enabling this yet for those reasons, but
let's land the build infrastructure now.
```
(lldb) thread backtrace
* thread #4, name = 'pool-/usr/bin/r'
* frame #0: 0x00007fd61b97200f libc.so.6`__memcpy_sse2_unaligned_erms + 623
frame #1: 0x00007fd61cbc88e6 libasan.so.6`__asan::asan_realloc(void*, unsigned long, __sanitizer::BufferedStackTrace*) + 214
frame #2: 0x00007fd61cc4b725 libasan.so.6`__interceptor_realloc + 245
frame #3: 0x00007fd61baec43e libsolv.so.1`solv_realloc + 30
frame #4: 0x00007fd61baf0414 libsolv.so.1`repodata_add_dirstr + 276
frame #5: 0x00007fd61bb6f755 libsolvext.so.1`end_element + 53
frame #6: 0x00007fd61b05855d libxml2.so.2`xmlParseEndTag1.constprop.0 + 317
frame #7: 0x00007fd61b063548 libxml2.so.2`xmlParseTryOrFinish.isra.0 + 888
frame #8: 0x00007fd61af7ed20 libxml2.so.2`xmlParseChunk + 560
frame #9: 0x00007fd61bb727e7 libsolvext.so.1`solv_xmlparser_parse + 183
frame #10: 0x00007fd61bb5ea0e libsolvext.so.1`repo_add_rpmmd + 254
frame #11: 0x000055a4fce7a5f5 rpm-ostree`::load_filelists_cb(repo=<unavailable>, fp=<unavailable>) at dnf-sack.cpp:444:23
frame #12: 0x000055a4fce7cad6 rpm-ostree`load_ext(_DnfSack*, libdnf::Repo*, _hy_repo_repodata, char const*, char const*, int (*)(s_Repo*, _IO_FILE*), _GError**) at dnf-sack.cpp:430:13
frame #13: 0x000055a4fce7df60 rpm-ostree`dnf_sack_load_repo at dnf-sack.cpp:1789:26
frame #14: 0x000055a4fce7eee9 rpm-ostree`dnf_sack_add_repo at dnf-sack.cpp:2217:28
frame #15: 0x000055a4fce7f0fb rpm-ostree`dnf_sack_add_repos at dnf-sack.cpp:2271:32
frame #16: 0x000055a4fce870ee rpm-ostree`dnf_context_setup_sack_with_flags at dnf-context.cpp:1796:29
frame #17: 0x000055a4fcdf757f rpm-ostree`rpmostree_context_download_metadata at rpmostree-core.cxx:1206:44
frame #18: 0x000055a4fcdf95c3 rpm-ostree`rpmostree_context_prepare at rpmostree-core.cxx:2001:48
frame #19: 0x000055a4fce54ab7 rpm-ostree`rpmostree_sysroot_upgrader_prep_layering at rpmostree-sysroot-upgrader.cxx:1018:38
frame #20: 0x000055a4fcdcb143 rpm-ostree`deploy_transaction_execute(_RpmostreedTransaction*, _GCancellable*, _GError**) at rpmostreed-transaction-types.cxx:1445:49
frame #21: 0x000055a4fcdba4cd rpm-ostree`transaction_execute_thread(_GTask*, void*, void*, _GCancellable*) at rpmostreed-transaction.cxx:340:34
frame #22: 0x00007fd61c58f7e2 libgio-2.0.so.0`g_task_thread_pool_thread + 114
frame #23: 0x00007fd61c3d7e54 libglib-2.0.so.0`g_thread_pool_thread_proxy.lto_priv.0 + 116
frame #24: 0x00007fd61c3d52b2 libglib-2.0.so.0`g_thread_proxy + 82
frame #25: 0x00007fd61b8af3f9 libpthread.so.0`start_thread + 233
frame #26: 0x00007fd61b9c9903 libc.so.6`__clone + 67
(lldb)
```
2021-02-03 00:54:38 +03:00
%configure --disable-silent-rules --enable-gtk-doc %{?sqlite_rpmdb_default} %{?with_sanitizers:--enable-sanitizers}
2020-07-22 18:54:49 +03:00
%make_build
2014-01-16 06:54:48 +04:00
%install
2020-07-22 18:54:49 +03:00
%make_install INSTALL=" i n s t a l l - p - c "
2015-04-09 00:20:50 +03:00
find $RPM_BUILD_ROOT -name '*.la' -delete
2014-01-16 06:54:48 +04:00
2017-03-07 17:00:56 +03:00
# I try to do continuous delivery via rpmdistro-gitoverlay while
# reusing the existing spec files. Currently RPM only supports
# mandatory file entries. What this is doing is making each file
# entry optional - if it exists it will be picked up. That
# way the same spec file works more easily across multiple versions where e.g. an
# older version might not have a systemd unit file.
cat > autofiles.py <<EOF
import os,sys,glob
os.chdir(os.environ['RPM_BUILD_ROOT' ])
for line in sys.argv[1:]:
if line == '' :
break
if line[0] != '/' :
sys.stdout.write(line + '\n' )
else:
files = glob.glob(line[1:])
if len(files) > 0:
sys.stderr.write('{0} matched {1} files\n' .format(line, len(files)))
sys.stdout.write(line + '\n' )
else:
sys.stderr.write('{0} did not match any files\n' .format(line))
EOF
2019-09-06 22:25:27 +03:00
PYTHON=python3
if ! test -x /usr/bin/python3; then
PYTHON=python2
fi
$PYTHON autofiles.py > files \
2017-03-07 17:00:56 +03:00
'%{_bindir}/*' \
'%{_libdir}/%{name}' \
'%{_mandir}/man*/*' \
2019-09-16 18:51:13 +03:00
'%{_datadir}/dbus-1/system.d/*' \
2019-09-06 22:25:27 +03:00
'%{_sysconfdir}/rpm-ostreed.conf' \
2017-03-07 17:00:56 +03:00
'%{_prefix}/lib/systemd/system/*' \
'%{_libexecdir}/rpm-ostree*' \
2019-09-06 22:25:27 +03:00
'%{_datadir}/polkit-1/actions/*.policy' \
2017-06-09 13:52:01 +03:00
'%{_datadir}/dbus-1/system-services' \
2019-09-06 22:25:27 +03:00
'%{_datadir}/bash-completion/completions/*'
$PYTHON autofiles.py > files.lib \
'%{_libdir}/*.so.*' \
'%{_libdir}/girepository-1.0/*.typelib'
$PYTHON autofiles.py > files.devel \
2017-03-07 17:00:56 +03:00
'%{_libdir}/lib*.so' \
'%{_includedir}/*' \
2019-09-06 22:25:27 +03:00
'%{_datadir}/dbus-1/interfaces/org.projectatomic.rpmostree1.xml' \
2017-03-07 17:00:56 +03:00
'%{_libdir}/pkgconfig/*' \
'%{_datadir}/gtk-doc/html/*' \
'%{_datadir}/gir-1.0/*-1.0.gir'
2015-04-09 00:20:50 +03:00
2017-03-07 17:00:56 +03:00
%files -f files
2019-09-06 21:38:59 +03:00
%doc COPYING.GPL COPYING.LGPL LICENSE README.md
2014-02-24 02:27:56 +04:00
2019-09-06 22:25:27 +03:00
%files libs -f files.lib
2014-03-10 22:19:29 +04:00
2019-09-06 22:25:27 +03:00
%files devel -f files.devel