commit:     5045727a6420f1c11a1fdd9e97cfd58b90766051
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 23 22:42:35 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 23 22:42:35 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5045727a

dev-util/ostree: fix build w/ glibc 2.36, fix configure bashism

Closes: https://bugs.gentoo.org/863689
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/ostree/files/ostree-2022.5-bashism.patch  |  35 ++++++
 .../ostree/files/ostree-2022.5-glibc-2.36.patch    | 127 +++++++++++++++++++++
 dev-util/ostree/ostree-2022.5-r1.ebuild            | 114 ++++++++++++++++++
 3 files changed, 276 insertions(+)

diff --git a/dev-util/ostree/files/ostree-2022.5-bashism.patch 
b/dev-util/ostree/files/ostree-2022.5-bashism.patch
new file mode 100644
index 000000000000..1cf217de744b
--- /dev/null
+++ b/dev-util/ostree/files/ostree-2022.5-bashism.patch
@@ -0,0 +1,35 @@
+https://github.com/ostreedev/ostree/pull/2702
+
+From c568073d1e6a5e602a6df29eaa5b7392e076f5d6 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Tue, 23 Aug 2022 23:37:06 +0100
+Subject: [PATCH] buildutil/glibtests.m4: fix bashism
+
+configure scripts need to be runnable with a POSIX-compliant /bin/sh.
+
+On many (but not all!) systems, /bin/sh is provided by Bash, so errors
+like this aren't spotted. Notably Debian defaults to /bin/sh provided
+by dash which doesn't tolerate such bashisms as '=='.
+
+This retains compatibility with bash.
+
+Fixes configure warnings/errors like:
+```
+
+checking whether to build static libraries... no
+./configure: 14795: test: unexpected operator
+```
+
+Signed-off-by: Sam James <[email protected]>
+--- a/buildutil/glibtests.m4
++++ b/buildutil/glibtests.m4
+@@ -25,7 +25,7 @@ AC_DEFUN([GLIB_TESTS],
+                   *) AC_MSG_ERROR([bad value ${enableval} for 
--enable-always-build-tests]) ;;
+                  esac])
+   AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test 
"$ENABLE_ALWAYS_BUILD_TESTS" = "1")
+-  if test "$ENABLE_INSTALLED_TESTS" == "1"; then
++  if test "$ENABLE_INSTALLED_TESTS" = "1"; then
+     AC_SUBST(installed_test_metadir, 
[${datadir}/installed-tests/]AC_PACKAGE_NAME)
+     AC_SUBST(installed_testdir, 
[${libexecdir}/installed-tests/]AC_PACKAGE_NAME)
+   fi
+

