Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for release 0.9.0 #199

Merged
merged 5 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
SUBDIRS=libcomposefs tools tests

CLEANFILES=

MANPAGES=\
man/mount.composefs.md \
man/mkcomposefs.md

EXTRA_DIST=\
composefs.pc.in \
composefs.spec.in \
composefs.spec
composefs.spec \
${MANPAGES}

pkgconfig_DATA = composefs.pc

if ENABLE_MAN

man/%.1: man/%.md
pandoc $+ -s -t man > $@
mkdir -p man
${PANDOC} $+ -s -t man > $@

man1_MANS = $(MANPAGES:.md=.1)

CLEANFILES += ${man1_MANS}

install-man: man/mount.composefs.1 man/mkcomposefs.1
install -m 644 -D --target-directory=$(DESTDIR)$(mandir)/man1 $^
endif
10 changes: 7 additions & 3 deletions composefs.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ License: GPLv2+
URL: https://github.com/containers/composefs
Source0: https://github.com/containers/composefs/releases/download/%{version}/%{name}-%{version}.tar.xz

BuildRequires: gcc automake libtool openssl-devel yajl-devel
BuildRequires: gcc automake libtool openssl-devel yajl-devel pandoc fuse3-devel
Requires: %{name}-libs = %{version}-%{release}

%description
Expand All @@ -31,8 +31,10 @@ Library files for %{name}.

%build
%configure \
--disable-static

--disable-static \
--enable-man \
--with-yajl \
--with-fuse
%make_build

%install
Expand All @@ -51,7 +53,9 @@ rm -rf %{buildroot}%{_libdir}/libcomposefs.la
%license COPYING COPYING.LIB
%doc README.md
%{_bindir}/mkcomposefs
%{_bindir}/composefs-info
%{_sbindir}/mount.composefs
%{_mandir}/man*/*.gz

%changelog
* Fri Apr 21 2023 Alexander Larsson <[email protected]>
Expand Down
20 changes: 19 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ([2.69])
AC_INIT([composefs], [0.1.4], [[email protected]])
AC_INIT([composefs], [0.9.0], [[email protected]])
AC_CONFIG_SRCDIR([tools/mkcomposefs.c])
AC_CONFIG_HEADERS([config.h])
AC_SYS_LARGEFILE
Expand Down Expand Up @@ -69,6 +69,24 @@ AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
done
])

AC_ARG_ENABLE(man,
[AS_HELP_STRING([--enable-man],
[generate man pages [default=auto]])],,
enable_man=maybe)

AS_IF([test "$enable_man" != no], [
AC_PATH_PROG([PANDOC], [pandoc])
AS_IF([test -z "$PANDOC"], [
AS_IF([test "$enable_man" = yes], [
AC_MSG_ERROR([pandoc is required for --enable-man])
])
enable_man=no
],[
enable_man=yes
])
])
AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)

##################################################
# Visibility handling
##################################################
Expand Down
10 changes: 9 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ if ENABLE_VALGRIND
VALGRIND_PREFIX=libtool --mode=execute ${VALGRIND} --quiet --leak-check=yes --error-exitcode=42
endif

EXTRA_DIST = test-checksums.sh $(patsubst %,assets/%,${TEST_ASSETS_SMALL}) $(patsubst %,assets/%.sha256_erofs,${TEST_ASSETS_SMALL})
EXTRA_DIST = \
gendir \
dumpdir \
test-lib.sh \
test-units.sh \
test-random-fuse.sh \
test-checksums.sh \
integration.sh \
$(patsubst %,assets/%,${TEST_ASSETS_SMALL}) $(patsubst %,assets/%.sha256_erofs,${TEST_ASSETS_SMALL})

check-checksums:
VALGRIND_PREFIX="${VALGRIND_PREFIX}" $(srcdir)/test-checksums.sh "$(builddir)/../tools/" "$(srcdir)/assets" "${TEST_ASSETS}"
Expand Down
2 changes: 1 addition & 1 deletion tests/test-checksums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BINDIR="$1"
ASSET_DIR="$2"
TEST_ASSETS="$3"

. test-lib.sh
. $(dirname $0)/test-lib.sh

has_fsck=$(check_erofs_fsck)

Expand Down
10 changes: 5 additions & 5 deletions tests/test-random-fuse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exit_cleanup() {

trap exit_cleanup EXIT

. test-lib.sh
. $(dirname $0)/test-lib.sh

GENDIRARGS=""
if [ ${can_whiteout} == "n" ]; then
Expand All @@ -25,8 +25,8 @@ fi

test_random() {
echo Generating root dir
./gendir $GENDIRARGS $workdir/root
./dumpdir --userxattr --whiteout $workdir/root > $workdir/root.dump
$(dirname $0)/gendir $GENDIRARGS $workdir/root
$(dirname $0)/dumpdir --userxattr --whiteout $workdir/root > $workdir/root.dump
echo Generating composefs image
${VALGRIND_PREFIX} ${BINDIR}/mkcomposefs --digest-store=$workdir/objects $workdir/root $workdir/root.cfs
if [ $has_fsck == y ]; then
Expand All @@ -49,7 +49,7 @@ test_random() {
mkdir -p $workdir/mnt
echo Mounting composefs image using fuse
${BINDIR}/composefs-fuse -o source=$workdir/root.cfs,basedir=$workdir/objects $workdir/mnt
./dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse.dump
$(dirname $0)/dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse.dump

${VALGRIND_PREFIX} ${BINDIR}/mkcomposefs --digest-store=$workdir/objects $workdir/mnt $workdir/fuse.cfs
if [ $has_fsck == y ]; then
Expand All @@ -65,7 +65,7 @@ test_random() {
fi

${BINDIR}/composefs-fuse -o source=$workdir/fuse.cfs,basedir=$workdir/objects $workdir/mnt
./dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse2.dump
$(dirname $0)/dumpdir --userxattr --whiteout $workdir/mnt > $workdir/fuse2.dump
umount $workdir/mnt

# fuse.cfs and fuse2.cfs files differ due to whiteout conversions and non-user xattrs.
Expand Down
2 changes: 1 addition & 1 deletion tests/test-units.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e
workdir=$(mktemp -d /var/tmp/lcfs-test.XXXXXX)
trap 'rm -rf -- "$workdir"' EXIT

. test-lib.sh
. $(dirname $0)/test-lib.sh

function makeimage () {
local dir=$1
Expand Down
10 changes: 8 additions & 2 deletions tools/composefs-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ static void print_node(struct lcfs_node_s *node, char *parent_path)
for (size_t i = 0; i < lcfs_node_get_n_children(node); i++) {
struct lcfs_node_s *child = lcfs_node_get_child(node, i);
cleanup_free char *path = NULL;
int r;

asprintf(&path, "%s/%s", parent_path, lcfs_node_get_name(child));
r = asprintf(&path, "%s/%s", parent_path, lcfs_node_get_name(child));
if (r < 0)
oom();

uint32_t mode = lcfs_node_get_mode(child);
uint32_t type = mode & S_IFMT;
Expand Down Expand Up @@ -198,8 +201,11 @@ static void dump_node(struct lcfs_node_s *node, char *path)
for (size_t i = 0; i < lcfs_node_get_n_children(node); i++) {
struct lcfs_node_s *child = lcfs_node_get_child(node, i);
cleanup_free char *child_path = NULL;
int r;

asprintf(&child_path, "%s/%s", path, lcfs_node_get_name(child));
r = asprintf(&child_path, "%s/%s", path, lcfs_node_get_name(child));
if (r < 0)
oom();

dump_node(child, child_path);
}
Expand Down
Loading