Skip to content

Commit

Permalink
Switch to external composefs
Browse files Browse the repository at this point in the history
Since there's now a stable shared library, let's use it.
  • Loading branch information
cgwalters committed Dec 3, 2023
1 parent 15d0777 commit 280702e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 54 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Makefile-libostree.am
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Makefile-switchroot.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion composefs
Submodule composefs deleted from cca8be
44 changes: 5 additions & 39 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -283,47 +283,13 @@ 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_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)
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)
AS_HELP_STRING([--with-composefs], [Support composefs (default yes)]),
:, with_composefs=yes)

if test x$with_composefs != xno; then OSTREE_FEATURES="$OSTREE_FEATURES composefs";
if test x$with_composefs = xyes; then
PKG_CHECK_MODULES(OT_DEP_COMPOSEFS, [composefs])
OSTREE_FEATURES="$OSTREE_FEATURES composefs";
AC_DEFINE([HAVE_COMPOSEFS], 1, [Define if we have libcomposefs])
fi
AM_CONDITIONAL(USE_COMPOSEFS, test $with_composefs != no)
Expand Down

0 comments on commit 280702e

Please sign in to comment.