diff --git a/dev-util/ostree/files/ostree-2022.5-glibc-2.36.patch 
b/dev-util/ostree/files/ostree-2022.5-glibc-2.36.patch
new file mode 100644
index 000000000000..6d01e96a09c8
--- /dev/null
+++ b/dev-util/ostree/files/ostree-2022.5-glibc-2.36.patch
@@ -0,0 +1,127 @@
+https://bugs.gentoo.org/863689
+https://github.com/ostreedev/ostree/commit/edba4b33be10c05253bfa94895dfbc8477e44d76
+https://github.com/ostreedev/ostree/commit/0a908a180fcce98c2565b9fb34470e5953918260
+
+From edba4b33be10c05253bfa94895dfbc8477e44d76 Mon Sep 17 00:00:00 2001
+From: Colin Walters <[email protected]>
+Date: Wed, 3 Aug 2022 10:37:40 -0400
+Subject: [PATCH] Remove unused `linux/fs.h` includes
+
+Prep for fixing conflicts introduced by newer glibc.
+cc https://github.com/ostreedev/ostree/issues/2685
+--- a/src/libostree/ostree-repo-commit.c
++++ b/src/libostree/ostree-repo-commit.c
+@@ -30,7 +30,6 @@
+ #include <sys/xattr.h>
+ #include <glib/gprintf.h>
+ #include <sys/ioctl.h>
+-#include <linux/fs.h>
+ #include <ext2fs/ext2_fs.h>
+ 
+ #include "otutil.h"
+--- a/src/ostree/ot-main.c
++++ b/src/ostree/ot-main.c
+@@ -28,7 +28,6 @@
+ #include <string.h>
+ #include <sys/statvfs.h>
+ #include <sys/mount.h>
+-#include <linux/fs.h>
+ 
+ #include "ot-main.h"
+ #include "ostree.h"
+
+From 0a908a180fcce98c2565b9fb34470e5953918260 Mon Sep 17 00:00:00 2001
+From: Colin Walters <[email protected]>
+Date: Wed, 3 Aug 2022 10:43:43 -0400
+Subject: [PATCH] Move FIFREEZE/FITHAW ioctl invocations into linuxfsutil.c
+
+Should help avoid conflicts between glibc and linux headers.
+
+Closes: https://github.com/ostreedev/ostree/issues/2685
+--- a/src/libostree/ostree-linuxfsutil.c
++++ b/src/libostree/ostree-linuxfsutil.c
+@@ -24,10 +24,12 @@
+ 
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
++// This should be the only file including linux/fs.h; see
++// 
https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
++// https://github.com/ostreedev/ostree/issues/2685
++#include <linux/fs.h>
+ #include <ext2fs/ext2_fs.h>
+ 
+-#include "otutil.h"
+-
+ /**
+  * _ostree_linuxfs_fd_alter_immutable_flag:
+  * @fd: A file descriptor
+@@ -88,3 +90,21 @@ _ostree_linuxfs_fd_alter_immutable_flag (int            fd,
+ 
+   return TRUE;
+ }
++
++/* Wrapper for FIFREEZE ioctl.
++ * This is split into a separate wrapped API for
++ * reasons around conflicts between glibc and linux/fs.h
++ * includes; see above.
++ */
++int
++_ostree_linuxfs_filesystem_freeze (int fd)
++{
++  return TEMP_FAILURE_RETRY (ioctl (fd, FIFREEZE, 0));
++}
++
++/* Wrapper for FITHAW ioctl.  See above. */
++int
++_ostree_linuxfs_filesystem_thaw (int fd)
++{
++  return TEMP_FAILURE_RETRY (ioctl (fd, FITHAW, 0));
++}
+--- a/src/libostree/ostree-linuxfsutil.h
++++ b/src/libostree/ostree-linuxfsutil.h
+@@ -29,4 +29,7 @@ _ostree_linuxfs_fd_alter_immutable_flag (int            fd,
+                                          GCancellable  *cancellable,
+                                          GError       **error);
+ 
++int _ostree_linuxfs_filesystem_freeze (int fd);
++int _ostree_linuxfs_filesystem_thaw (int fd);
++
+ G_END_DECLS
+--- a/src/libostree/ostree-sysroot-deploy.c
++++ b/src/libostree/ostree-sysroot-deploy.c
+@@ -29,7 +29,6 @@
+ #include <sys/ioctl.h>
+ #include <stdbool.h>
+ #include <sys/poll.h>
+-#include <linux/fs.h>
+ #include <err.h>
+ 
+ #ifdef HAVE_LIBMOUNT
+@@ -1476,7 +1475,7 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
+            * EOPNOTSUPP: If the filesystem doesn't support it
+            */
+           int saved_errno = errno;
+-          (void) TEMP_FAILURE_RETRY (ioctl (rootfs_dfd, FITHAW, 0));
++          _ostree_linuxfs_filesystem_thaw (rootfs_dfd);
+           errno = saved_errno;
+           /* But if we got an error from poll, let's log it */
+           if (r < 0)
+@@ -1517,7 +1516,7 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
+           return glnx_throw (error, "aborting due to test-fifreeze");
+         }
+       /* Do a freeze/thaw cycle; TODO add a FIFREEZETHAW ioctl */
+-      if (ioctl (rootfs_dfd, FIFREEZE, 0) != 0)
++      if (_ostree_linuxfs_filesystem_freeze (rootfs_dfd) != 0)
+         {
+           /* Not supported, we're running in the unit tests (as non-root), or
+            * the filesystem is already frozen (EBUSY).
+@@ -1539,7 +1538,7 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
+             return glnx_throw_errno_prefix (error, "ioctl(FIFREEZE)");
+         }
+       /* And finally thaw, then signal our completion to the watchdog */
+-      if (TEMP_FAILURE_RETRY (ioctl (rootfs_dfd, FITHAW, 0)) != 0)
++      if (_ostree_linuxfs_filesystem_thaw (rootfs_dfd) != 0)
+         {
+           /* Warn but don't error if the filesystem was already thawed */
+           if (errno == EINVAL)
+

diff --git a/dev-util/ostree/ostree-2022.5-r1.ebuild 
b/dev-util/ostree/ostree-2022.5-r1.ebuild
new file mode 100644
index 000000000000..5500d617d7b6
--- /dev/null
+++ b/dev-util/ostree/ostree-2022.5-r1.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools systemd
+
+DESCRIPTION="Operating system and container binary deployment and upgrades"
+HOMEPAGE="https://ostreedev.github.io/ostree/";
+SRC_URI="https://github.com/ostreedev/ostree/releases/download/v${PV}/lib${P}.tar.xz
 -> ${P}.tar.xz"
+
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
+LICENSE="LGPL-2+"
+SLOT="0"
+
+IUSE="archive +curl doc dracut gnutls +gpg grub +http2 httpd introspection 
libmount selinux sodium ssl +soup systemd zeroconf"
+RESTRICT+=" test"
+REQUIRED_USE="
+       dracut? ( systemd )
+       http2? ( curl )
+       httpd? ( || ( curl soup ) )
+"
+
+COMMON_DEPEND="
+       app-arch/xz-utils
+       dev-libs/libassuan
+       dev-libs/glib:2
+       sys-fs/fuse:3
+       sys-libs/zlib
+       archive? ( app-arch/libarchive:= )
+       curl? ( net-misc/curl )
+       dracut? ( sys-kernel/dracut )
+       gpg? (
+               app-crypt/gpgme:=
+               dev-libs/libgpg-error
+       )
+       grub? ( sys-boot/grub:2= )
+       introspection? ( dev-libs/gobject-introspection )
+       libmount? ( sys-apps/util-linux )
+       selinux? ( sys-libs/libselinux )
+       sodium? ( >=dev-libs/libsodium-1.0.14:= )
+       soup? ( net-libs/libsoup:2.4 )
+       ssl? (
+               gnutls? ( net-libs/gnutls:= )
+               !gnutls? (
+                       dev-libs/openssl:0=
+               )
+       )
+       systemd? ( sys-apps/systemd:0= )
+       zeroconf? ( net-dns/avahi[dbus] )"
+
+DEPEND="${COMMON_DEPEND}
+       app-text/docbook-xsl-stylesheets
+       dev-libs/libxslt
+       doc? ( dev-util/gtk-doc )"
+
+RDEPEND="${COMMON_DEPEND}"
+BDEPEND="
+       dev-util/glib-utils
+       sys-devel/flex
+       sys-devel/bison
+       virtual/pkgconfig"
+
+S="${WORKDIR}/lib${P}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-glibc-2.36.patch
+       "${FILESDIR}"/${P}-bashism.patch
+)
+
+src_prepare() {
+       default
+
+       sed -Ee 's:(XSLT_STYLESHEET = 
).*:\1/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl:' \
+               -i Makefile.in Makefile-man.am || die
+
+       eautoreconf
+}
+
+src_configure() {
+       local econfargs=(
+               --enable-man
+               --enable-shared
+               --with-grub2-mkconfig-path=grub-mkconfig
+               --with-modern-grub
+               $(use_with archive libarchive)
+               $(use_with curl)
+               $(use_with dracut dracut yesbutnoconf) #816867
+               $(use_enable doc gtk-doc)
+               $(usex introspection --enable-introspection={,} yes no)
+               $(use_with gpg gpgme)
+               $(use_enable http2)
+               $(use_enable httpd trivial-httpd-cmdline)
+               $(use_with selinux )
+               $(use_with soup)
+               $(use_with libmount)
+               $(use ssl && { use gnutls && echo --with-crypto=gnutls || echo 
--with-crypto=openssl; })
+               $(use_with sodium ed25519-libsodium)
+               $(use_with systemd libsystemd)
+               $(use_with zeroconf avahi)
+       )
+
+       if use systemd; then
+               
econfargs+=(--with-systemdsystemunitdir="$(systemd_get_systemunitdir)")
+       fi
+
+       unset ${!XDG_*} #657346 g-ir-scanner sandbox violation
+       econf "${econfargs[@]}"
+}
+
+src_install() {
+       default
+       find "${D}" -name '*.la' -delete || die
+}

Reply via email to