From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Markus Volk <f_l_k@t-online.de>, Khem Raj <raj.khem@gmail.com>
Subject: [meta-oe][PATCH v3] snapper: add recipe
Date: Sun, 20 Oct 2024 08:08:43 -0700 [thread overview]
Message-ID: <20241020150843.1068181-1-raj.khem@gmail.com> (raw)
From: Markus Volk <f_l_k@t-online.de>
Snapper is a tool for Linux file system snapshot management. Apart from
the obvious creation and deletion of snapshots it can compare snapshots
and revert differences between them. In simple terms, this allows root
and non-root users to view older versions of files and revert changes.
Signed-off-by: Markus Volk <f_l_k@t-online.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v3: More fixes for musl
...x-types.h-for-__u16-__u32-__u64-type.patch | 30 ++++++++++++++
...002-Use-statvfs-instead-of-statvfs64.patch | 37 +++++++++++++++++
.../recipes-support/snapper/snapper_0.11.2.bb | 41 +++++++++++++++++++
3 files changed, 108 insertions(+)
create mode 100644 meta-oe/recipes-support/snapper/snapper/0001-Include-linux-types.h-for-__u16-__u32-__u64-type.patch
create mode 100644 meta-oe/recipes-support/snapper/snapper/0002-Use-statvfs-instead-of-statvfs64.patch
create mode 100644 meta-oe/recipes-support/snapper/snapper_0.11.2.bb
diff --git a/meta-oe/recipes-support/snapper/snapper/0001-Include-linux-types.h-for-__u16-__u32-__u64-type.patch b/meta-oe/recipes-support/snapper/snapper/0001-Include-linux-types.h-for-__u16-__u32-__u64-type.patch
new file mode 100644
index 0000000000..ec8594629e
--- /dev/null
+++ b/meta-oe/recipes-support/snapper/snapper/0001-Include-linux-types.h-for-__u16-__u32-__u64-type.patch
@@ -0,0 +1,30 @@
+From d103eaeae169708ca567f092182a89b79e5ab9db Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 20 Oct 2024 07:52:33 -0700
+Subject: [PATCH 1/2] Include linux/types.h for __u16/__u32/__u64 type
+
+This header is included indirectly with glibc but when using musl
+it ends up with compilation failure
+
+BcachefsUtils.cc:85:20: error: use of undeclared identifier '__u32'
+ 85 | args.dirfd = (__u32) fddst;
+ | ^
+
+Upstream-Status: Submitted [https://github.com/openSUSE/snapper/pull/945]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ snapper/BcachefsUtils.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/snapper/BcachefsUtils.cc b/snapper/BcachefsUtils.cc
+index e9163ffb..1d328a78 100644
+--- a/snapper/BcachefsUtils.cc
++++ b/snapper/BcachefsUtils.cc
+@@ -24,6 +24,7 @@
+
+ #include <cstring>
+ #include <cerrno>
++#include <linux/types.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+
diff --git a/meta-oe/recipes-support/snapper/snapper/0002-Use-statvfs-instead-of-statvfs64.patch b/meta-oe/recipes-support/snapper/snapper/0002-Use-statvfs-instead-of-statvfs64.patch
new file mode 100644
index 0000000000..b915fda257
--- /dev/null
+++ b/meta-oe/recipes-support/snapper/snapper/0002-Use-statvfs-instead-of-statvfs64.patch
@@ -0,0 +1,37 @@
+From 0b39f4484553c796cb300fb4933ea314e91d913b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 20 Oct 2024 07:55:23 -0700
+Subject: [PATCH 2/2] Use statvfs instead of statvfs64
+
+when using LFS64 these functions are same and also
+on 64bit systems they are same. musl is using 64bit off_t
+by default and does not define LFS64 variants of these functions
+and it ends up in build errors
+
+Taken from Alpine Linux: [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/testing/snapper/statvfs64.patch]
+
+Upstream-Status: Submitted [https://github.com/openSUSE/snapper/pull/945]
+
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ snapper/FileUtils.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/snapper/FileUtils.cc b/snapper/FileUtils.cc
+index d4034279..4c8578a1 100644
+--- a/snapper/FileUtils.cc
++++ b/snapper/FileUtils.cc
+@@ -387,9 +387,9 @@ namespace snapper
+ std::pair<unsigned long long, unsigned long long>
+ SDir::statvfs() const
+ {
+- struct statvfs64 fsbuf;
+- if (fstatvfs64(dirfd, &fsbuf) != 0)
+- SN_THROW(IOErrorException(sformat("statvfs64 failed path:%s errno:%d (%s)", base_path.c_str(),
++ struct statvfs fsbuf;
++ if (fstatvfs(dirfd, &fsbuf) != 0)
++ SN_THROW(IOErrorException(sformat("statvfs failed path:%s errno:%d (%s)", base_path.c_str(),
+ errno, stringerror(errno).c_str())));
+
+ // f_bavail is used (not f_bfree) since df seems to do the
diff --git a/meta-oe/recipes-support/snapper/snapper_0.11.2.bb b/meta-oe/recipes-support/snapper/snapper_0.11.2.bb
new file mode 100644
index 0000000000..840c607309
--- /dev/null
+++ b/meta-oe/recipes-support/snapper/snapper_0.11.2.bb
@@ -0,0 +1,41 @@
+SUMMARY = "Snapper is a tool for Linux file system snapshot management"
+HOMEPAGE = "https://github.com/openSUSE/snapper"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+
+DEPENDS = "acl boost btrfs-tools dbus e2fsprogs json-c libxml2 lvm2 ncurses zlib"
+
+# Build separation is slightly broken
+inherit autotools-brokensep pkgconfig gettext
+
+SRC_URI = " \
+ git://github.com/openSUSE/snapper.git;protocol=https;branch=master \
+ file://0001-Include-linux-types.h-for-__u16-__u32-__u64-type.patch \
+ file://0002-Use-statvfs-instead-of-statvfs64.patch \
+"
+SRCREV = "6c603565f36e9996d85045c8012cd04aba5f3708"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF += "--disable-zypp"
+
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'api-documentation systemd pam', d)}"
+PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam"
+PACKAGECONFIG[systemd] = "--enable-systemd,--disable-systemd"
+PACKAGECONFIG[api-documentation] = "--enable-doc,--disable-doc,libxslt-native docbook-xsl-stylesheets-native"
+
+# Avoid HOSTTOOLS path in binaries
+export DIFFBIN = "${bindir}/diff"
+export RMBIN = "${bindir}/rm"
+export TOUCHBIN = "${bindir}/touch"
+export CPBIN = "${bindir}/cp"
+
+
+do_install:append() {
+ install -d ${D}${sysconfdir}/sysconfig
+ install -m0644 ${S}/data/default-config ${D}${sysconfdir}/sysconfig/snapper
+}
+
+FILES:${PN} += "${libdir}/pam_snapper ${libdir}/systemd ${libdir}/security ${datadir}"
+# bash is needed for the testsuite
+RDEPENDS:${PN} = "bash diffutils util-linux util-linux-mount"
next reply other threads:[~2024-10-20 15:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 15:08 Khem Raj [this message]
2024-10-24 10:47 ` [oe] [meta-oe][PATCH v3] snapper: add recipe Martin Jansa
2024-10-31 17:25 ` Markus Volk
2024-10-31 17:45 ` Markus Volk
2024-10-31 18:15 ` Martin Jansa
[not found] ` <18039C488E2C1344.6352@lists.openembedded.org>
2024-10-31 22:45 ` Martin Jansa
2024-11-01 6:59 ` Markus Volk
[not found] ` <1803C5E0EFB35EE5.1077@lists.openembedded.org>
2024-11-01 12:03 ` Markus Volk
2024-11-03 10:36 ` Martin Jansa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241020150843.1068181-1-raj.khem@gmail.com \
--to=raj.khem@gmail.com \
--cc=f_l_k@t-online.de \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox