diff mbox series

[meta-oe,scarthgap] postgresql: Break perl RDEPENDS

Message ID 20240730203342.5123-1-mr.scada@gmail.com
State Accepted
Headers show
Series [meta-oe,scarthgap] postgresql: Break perl RDEPENDS | expand

Commit Message

Barry G July 30, 2024, 8:33 p.m. UTC
Currently, any non-native recipes that inherits cpan-base ends up
with an image RDEPENDS on perl (via
https://git.yoctoproject.org/poky/tree/meta/classes-recipe/cpan-base.bbclass?h=scarthgap#n14)

If you are building an image and desire to have Postgresql installed
but NOT perl, this creates a problem. This changeset attempts
to fix this shortcoming by not inheriting cpan-base directly.

Note this work is a continuation of attempts to change cpan-base:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=15563

The Postgresql build system uses perl, so add it as a DEPENDS. This
happened previously via the "inherit cpan-base" directive.

I've validated this recipe successfully packages with and without
the perl PACKAGECONFIG in Scarthgap.

Signed-off-by: Barry Grussling <mr.scada@gmail.com>
---
 meta-oe/recipes-dbs/postgresql/postgresql.inc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Ross Burton Aug. 5, 2024, 3:20 p.m. UTC | #1
> On 30 Jul 2024, at 21:33, Barry Grussling via lists.openembedded.org <mr.scada=gmail.com@lists.openembedded.org> wrote:
> -DEPENDS = "libnsl2 readline tzcode-native"
> +DEPENDS = "libnsl2 readline tzcode-native perl”

This is a mandatory dependency on target perl, even if perl isn’t enabled.  Is this actually needed, as there’s a dependency on target perl in the perl PACKAGECONFIG already.

Ross
Barry G Aug. 5, 2024, 4:07 p.m. UTC | #2
On Mon, Aug 5, 2024 at 8:20 AM Ross Burton <Ross.Burton@arm.com> wrote:
> > On 30 Jul 2024, at 21:33, Barry Grussling via lists.openembedded.org <mr.scada=gmail.com@lists.openembedded.org> wrote:
> > -DEPENDS = "libnsl2 readline tzcode-native"
> > +DEPENDS = "libnsl2 readline tzcode-native perl”
>
> This is a mandatory dependency on target perl, even if perl isn’t enabled.  Is this actually needed, as there’s a dependency on target perl in the perl PACKAGECONFIG already.

In my testing the build wasn't successful without the perl hard-depend
(even with perl off via the PACKAGECONFIG). I wrote it off as needed
as I know Postgresql previously had a perl requirement in its build
system.

Previous to this change, we would have had a hard DEPEND requirement
on perl via the cpan-base inherit:
https://git.yoctoproject.org/poky/tree/meta/classes-recipe/cpan-base.bbclass?h=scarthgap#n13
(or perl-native).

I'll do some testing today and see if I can learn more or remove it.

Barry
Barry G Aug. 5, 2024, 6:57 p.m. UTC | #3
On Mon, Aug 5, 2024 at 8:20 AM Ross Burton <Ross.Burton@arm.com> wrote:

> > On 30 Jul 2024, at 21:33, Barry Grussling via lists.openembedded.org <mr.scada=gmail.com@lists.openembedded.org> wrote:
> > -DEPENDS = "libnsl2 readline tzcode-native"
> > +DEPENDS = "libnsl2 readline tzcode-native perl”
>
> This is a mandatory dependency on target perl, even if perl isn’t enabled.  Is this actually needed, as there’s a dependency on target perl in the perl PACKAGECONFIG already.

Currently, perl appears to be a build dependency for Postgresql. With
the PACKAGECONFIG disabling perl, and without the perl DEPENDS, I get:

Can't locate Config_heavy-target.pl in @INC (@INC entries checked:
/srv/tmp/work/[snip]) at
/srv/tmp/work/cortexa72-cortexa53-poky-linux/postgresql/16.3/recipe-sysroot-native/usr/bin/perl-native/../../../usr/lib/perl5/5.38.2/x86_64-linux/Config.pm
line 88.

WARNING: Backtrace (BB generated script):
    #1: autotools_do_configure,
/srv/tmp/work/cortexa72-cortexa53-poky-linux/postgresql/16.3/temp/run.do_configure.2395430,
line 246
    #2: do_configure,
/srv/tmp/work/cortexa72-cortexa53-poky-linux/postgresql/16.3/temp/run.do_configure.2395430,
line 165
    #3: main, /srv/tmp/work/cortexa72-cortexa53-poky-linux/postgresql/16.3/temp/run.do_configure.2395430,
line 356

The postgresql install-requirements
(https://www.postgresql.org/docs/current/install-requirements.html)
says
Perl 5.14 or later is needed under various circumstances. I'm guessing autotools
is trying to run perl for something.

I agree that removing the perl DEPENDS is an additional goal.

Barry
diff mbox series

Patch

diff --git a/meta-oe/recipes-dbs/postgresql/postgresql.inc b/meta-oe/recipes-dbs/postgresql/postgresql.inc
index e29a5bef77..7f15cc869b 100644
--- a/meta-oe/recipes-dbs/postgresql/postgresql.inc
+++ b/meta-oe/recipes-dbs/postgresql/postgresql.inc
@@ -19,7 +19,7 @@  DESCRIPTION = "\
 "
 HOMEPAGE = "http://www.postgresql.com"
 LICENSE = "0BSD"
-DEPENDS = "libnsl2 readline tzcode-native"
+DEPENDS = "libnsl2 readline tzcode-native perl"
 
 ARM_INSTRUCTION_SET = "arm"
 
@@ -37,7 +37,7 @@  LEAD_SONAME = "libpq.so"
 export LDFLAGS_SL = "${LDFLAGS}"
 export LDFLAGS_EX_BE = "-Wl,--export-dynamic"
 
-inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext cpan-base multilib_header
+inherit autotools pkgconfig perlnative python3native python3targetconfig useradd update-rc.d systemd gettext perl-version multilib_header
 
 CFLAGS += "-I${STAGING_INCDIR}/${PYTHON_DIR} -I${STAGING_INCDIR}/tcl8.6"
 
@@ -122,6 +122,12 @@  python populate_packages:prepend() {
 
 }
 
+# Same as the function in cpan-base.bbclass (but without the perl RDEPENDS)
+def is_target(d):
+    if not bb.data.inherits_class('native', d):
+        return "yes"
+    return "no"
+
 # This will make native perl use target settings (for include dirs etc.)
 export PERLCONFIGTARGET = "${@is_target(d)}"
 export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"