diff mbox series

[meta-filesystems] fuse-archive: Fix build with libarchive where RPM is a format

Message ID 20260729013047.42869-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-filesystems] fuse-archive: Fix build with libarchive where RPM is a format | expand

Commit Message

Khem Raj July 29, 2026, 1:30 a.m. UTC
From: Khem Raj <raj.khem@gmail.com>

oe-core carries a backport of libarchive PR #2846 (see
0003-Convert-RPM-reader-into-a-proper-format-supporting-b.patch, added
for RPM 6 support) which converts the RPM reader from a filter into a
proper format. That drops archive_read_support_filter_rpm() from the
public API in favour of archive_read_support_format_rpm(), and
fuse-archive fails to compile:

  lib/reader.cc:509:9: error: use of undeclared identifier
      archive_read_support_filter_rpm

Add a patch selecting the available entry point at compile time.
ARCHIVE_FORMAT_RPM is defined by archive.h only in versions providing
the new format, so it is an exact feature test and the recipe keeps
building against both stock and patched libarchive.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...ibarchive-builds-where-RPM-is-a-form.patch | 49 +++++++++++++++++++
 .../fuse-archive/fuse-archive_1.22.bb         |  4 +-
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive/0001-reader-Support-libarchive-builds-where-RPM-is-a-form.patch
diff mbox series

Patch

diff --git a/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive/0001-reader-Support-libarchive-builds-where-RPM-is-a-form.patch b/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive/0001-reader-Support-libarchive-builds-where-RPM-is-a-form.patch
new file mode 100644
index 0000000000..ae6d681509
--- /dev/null
+++ b/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive/0001-reader-Support-libarchive-builds-where-RPM-is-a-form.patch
@@ -0,0 +1,49 @@ 
+From 2d7f7e39af9d68360997434c7680a644d7127987 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Jul 2026 18:00:36 -0700
+Subject: [PATCH] reader: Support libarchive builds where RPM is a format
+
+libarchive is moving the RPM reader from a filter to a proper format
+(libarchive PR #2846), which drops archive_read_support_filter_rpm()
+from the public API in favour of archive_read_support_format_rpm().
+Distributions carrying that change (e.g. OpenEmbedded, which needs it
+for RPM 6 support) fail to build fuse-archive with:
+
+  lib/reader.cc:509:9: error: use of undeclared identifier
+      'archive_read_support_filter_rpm'
+
+Pick the available API at compile time. ARCHIVE_FORMAT_RPM is defined by
+archive.h only in versions that provide the new format entry point, so it
+is a reliable feature test.
+
+The new format appends the payload decompression filter itself based on
+the RPM PAYLOADCOMPRESSOR tag, so the remaining registrations are kept
+unchanged and stay harmless.
+
+Reported upstream - https://github.com/google/fuse-archive/issues/63
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/reader.cc | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/lib/reader.cc b/lib/reader.cc
+index f336fa0..5bc3708 100644
+--- a/lib/reader.cc
++++ b/lib/reader.cc
+@@ -506,7 +506,13 @@ void Reader::SetRarFormat() {
+
+ void Reader::SetRpmFormat() {
+   Archive* const a = archive.get();
++#ifdef ARCHIVE_FORMAT_RPM
++  // Newer libarchive handles RPM as a format rather than as a filter, and
++  // appends the payload decompression filter itself.
++  Check(archive_read_support_format_rpm(a));
++#else
+   Check(archive_read_support_filter_rpm(a));
++#endif
+   Check(archive_read_support_filter_gzip(a));
+   Check(archive_read_support_filter_lzip(a));
+   Check(archive_read_support_filter_lzma(a));
diff --git a/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive_1.22.bb b/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive_1.22.bb
index a4daa47c50..729062adef 100644
--- a/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive_1.22.bb
+++ b/meta-filesystems/recipes-filesystems/fuse-archive/fuse-archive_1.22.bb
@@ -6,7 +6,9 @@  SECTION = "base"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"

-SRC_URI = "git://github.com/google/fuse-archive.git;branch=main;protocol=https;tag=v${PV}"
+SRC_URI = "git://github.com/google/fuse-archive.git;branch=main;protocol=https;tag=v${PV} \
+           file://0001-reader-Support-libarchive-builds-where-RPM-is-a-form.patch \
+           "
 SRCREV = "e218685189aabebb95d33e2542e2a122ea81392d"

 DEPENDS = "boost fuse3 libarchive"