Switch to external composefs
authorColin Walters <walters@verbum.org>
Thu, 15 Feb 2024 15:15:26 +0000 (10:15 -0500)
committerColin Walters <walters@verbum.org>
Fri, 12 Apr 2024 20:16:21 +0000 (16:16 -0400)
Since there's now a stable shared library, let's use it.

.gitmodules
Makefile-libostree.am
Makefile-switchroot.am
Makefile.am
autogen.sh
ci/installdeps.sh
composefs [deleted submodule]
configure.ac

index da3863f6e336bdb64977883817983e24eddbc8ea..00d1685de8e7f8da7b543d4d3ff95b62262b46ec 100644 (file)
@@ -4,6 +4,3 @@
 [submodule "bsdiff"]
        path = bsdiff
        url = https://github.com/mendsley/bsdiff
-[submodule "composefs"]
-       path = composefs
-       url = https://github.com/containers/composefs.git
index b80be2e9f0609b5dc9812276ee84cb9bbee5bc2e..b18e1c236ccbf1db0d30aaa6a451145d7f90707a 100644 (file)
@@ -186,7 +186,7 @@ EXTRA_DIST += \
        $(top_srcdir)/src/libostree/libostree-released.sym \
        $(NULL)
 
-libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/composefs -I$(srcdir)/src/libotutil -I$(srcdir)/src/libotcore -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
+libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libotcore -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
     -I$(srcdir)/src/switchroot \
        $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_CRYPTO_CFLAGS) \
        -fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern' \
@@ -265,7 +265,7 @@ libostree_1_la_SOURCES += \
        $(NULL)
 
 if USE_COMPOSEFS
-libostree_1_la_LIBADD += libcomposefs.la
+libostree_1_la_LIBADD += $(OT_DEP_COMPOSEFS_LIBS)
 endif # USE_COMPOSEFS
 
 # XXX: work around clang being passed -fstack-clash-protection which it doesn't understand
index 1e458e0e2c5e9fdec5237467d1b8c118f88f6fd8..9a1d41371f88827527451a13917413b6fc5a4c13 100644 (file)
@@ -49,7 +49,7 @@ ostree-prepare-root : $(ostree_prepare_root_SOURCES)
 CLEANFILES += ostree-prepare-root
 else
 ostree_boot_PROGRAMS += ostree-prepare-root
-ostree_prepare_root_CFLAGS += $(AM_CFLAGS) -Isrc/switchroot -I$(srcdir)/composefs -I$(srcdir)/src/libostree -I$(srcdir)/src/libotcore -I$(srcdir)/src/libotutil
+ostree_prepare_root_CFLAGS += $(AM_CFLAGS) -Isrc/switchroot -I$(srcdir)/src/libostree -I$(srcdir)/src/libotcore -I$(srcdir)/src/libotutil
 ostree_prepare_root_SOURCES += src/switchroot/ostree-prepare-root.c
 ostree_prepare_root_CPPFLAGS += $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_DEP_CRYPTO_CFLAGS) -I $(srcdir)/libglnx
 ostree_prepare_root_LDADD += $(AM_LDFLAGS) $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_DEP_CRYPTO_LIBS) libotcore.la libotutil.la libglnx.la
@@ -69,7 +69,7 @@ ostree_remount_LDADD += $(OT_DEP_SELINUX_LIBS)
 endif
 
 if USE_COMPOSEFS
-ostree_prepare_root_LDADD += libcomposefs.la
+ostree_prepare_root_LDADD += $(OT_DEP_COMPOSEFS_LIBS)
 endif
 
 if BUILDOPT_SYSTEMD
index 19abc0c1e177a08e97f46e919aee8b3ea2db0956..ddaf790ed70566fbd8b6dbe5f9f01200758e0fc6 100644 (file)
@@ -117,14 +117,8 @@ include bsdiff/Makefile-bsdiff.am.inc
 EXTRA_DIST += bsdiff/Makefile-bsdiff.am
 noinst_LTLIBRARIES += libbsdiff.la
 
-COMPOSEFSDIR=$(srcdir)/composefs/libcomposefs
 LCFS_DEP_CRYPTO_CFLAGS=$(OT_DEP_CRYPTO_CFLAGS)
 LCFS_DEP_CRYPTO_LIBS=$(OT_DEP_CRYPTO_LIBS)
-include composefs/libcomposefs/Makefile-lib.am.inc
-EXTRA_DIST += composefs/libcomposefs/Makefile-lib.am
-if USE_COMPOSEFS
-noinst_LTLIBRARIES += libcomposefs.la
-endif
 
 include Makefile-otutil.am
 include Makefile-otcore.am
index ea2412c4e91e9a9eeaac679f8cb98d9706d91a5e..689bba8f89327186e98b47062b179b225dabbad0 100755 (executable)
@@ -35,7 +35,6 @@ fi
 # changing this, please also change Makefile.am.
 sed -e 's,$(libglnx_srcpath),libglnx,g' < libglnx/Makefile-libglnx.am >libglnx/Makefile-libglnx.am.inc
 sed -e 's,$(libbsdiff_srcpath),bsdiff,g' < bsdiff/Makefile-bsdiff.am >bsdiff/Makefile-bsdiff.am.inc
-sed -e 's,$(COMPOSEFSDIR),composefs/libcomposefs,g' < composefs/libcomposefs/Makefile-lib.am >composefs/libcomposefs/Makefile-lib.am.inc
 
 # FIXME - figure out how to get aclocal to find this by default
 ln -sf ../libglnx/libglnx.m4 buildutil/libglnx.m4
