squashfs-tools: always install prebuilt manpage

Message ID 20220516104207.1734099-1-changqing.li@windriver.com
State New
Headers show
Series squashfs-tools: always install prebuilt manpage | expand

Commit Message

Changqing Li May 16, 2022, 10:42 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

When other feature enabled, and involve help2man into squashfs-tools's
recipe-sysroot-native, install-manpages.sh will run target binary on
build host, eg: mksquashfs --help, which will cause error.
Eg:
 ../squashfs-tools/mksquashfs: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ../squashfs-tools/mksquashfs)
| help2man: can't get `--help' info from /tmp/tmp.pEG5R8COVb/mksquashfs.sh
| Try `--no-discard-stderr' if option outputs to stderr
| ./mksquashfs-manpage.sh: help2man returned error.  Aborting
| ../generate-manpages/install-manpages.sh: Failed to generate manpage.  Aborting

Fixed by always install prebuilt manpage, avoid running target binary on
build host

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...ools-always-install-prebuilt-manpage.patch | 48 +++++++++++++++++++
 .../squashfs-tools/squashfs-tools_git.bb      |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-devtools/squashfs-tools/files/0001-squashfs-tools-always-install-prebuilt-manpage.patch

Comments

Richard Purdie May 16, 2022, 10:54 a.m. UTC | #1
On Mon, 2022-05-16 at 18:42 +0800, Changqing Li wrote:
> From: Changqing Li <changqing.li@windriver.com>
> 
> When other feature enabled, and involve help2man into squashfs-tools's
> recipe-sysroot-native, install-manpages.sh will run target binary on
> build host, eg: mksquashfs --help, which will cause error.
> Eg:
>  ../squashfs-tools/mksquashfs: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ../squashfs-tools/mksquashfs)
> > help2man: can't get `--help' info from /tmp/tmp.pEG5R8COVb/mksquashfs.sh
> > Try `--no-discard-stderr' if option outputs to stderr
> > ./mksquashfs-manpage.sh: help2man returned error.  Aborting
> > ../generate-manpages/install-manpages.sh: Failed to generate manpage.  Aborting
> 
> Fixed by always install prebuilt manpage, avoid running target binary on
> build host
> 
> Signed-off-by: Changqing Li <changqing.li@windriver.com>

I'd much prefer not to carry a patch doing this. Which "other feature
enabled" trigger this to happen?

We might want to talk to upstream about making this configurable rather
than carrying a patch, or we make sure help2man is never accessible to
this recipe in some other way.

Cheers,

Richard
Richard Purdie May 17, 2022, 7:32 a.m. UTC | #2
On Tue, 2022-05-17 at 02:27 +0000, Li, Changqing wrote:
> 
> 
> From: richard.purdie@linuxfoundation.org
> <richard.purdie@linuxfoundation.org>
> Sent: Monday, May 16, 2022 6:54 PM
> To: Li, Changqing <Changqing.Li@windriver.com>;
> openembedded-core@lists.openembedded.org
> <openembedded-core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] squashfs-tools: always install
> prebuilt manpage 
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> On Mon, 2022-05-16 at 18:42 +0800, Changqing Li wrote:
> > From: Changqing Li <changqing.li@windriver.com>
> > 
> > When other feature enabled, and involve help2man into squashfs-
> > tools's
> > recipe-sysroot-native, install-manpages.sh will run target binary
> > on
> > build host, eg: mksquashfs --help, which will cause error.
> > Eg:
> >   ../squashfs-tools/mksquashfs: /lib/x86_64-linux-gnu/libc.so.6:
> > version `GLIBC_2.34' not found (required by ../squashfs-
> > tools/mksquashfs)
> > > help2man: can't get `--help' info from
> > > /tmp/tmp.pEG5R8COVb/mksquashfs.sh
> > > Try `--no-discard-stderr' if option outputs to stderr
> > > ./mksquashfs-manpage.sh: help2man returned error.  Aborting
> > > ../generate-manpages/install-manpages.sh: Failed to generate
> > > manpage.  Aborting
> > 
> > Fixed by always install prebuilt manpage, avoid running target
> > binary on
> > build host
> > 
> > Signed-off-by: Changqing Li <changqing.li@windriver.com>
> 
> I'd much prefer not to carry a patch doing this. Which "other feature
> enabled" trigger this to happen?
> 
> When  meta-secure-core  is involved,  and DISTRO_FEATURES efi-secure-
> boot and ima is enabled,  
> in meta-signing-key/classes/user-key-store.bbclass,  it will add
> DEPENDS as following:
> DEPENDS:append:class-target = " \
>     ${@bb.utils.contains("DISTRO_FEATURES", "efi-secure-boot",
> "sbsigntool-native", "", d)} \
>     ${@bb.utils.contains("DISTRO_FEATURES", "efi-secure-boot",
> "libsign-native", "", d)} \
>     openssl-native \
>     ${@bb.utils.contains("DISTRO_FEATURES", "efi-secure-boot",
> "efitools-native gnupg-native", "", d)} \
> "
> 
> and efitools-native  DEPENDS  on  help2man-native,  so all target
> depends on help2man-native.
> efitools's manpage also don't configurable.
> 
> We might want to talk to upstream about making this configurable
> rather
> than carrying a patch, or we make sure help2man is never accessible
> to
> this recipe in some other way.
> 
> I will talk to upstream about this first.

What would also probably help is adding help2man-native to
SSTATE_EXCLUDEDEPS_SYSROOT in layer.conf in OE-Core.

That runs the risk of triggering some build failures as it did when we
added pkgconfig-native there but is probably the right thing to do. It
would force recipes that want help2man-native to have an explicit
DEPENDS so we'd have to test and fix any recipes that needed that
adding.

Cheers,

Richard

Patch

diff --git a/meta/recipes-devtools/squashfs-tools/files/0001-squashfs-tools-always-install-prebuilt-manpage.patch b/meta/recipes-devtools/squashfs-tools/files/0001-squashfs-tools-always-install-prebuilt-manpage.patch
new file mode 100644
index 0000000000..2d0b350074
--- /dev/null
+++ b/meta/recipes-devtools/squashfs-tools/files/0001-squashfs-tools-always-install-prebuilt-manpage.patch
@@ -0,0 +1,48 @@ 
+From 9bf47880ebb0fafd36226ac7fd1c2e8dffc9bc64 Mon Sep 17 00:00:00 2001
+From: Changqing Li <changqing.li@windriver.com>
+Date: Mon, 16 May 2022 17:57:07 +0800
+Subject: [PATCH] squashfs-tools: always install prebuilt manpage
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ generate-manpages/install-manpages.sh | 22 +++++-----------------
+ 1 file changed, 5 insertions(+), 17 deletions(-)
+
+diff --git a/generate-manpages/install-manpages.sh b/generate-manpages/install-manpages.sh
+index 6a43b89..770f15a 100755
+--- a/generate-manpages/install-manpages.sh
++++ b/generate-manpages/install-manpages.sh
+@@ -27,23 +27,11 @@ cd $1/generate-manpages
+ #
+ # If help2man doesn't exist, use the pre-built manpages.
+ 
+-if ! which help2man > /dev/null 2>&1; then
+-	echo "$0: ERROR - No help2man in PATH.  Cannot generate manpages." >&2
+-	echo "WARNING: Installing pre-built manpages." >&2
+-	echo "WARNING: These pages are built with the Makefile defaults, and all" >&2
+-	echo "WARNING: the compressors configured (except the deprecated lzma).  This may not" >&2
+-	echo "WARNING: match your build configuation." >&2
+-	source=../manpages
+-else
+-	for i in mksquashfs unsquashfs sqfstar sqfscat; do
+-		if ! ./$i-manpage.sh ../squashfs-tools ../squashfs-tools/$i.1; then
+-			echo "$0: Failed to generate manpage.  Aborting" >&2
+-			exit 1
+-		fi
+-	done
+-
+-	source=../squashfs-tools
+-fi
++echo "WARNING: Installing pre-built manpages." >&2
++echo "WARNING: These pages are built with the Makefile defaults, and all" >&2
++echo "WARNING: the compressors configured (except the deprecated lzma).  This may not" >&2
++echo "WARNING: match your build configuation." >&2
++source=../manpages
+ 
+ if ! mkdir -p $2; then
+ 	echo "$0: Creating manpage install directory failed.  Aborting" >&2
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
index 4e009d2625..3726650e3c 100644
--- a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
@@ -11,6 +11,7 @@  PV = "4.5.1"
 SRCREV = "afdd63fc386919b4aa40d573b0a6069414d14317"
 SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https;branch=master \
            file://0001-install-manpages.sh-do-not-write-original-timestamps.patch \
+           file://0001-squashfs-tools-always-install-prebuilt-manpage.patch \
            "
 UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>(\d+(\.\d+)+))"