| Message ID | 20241020150843.1068181-1-raj.khem@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | [meta-oe,v3] snapper: add recipe | expand |
Hi Markus, this fails with installed-vs-shipped when libdir isn't /usr/lib: ERROR: lib32-snapper-0.11.2-r0 do_package: QA Issue: lib32-snapper: Files/directories were installed but not shipped in any package: /usr/lib/systemd /usr/lib/systemd/system /usr/lib/systemd/system/snapper-timeline.timer /usr/lib/systemd/system/snapper-timeline.service /usr/lib/systemd/system/snapper-boot.timer /usr/lib/systemd/system/snapper-cleanup.timer /usr/lib/systemd/system/snapperd.service /usr/lib/systemd/system/snapper-boot.service /usr/lib/systemd/system/snapper-cleanup.service /usr/lib/snapper/systemd-helper /usr/lib/snapper/installation-helper /usr/lib/snapper/plugins Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install. lib32-snapper: 12 installed and not shipped files. [installed-vs-shipped] I've started to modify https://github.com/openSUSE/snapper/blob/master/data/Makefile.am to respect configured libdir (and datadir and systemd paths), but it's not that simple as /usr/lib is also hardcoded for the plugins: snapper/Hooks.cc:#define GRUB_SCRIPT "/usr/lib/snapper/plugins/grub" snapper/Hooks.cc:#define ROLLBACK_SCRIPT "/usr/lib/snapper/plugins/rollback" snapper/PluginsImpl.cc:#define GRUB_SCRIPT "/usr/lib/snapper/plugins/grub" snapper/PluginsImpl.cc:#define ROLLBACK_SCRIPT "/usr/lib/snapper/plugins/rollback" snapper/SnapperDefines.h:#define PLUGINS_DIR "/usr/lib/snapper/plugins" should the packaging be changed to use nonarch_libdir and let lib32-snapper and snapper conflict with each other? Or is there some better way to resolve this? I'm not planning to use snapper, this was just new failure detected in my world builds. Regards, On Sun, Oct 20, 2024 at 5:08 PM Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote: > > 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" > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#113067): https://lists.openembedded.org/g/openembedded-devel/message/113067 > Mute This Topic: https://lists.openembedded.org/mt/109116183/3617156 > Group Owner: openembedded-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Hi Martin,
I think it might help to replace ${libdir}/systemd with
${systemd_system_unitdir} in FILES:${PN}
On Thu, Oct 24 2024 at 12:47:46 PM +02:00:00, Martin Jansa
<martin.jansa@gmail.com> wrote:
> Hi Markus,
>
> this fails with installed-vs-shipped when libdir isn't /usr/lib:
>
> ERROR: lib32-snapper-0.11.2-r0 do_package: QA Issue: lib32-snapper:
> Files/directories were installed but not shipped in any package:
> /usr/lib/systemd
> /usr/lib/systemd/system
> /usr/lib/systemd/system/snapper-timeline.timer
> /usr/lib/systemd/system/snapper-timeline.service
> /usr/lib/systemd/system/snapper-boot.timer
> /usr/lib/systemd/system/snapper-cleanup.timer
> /usr/lib/systemd/system/snapperd.service
> /usr/lib/systemd/system/snapper-boot.service
> /usr/lib/systemd/system/snapper-cleanup.service
> /usr/lib/snapper/systemd-helper
> /usr/lib/snapper/installation-helper
> /usr/lib/snapper/plugins
> Please set FILES such that these items are packaged. Alternatively if
> they are unneeded, avoid installing them or delete them within
> do_install.
> lib32-snapper: 12 installed and not shipped files.
> [installed-vs-shipped]
>
> I've started to modify
> <https://github.com/openSUSE/snapper/blob/master/data/Makefile.am> to
> respect configured libdir (and datadir and systemd paths), but it's
> not that simple as /usr/lib is also hardcoded for the plugins:
> snapper/Hooks.cc:#define GRUB_SCRIPT "/usr/lib/snapper/plugins/grub"
> snapper/Hooks.cc:#define ROLLBACK_SCRIPT
> "/usr/lib/snapper/plugins/rollback"
> snapper/PluginsImpl.cc:#define GRUB_SCRIPT
> "/usr/lib/snapper/plugins/grub"
> snapper/PluginsImpl.cc:#define ROLLBACK_SCRIPT
> "/usr/lib/snapper/plugins/rollback"
> snapper/SnapperDefines.h:#define PLUGINS_DIR
> "/usr/lib/snapper/plugins"
>
> should the packaging be changed to use nonarch_libdir and let
> lib32-snapper and snapper conflict with each other? Or is there some
> better way to resolve this?
>
> I'm not planning to use snapper, this was just new failure detected in
> my world builds.
>
> Regards,
>
> On Sun, Oct 20, 2024 at 5:08 PM Khem Raj via lists.openembedded.org
> <raj.khem=gmail.com@lists.openembedded.org
> <mailto:raj.khem=gmail.com@lists.openembedded.org>> wrote:
>>
>> From: Markus Volk <f_l_k@t-online.de <mailto: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
>> <mailto:f_l_k@t-online.de>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com
>> <mailto: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 <mailto: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
>> <mailto: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 <mailto: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
>> <mailto:f_l_k@t-online.de>>
>> +Signed-off-by: Khem Raj <raj.khem@gmail.com
>> <mailto: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"
>> <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://0001-include-linux-types.h-for-__u16-__u32-__u64-type.patch/>
>> \
>> + file://0002-Use-statvfs-instead-of-statvfs64.patch
>> <file://0002-use-statvfs-instead-of-statvfs64.patch/> \
>> +"
>> +SRCREV = "6c603565f36e9996d85045c8012cd04aba5f3708"
>> +
>> +S = "${WORKDIR}/git"
>> +
>> +EXTRA_OECONF += "--disable-zypp"
>> +
>> +PACKAGECONFIG ?= "${@bb.utils.filter
>> <mailto:${@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"
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#113067):
>> <https://lists.openembedded.org/g/openembedded-devel/message/113067>
>> Mute This Topic:
>> <https://lists.openembedded.org/mt/109116183/3617156>
>> Group Owner: openembedded-devel+owner@lists.openembedded.org
>> <mailto:openembedded-devel+owner@lists.openembedded.org>
>> Unsubscribe:
>> <https://lists.openembedded.org/g/openembedded-devel/unsub>
>> [martin.jansa@gmail.com <mailto:martin.jansa@gmail.com>]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
On Thu, Oct 24 2024 at 12:47:46 PM +02:00:00, Martin Jansa <martin.jansa@gmail.com> wrote: > should the packaging be changed to use nonarch_libdir and let > lib32-snapper and snapper conflict with each other? Or is there some > better way to resolve this? Using systemd_system_unitdir will also basically just use nonarch_libdir. But I wouldn't have a problem with them conflicting each other. I only need snapper for some experiments. Thanks for looking into this
Yes, systemd_system_unitdir helps with the systemd files, but the other files: /usr/lib/snapper/systemd-helper /usr/lib/snapper/installation-helper /usr/lib/snapper/plugins don't use systemd_system_unitdir and as the path to them is hardcoded in the source, I guess we should either hardcode the path in FILES as well (so that they are still packaged and found in runtime even if someone changes libdir value) or change both the code and the packaging to respect libdir (which might be too much to ask after looking at the Makefile.am). I have a .patch file to change Makefile.am to allow passing PREFIX, LIBDIR, DATADIR, SYSTEMDDIR values, but then I've noticed plugins and helpers and stopped there (as I changing that as well to respect passed LIBDIR) should be at least partially tested in runtime which I wasn't planning to. Sending PR with just Makefile.am changes and asking the developers to "finish it" also probably won't help much, so I've just sent previous e-mail and added SKIP_RECIPE in our DISTRO with multilib. I can share the draft PR if someone finds that useful. Cheers, On Thu, Oct 31, 2024 at 6:43 PM Markus Volk <f_l_k@t-online.de> wrote: > > On Thu, Oct 24 2024 at 12:47:46 PM +02:00:00, Martin Jansa <martin.jansa@gmail.com> wrote: > > should the packaging be changed to use nonarch_libdir and let lib32-snapper and snapper conflict with each other? Or is there some better way to resolve this? > > > Using systemd_system_unitdir will also basically just use nonarch_libdir. But I wouldn't have a problem with them conflicting each other. I only need snapper for some experiments. Thanks for looking into this
On Thu, Oct 31, 2024 at 7:15 PM Martin Jansa via lists.openembedded.org <martin.jansa=gmail.com@lists.openembedded.org> wrote: > > Yes, systemd_system_unitdir helps with the systemd files, but the other files: > /usr/lib/snapper/systemd-helper > /usr/lib/snapper/installation-helper > /usr/lib/snapper/plugins > > don't use systemd_system_unitdir and as the path to them is hardcoded > in the source, I guess we should either hardcode the path in FILES as > well (so that they are still packaged and found in runtime even if > someone changes libdir value) or change both the code and the > packaging to respect libdir (which might be too much to ask after > looking at the Makefile.am). > > I have a .patch file to change Makefile.am to allow passing PREFIX, > LIBDIR, DATADIR, SYSTEMDDIR values, but then I've noticed plugins and > helpers and stopped there (as I changing that as well to respect > passed LIBDIR) should be at least partially tested in runtime which I > wasn't planning to. Sending PR with just Makefile.am changes and > asking the developers to "finish it" also probably won't help much, so > I've just sent previous e-mail and added SKIP_RECIPE in our DISTRO > with multilib. I can share the draft PR if someone finds that useful. Added libdir configuration for those paths and here is slightly updated version: https://git.openembedded.org/meta-openembedded-contrib/log/?h=jansa/snapper completely not tested in runtime, I've only checked that lib32-snapper builds without installed-vs-shipped and the most files look in expected locations (but I guess /usr/lib32/security/pam_snapper.so should be moved to nonarch libdir, so it would need separate configure param from currently used libdir). Not sure if this was worth it :). lib32-snapper/0.11.2 $ find image/usr/lib* image/usr/lib image/usr/lib/systemd image/usr/lib/systemd/system image/usr/lib/systemd/system/snapper-boot.timer image/usr/lib/systemd/system/snapperd.service image/usr/lib/systemd/system/snapper-boot.service image/usr/lib/systemd/system/snapper-timeline.timer image/usr/lib/systemd/system/snapper-cleanup.service image/usr/lib/systemd/system/snapper-cleanup.timer image/usr/lib/systemd/system/snapper-timeline.service image/usr/lib32 image/usr/lib32/libsnapper.so image/usr/lib32/libsnapper.so.7 image/usr/lib32/snapper image/usr/lib32/snapper/systemd-helper image/usr/lib32/snapper/plugins image/usr/lib32/snapper/testsuite image/usr/lib32/snapper/testsuite/owner1 image/usr/lib32/snapper/testsuite/CAUTION image/usr/lib32/snapper/testsuite/permissions2 image/usr/lib32/snapper/testsuite/xattrs3 image/usr/lib32/snapper/testsuite/error4 image/usr/lib32/snapper/testsuite/xattrs4 image/usr/lib32/snapper/testsuite/setup-and-run-all image/usr/lib32/snapper/testsuite/ug-tests image/usr/lib32/snapper/testsuite/ascii-file image/usr/lib32/snapper/testsuite/xattrs1 image/usr/lib32/snapper/testsuite/xattrs2 image/usr/lib32/snapper/testsuite/directory1 image/usr/lib32/snapper/testsuite/owner3 image/usr/lib32/snapper/testsuite/permissions3 image/usr/lib32/snapper/testsuite/test-btrfsutils image/usr/lib32/snapper/testsuite/error1 image/usr/lib32/snapper/testsuite/permissions1 image/usr/lib32/snapper/testsuite/missing-directory1 image/usr/lib32/snapper/testsuite/simple1 image/usr/lib32/snapper/testsuite/owner2 image/usr/lib32/snapper/testsuite/error2 image/usr/lib32/snapper/testsuite/run-all image/usr/lib32/snapper/installation-helper image/usr/lib32/pam_snapper image/usr/lib32/pam_snapper/pam_snapper_useradd.sh image/usr/lib32/pam_snapper/pam_snapper_pamconfig.sh image/usr/lib32/pam_snapper/pam_snapper_homeconvert.sh image/usr/lib32/pam_snapper/pam_snapper_userdel.sh image/usr/lib32/security image/usr/lib32/security/pam_snapper.so image/usr/lib32/libsnapper.so.7.4.3
On Thu, Oct 31 2024 at 11:45:59 PM +01:00:00, Martin Jansa
<martin.jansa@gmail.com> wrote:
> Not sure if this was worth it :).
An easy way to hack this might also be something like this ?
# Did this just for testing purpose
export nonarch_libdir = "/usr/lib32"
do_install:append() {
if [ ! "${libdir}" = "${nonarch_libdir}" ]; then mkdir
${D}${nonarch_libdir};mv ${D}${libdir}/snapper
${D}${nonarch_libdir}/snapper; fi
}
FILES:${PN} += "${nonarch_libdir}/snapper ${libdir}/pam_snapper
${systemd_system_unitdir} ${libdir}/security ${datadir}"
Since I'm not building multilib, I just did an export for
nonarch_libdir to have a difference here for testing. Kind of seemed to
work.
The 'mkdir' command is probably only needed in my testcase, because if
building multilib the ${D}${nonarch_libdir} directory is presumably
already present
Not pretty but eventually less maintainance than a patch
I have now set up a multilib build environment to see exactly how that
works. If I haven't forgotten anything, it was easier than I thought. I
added the following to local.conf:
require conf/multilib.conf
MULTILIBS = āmultilib:lib32ā
DEFAULTTUNE:virtclass-multilib-lib32 = āx86ā
IMAGE_INSTALL:append = ā lib32-glibc lib32-libgcc lib32-libstdc++
snapper lib32-snapperā
Then set FILES:${PN} like this:
FILES:${PN} += ā${nonarch_libdir} ${systemd_system_unitdir}
${datadir}ā
And I was able to build core-image-minimal with both snapper and
lib32-snapper installed without facing any conflicts in do_rootfs
On Fri, Nov 1 2024 at 07:59:35 AM +01:00:00, Markus Volk
<f_l_k@t-online.de> wrote:
> On Thu, Oct 31 2024 at 11:45:59 PM +01:00:00, Martin Jansa
> <martin.jansa@gmail.com> wrote:
>> Not sure if this was worth it :).
>
> An easy way to hack this might also be something like this ?
>
> # Did this just for testing purpose
> export nonarch_libdir = "/usr/lib32"
>
> do_install:append() {
> if [ ! "${libdir}" = "${nonarch_libdir}" ]; then mkdir
> ${D}${nonarch_libdir};mv ${D}${libdir}/snapper
> ${D}${nonarch_libdir}/snapper; fi
> }
>
>
> FILES:${PN} += "${nonarch_libdir}/snapper ${libdir}/pam_snapper
> ${systemd_system_unitdir} ${libdir}/security ${datadir}"
>
> Since I'm not building multilib, I just did an export for
> nonarch_libdir to have a difference here for testing. Kind of seemed
> to work.
> The 'mkdir' command is probably only needed in my testcase, because
> if building multilib the ${D}${nonarch_libdir} directory is
> presumably already present
>
> Not pretty but eventually less maintainance than a patch
Sounds good enough to me and as you said simpler than patching it. Thanks for looking into this. On Fri, Nov 1, 2024 at 1:01 PM Markus Volk <f_l_k@t-online.de> wrote: > > I have now set up a multilib build environment to see exactly how that works. If I haven't forgotten anything, it was easier than I thought. I added the following to local.conf: > > require conf/multilib.conf > MULTILIBS = ā multilib:lib32ā > DEFAULTTUNE:virtclass-multilib-lib32 = ā x86ā > IMAGE_INSTALL:append = ā lib32-glibc lib32-libgcc lib32-libstdc++ snapper lib32-snapperā > > Then set FILES:${PN} like this: > FILES:${PN} += ā ${nonarch_libdir} ${systemd_system_unitdir} ${datadir}ā > > And I was able to build core-image-minimal with both snapper and lib32-snapper installed without facing any conflicts in do_rootfs > > > > On Fri, Nov 1 2024 at 07:59:35 AM +01:00:00, Markus Volk <f_l_k@t-online.de> wrote: > > On Thu, Oct 31 2024 at 11:45:59 PM +01:00:00, Martin Jansa <martin.jansa@gmail.com> wrote: > > Not sure if this was worth it :). > > > An easy way to hack this might also be something like this ? > > # Did this just for testing purpose > export nonarch_libdir = "/usr/lib32" > > do_install:append() { > if [ ! "${libdir}" = "${nonarch_libdir}" ]; then mkdir ${D}${nonarch_libdir};mv ${D}${libdir}/snapper ${D}${nonarch_libdir}/snapper; fi > } > > > FILES:${PN} += "${nonarch_libdir}/snapper ${libdir}/pam_snapper ${systemd_system_unitdir} ${libdir}/security ${datadir}" > > Since I'm not building multilib, I just did an export for nonarch_libdir to have a difference here for testing. Kind of seemed to work. > The 'mkdir' command is probably only needed in my testcase, because if building multilib the ${D}${nonarch_libdir} directory is presumably already present > > Not pretty but eventually less maintainance than a patch
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"