index f63e2d4ea6554baff1e5818bde79a18bac0c95a7..d71240e5e649e8f87a4715f5af0ee48adecd35c4 100755 (executable)
@@ -17,6 +17,8 @@ dn=$(dirname $0)
 pkg_upgrade
 pkg_install_buildroot
 pkg_builddep ostree
+# Not yet in the spec
+pkg_install composefs-devel
 pkg_install sudo which attr fuse strace \
     libubsan libasan libtsan redhat-rpm-config \
     elfutils fsverity-utils
diff --git a/composefs b/composefs
deleted file mode 160000 (submodule)
index 2d5cdcb..0000000
--- a/composefs
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 2d5cdcb9176cfe4ccf1761ef6d78e1c48de35649
index 6b30cd9f41d52ee0bffe77a1b3650c1853f8d4b5..e0cc51bc7d450da6a547027118fe428be257dfd0 100644 (file)
@@ -284,53 +284,25 @@ AS_IF([test x$have_gpgme = xyes],
 )
 AM_CONDITIONAL(USE_GPGME, test "x$have_gpgme" = xyes)
 
-dnl composefs won't work at all without this
-AC_CHECK_HEADERS([endian.h sys/endian.h machine/endian.h])
-AC_CHECK_FUNCS([reallocarray])
-AC_MSG_CHECKING([for MOUNT_ATTR_IDMAP])
-AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM([
-                       #include <sys/mount.h>
-                       #include <linux/mount.h>
-  ],[int foo = MOUNT_ATTR_IDMAP;]
-       )],
-       [AC_MSG_RESULT(yes)
-               AC_DEFINE([HAVE_MOUNT_ATTR_IDMAP], 1, [Define if MOUNT_ATTR_IDMAP is available in linux/mount.h])
-               have_mount_attr_idmap=yes],
-       [AC_MSG_RESULT(no)])
-dnl These are needed by libcomposefs to use the new mount API optionally
-AC_MSG_CHECKING([for new mount API (fsconfig)])
-AC_COMPILE_IFELSE(
-       [AC_LANG_SOURCE([[
-                       #include <sys/mount.h>
-                       int cmd = FSCONFIG_CMD_CREATE;
-       ]])],
-       [AC_MSG_RESULT(yes)
-                AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_SYS_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in sys/mount.h])],
-       [AC_MSG_RESULT(no)])
-AC_COMPILE_IFELSE(
-       [AC_LANG_SOURCE([[
-                       /* also make sure it doesn't conflict with <sys/mount.h> since it is always used.  */
-                       #include <sys/mount.h>
-                       #include <linux/mount.h>
-                       int cmd = FSCONFIG_CMD_CREATE;
-       ]])],
-       [AC_MSG_RESULT(yes)
-                AC_DEFINE([HAVE_FSCONFIG_CMD_CREATE_LINUX_MOUNT_H], 1, [Define if FSCONFIG_CMD_CREATE is available in linux/mount.h])],
-       [AC_MSG_RESULT(no)])
-
-composefs_default=yes
-if test x"$have_mount_attr_idmap" != xyes; then
-  composefs_default=no
-fi
 AC_ARG_WITH(composefs,
-           AS_HELP_STRING([--with-composefs], [Support composefs]),
-           :, with_composefs=$composefs_default)
-
-if test x$with_composefs != xno; then OSTREE_FEATURES="$OSTREE_FEATURES composefs";
-   AC_DEFINE([HAVE_COMPOSEFS], 1, [Define if we have libcomposefs])
-fi
-AM_CONDITIONAL(USE_COMPOSEFS, test $with_composefs != no)
+           AS_HELP_STRING([--with-composefs], [Support composefs (default yes)]),
+           :, with_composefs=maybe)
+
+have_composefs=no
+AS_IF([ test x$with_composefs != xno ], [
+    AC_MSG_CHECKING([for composefs])
+    PKG_CHECK_EXISTS(composefs, have_composefs=yes, have_composefs=no)
+    AC_MSG_RESULT([$have_composefs])
+    AS_IF([ test x$have_composefs = xno && test x$with_composefs != xmaybe ], [
+       AC_MSG_ERROR([composefs is enabled but could not be found])
+    ])
+    AS_IF([ test x$have_composefs = xyes], [
+      PKG_CHECK_MODULES(OT_DEP_COMPOSEFS, [composefs])
+      OSTREE_FEATURES="$OSTREE_FEATURES composefs";
+      AC_DEFINE([HAVE_COMPOSEFS], 1, [Define if we have libcomposefs])
+    ])
+])
+AM_CONDITIONAL(USE_COMPOSEFS, test x$have_composefs = xyes)
 
 LIBSODIUM_DEPENDENCY="1.0.14"
 AC_ARG_WITH(ed25519_libsodium,
@@ -737,7 +709,7 @@ echo "
     dracut:                                       $with_dracut
     mkinitcpio:                                   $with_mkinitcpio
     Static compiler for ostree-prepare-root:      $with_static_compiler
-    Composefs:                                    $with_composefs"
+    Composefs:                                    $have_composefs"
 AS_IF([test x$with_builtin_grub2_mkconfig = xyes], [
     echo "    builtin grub2-mkconfig (instead of system):   $with_builtin_grub2_mkconfig"
 ], [