ostree: Add recipe

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Alex Kiernan
2019-09-22 13:06:38 +01:00
committed by Khem Raj
parent 1849429a79
commit 59180f9f91
4 changed files with 307 additions and 0 deletions
@@ -0,0 +1,59 @@
From 44e0647230b22cd136ae2fb252ce90eed4751970 Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alex.kiernan@gmail.com>
Date: Wed, 4 Sep 2019 17:29:15 +0100
Subject: [PATCH 1/2] Always enable trivial-httpd for tests
When running tests we always need ostree-trivial-httpd, so enable it
unconditionally
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Upstream-Status: Submitted [https://github.com/ostreedev/ostree/pull/1912]
---
Makefile.am | 1 +
ci/build.sh | 5 +++++
ci/travis-build.sh | 1 +
3 files changed, 7 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index cd04a055045a..673dbf88de55 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,6 +39,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS += \
--enable-gtk-doc \
--enable-man \
--disable-maintainer-mode \
+ --enable-trivial-httpd-cmdline \
$(NULL)
GITIGNOREFILES = aclocal.m4 build-aux/ buildutil/*.m4 config.h.in gtk-doc.make
diff --git a/ci/build.sh b/ci/build.sh
index 0901507498f2..806af050b780 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -22,6 +22,11 @@ case "${CONFIGOPTS:-}" in
fi
;;
esac
+# unless libsoup is disabled, enable trivial-httpd for the tests
+case "${CONFIGOPTS:-}" in
+ *--without-soup*) ;;
+ *) CONFIGOPTS="${CONFIGOPTS:-} --enable-trivial-httpd-cmdline" ;;
+esac
# always fail on warnings; https://github.com/ostreedev/ostree/pull/971
# NB: this disables the default set of flags from configure.ac
diff --git a/ci/travis-build.sh b/ci/travis-build.sh
index 3fd969bdced6..7c85313a2d32 100755
--- a/ci/travis-build.sh
+++ b/ci/travis-build.sh
@@ -85,6 +85,7 @@ make="make -j${ci_parallel} V=1 VERBOSE=1"
../configure \
--enable-always-build-tests \
+ --enable-trivial-httpd-cmdline \
${ci_configopts}
"$@"
--
2.17.1
@@ -0,0 +1,40 @@
From 5a4f2ddb0a6c656b425a3caa41f5af766ed5f44b Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alex.kiernan@gmail.com>
Date: Mon, 9 Sep 2019 14:19:18 +0100
Subject: [PATCH] macros: Add TEMP_FAILURE_RETRY for musl
TEMP_FAILURE_RETRY is glibc specific, add a definition for musl.
See https://github.com/ostreedev/ostree/issues/731
Signed-off-by: Leon Woestenberg <leon@sidebranch.com>
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Upstream-Status: Accepted [https://gitlab.gnome.org/GNOME/libglnx/commit/15c06468804014fc49f6f340132930703f919b19]
---
glnx-macros.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libglnx.glnx-macros.h b/libglnx/glnx-macros.h
index 6d8aca93f8a3..700fc75ceed0 100644
--- a/libglnx.glnx-macros.h
+++ b/libglnx/glnx-macros.h
@@ -31,6 +31,16 @@ G_BEGIN_DECLS
/* All of these are for C only. */
#ifndef __GI_SCANNER__
+/* fixes builds against musl, taken from glibc unistd.h */
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
/* Taken from https://github.com/systemd/systemd/src/basic/string-util.h
* at revision v228-666-gcf6c8c4
*/
--
2.17.1
@@ -0,0 +1,51 @@
From 2629328b39ae117876f4854409c2231220a30b9c Mon Sep 17 00:00:00 2001
From: Alex Kiernan <alex.kiernan@gmail.com>
Date: Thu, 5 Sep 2019 13:22:15 +0100
Subject: [PATCH 2/2] Gate ostree-trivial-httpd on BUILDOPT_TRIVIAL_HTTPD
When building without --enable-trivial-httpd-cmdline, don't build or install
the ostree-trivial-httpd binary.
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Upstream-Status: Submitted [https://github.com/ostreedev/ostree/pull/1912]
---
Makefile-ostree.am | 3 ++-
configure.ac | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile-ostree.am b/Makefile-ostree.am
index 76f39cad4b74..7b53cb148960 100644
--- a/Makefile-ostree.am
+++ b/Makefile-ostree.am
@@ -143,12 +143,13 @@ ostree_SOURCES += src/ostree/ot-builtin-pull.c
endif
if USE_LIBSOUP
-# Eventually once we stop things from using this, we should support disabling this
+if BUILDOPT_TRIVIAL_HTTPD
ostree_SOURCES += src/ostree/ot-builtin-trivial-httpd.c
pkglibexec_PROGRAMS += ostree-trivial-httpd
ostree_trivial_httpd_SOURCES = src/ostree/ostree-trivial-httpd.c
ostree_trivial_httpd_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_SOUP_CFLAGS)
ostree_trivial_httpd_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_SOUP_LIBS)
+endif
if !USE_CURL
# This is necessary for the cookie jar bits
diff --git a/configure.ac b/configure.ac
index 069bab01752e..ffc67980d507 100644
--- a/configure.ac
+++ b/configure.ac
@@ -192,6 +192,9 @@ AC_ARG_ENABLE(trivial-httpd-cmdline,
[Continue to support "ostree trivial-httpd" [default=no]])],,
enable_trivial_httpd_cmdline=no)
AM_CONDITIONAL(BUILDOPT_TRIVIAL_HTTPD, test x$enable_trivial_httpd_cmdline = xyes)
+AS_IF([test x$with_soup = xno && test x$enable_trivial_httpd_cmdline = xyes], [
+ AC_MSG_ERROR([trivial-httpd enabled, but libsoup is not; libsoup is needed for trivial-httpd])
+])
AM_COND_IF(BUILDOPT_TRIVIAL_HTTPD,
[AC_DEFINE([BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE], 1, [Define if we are enabling ostree trivial-httpd entrypoint])]
)
--
2.17.1
@@ -0,0 +1,157 @@
SUMMARY = "Versioned Operating System Repository."
DESCRIPTION = "libostree is both a shared library and suite of command line \
tools that combines a \"git-like\" model for committing and downloading \
bootable filesystem trees, along with a layer for deploying them and managing \
the bootloader configuration."
HOMEPAGE = "https://ostree.readthedocs.io"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
DEPENDS = " \
glib-2.0 \
gpgme \
e2fsprogs \
libcap \
zlib \
xz \
bison-native \
"
# The Yocto mirror has an old export of ostree:
# http://downloads.yoctoproject.org/mirror/sources/git2_github.com.ostreedev.ostree.tar.gz
PREMIRRORS = ""
SRC_URI = " \
gitsm://github.com/ostreedev/ostree \
file://0001-macros-Add-TEMP_FAILURE_RETRY-for-musl.patch \
file://0001-Always-enable-trivial-httpd-for-tests.patch \
file://0002-Gate-ostree-trivial-httpd-on-BUILDOPT_TRIVIAL_HTTPD.patch \
"
SRCREV = "5c1697da78ebf6250a7130b8b9e6cbfbeaa34296"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+)"
S = "${WORKDIR}/git"
inherit autotools bash-completion gobject-introspection gtk-doc pkgconfig systemd
# package configuration - match ostree defaults, but without rofiles-fuse
# otherwise we introduce a dependendency on meta-filesystems
PACKAGECONFIG ??= " \
${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd libmount', '', d)} \
soup \
"
# We include soup because ostree can't (currently) be built without
# soup or curl - https://github.com/ostreedev/ostree/issues/1897
PACKAGECONFIG_class-native ??= " \
${@bb.utils.filter('DISTRO_FEATURES', 'selinux smack', d)} \
soup \
"
PACKAGECONFIG[avahi] = "--with-avahi, --without-avahi, avahi"
PACKAGECONFIG[curl] = "--with-curl, --without-curl, curl"
PACKAGECONFIG[dracut] = "--with-dracut, --without-dracut"
PACKAGECONFIG[gnutls] = "--with-crypto=gnutls, , gnutls"
PACKAGECONFIG[libarchive] = "--with-libarchive, --without-libarchive, libarchive"
PACKAGECONFIG[libmount] = "--with-libmount, --without-libmount, util-linux"
PACKAGECONFIG[man] = "--enable-man, --disable-man, libxslt-native docbook-xsl-stylesheets-native"
PACKAGECONFIG[mkinitcpio] = "--with-mkinitcpio, --without-mkinitcpio"
PACKAGECONFIG[no-http2] = "--disable-http2, --enable-http2"
PACKAGECONFIG[openssl] = "--with-crypto=openssl, , openssl"
PACKAGECONFIG[rofiles-fuse] = "--enable-rofiles-fuse, --disable-rofiles-fuse, fuse"
PACKAGECONFIG[selinux] = "--with-selinux, --without-selinux, libselinux"
PACKAGECONFIG[smack] = "--with-smack, --without-smack, smack"
PACKAGECONFIG[soup] = "--with-soup, --without-soup --disable-glibtest, libsoup-2.4"
PACKAGECONFIG[static] = ""
PACKAGECONFIG[systemd] = "--with-libsystemd --with-systemdsystemunitdir=${systemd_unitdir}/system, --without-libsystemd, systemd"
PACKAGECONFIG[trivial-httpd-cmdline] = "--enable-trivial-httpd-cmdline, --disable-trivial-httpd-cmdline"
EXTRA_OECONF = " \
${@bb.utils.contains('PACKAGECONFIG', 'static', '--with-static-compiler=\'${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}\'', '', d)} \
"
# Makefile-libostree.am overrides this to avoid a build problem with clang,
# but that fix breaks cross compilation and we don't need it
EXTRA_OEMAKE = " \
INTROSPECTION_SCANNER_ENV= \
"
EXTRA_OECONF_class-native = " \
--with-builtin-grub2-mkconfig \
--enable-wrpseudo-compat \
--disable-otmpfile \
"
# Path to ${prefix}/lib/ostree/ostree-grub-generator is hardcoded on the
# do_configure stage so we do depend on it
SYSROOT_DIR = "${STAGING_DIR_TARGET}"
SYSROOT_DIR_class-native = "${STAGING_DIR_NATIVE}"
do_configure[vardeps] += "SYSROOT_DIR"
do_configure_prepend() {
# this reflects what autogen.sh does, but the OE wrappers for autoreconf
# allow it to work without the other gyrations which exist there
cp ${S}/libglnx/Makefile-libglnx.am ${S}/libglnx/Makefile-libglnx.am.inc
cp ${S}/bsdiff/Makefile-bsdiff.am ${S}/bsdiff/Makefile-bsdiff.am.inc
}
do_install_append_class-native() {
create_wrapper ${D}${bindir}/ostree OSTREE_GRUB2_EXEC="${STAGING_LIBDIR_NATIVE}/ostree/ostree-grub-generator"
}
PACKAGES += " \
${PN}-dracut \
${PN}-grub \
${PN}-mkinitcpio \
${PN}-switchroot \
"
FILES_${PN} = " \
${bindir}/ostree \
${bindir}/rofiles-fuse \
${datadir}/${BPN} \
${datadir}/gir-1.0 \
${libdir}/${BPN}/ostree-remount \
${libdir}/girepository-1.0 \
${libdir}/lib*${SOLIBS} \
${libdir}/tmpfiles.d/ostree-tmpfiles.conf \
${libexecdir}/libostree/ostree-trivial-httpd \
${sysconfdir}/ostree/remotes.d \
${systemd_unitdir}/system-generators/ostree-system-generator \
${systemd_unitdir}/system/ostree-finalize-staged.path \
${systemd_unitdir}/system/ostree-finalize-staged.service \
${systemd_unitdir}/system/ostree-remount.service \
"
FILES_${PN}-dracut = " \
${sysconfdir}/dracut.conf.d \
${libdir}/dracut \
"
FILES_${PN}-grub = " \
${sysconfdir}/grub.d \
${libexecdir}/libostree/grub2-15_ostree \
"
FILES_${PN}-mkinitcpio = " \
${sysconfdir}/ostree-mkinitcpio.conf \
${libdir}/initcpio \
"
FILES_${PN}-switchroot = " \
${libdir}/ostree/ostree-prepare-root \
${systemd_unitdir}/system/ostree-prepare-root.service \
"
RDEPENDS_${PN}-dracut = "bash"
RDEPENDS_${PN}-mkinitcpio = "bash"
RDEPENDS_${PN}_class-target = " \
gnupg \
${PN}-switchroot \
"
RRECOMMENDS_${PN} += "kernel-module-overlay"
SYSTEMD_SERVICE_${PN} = "ostree-remount.service ostree-finalize-staged.path"
SYSTEMD_SERVICE_${PN}-switchroot = "ostree-prepare-root.service"
BBCLASSEXTEND = "native"