Skip to contentSkip to conversation

postgresql: Break perl RDEPENDS

PATCH In review Barry Grussling 2 participants 4 messages Jul 30, 2024 – Aug 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 postgresql: Break perl RDEPENDS

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.

---
 meta-oe/recipes-dbs/postgresql/postgresql.inc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
meta-oe/recipes-dbs/postgresql/postgresql.inc +8 -2
index e29a5bef77..7f15cc869b 100644
@@ -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)}"
Signature · 1 line
2.45.2
#1 lore raw

Review

Quoted 5 lines · Barry Grussling via lists.openembedded.org
(quoted diff) +1 -1
-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

author
#2 lore raw
Quoted 5 lines · Ross Burton

Review

Quoted 3 lines · Barry Grussling via lists.openembedded.org
(quoted diff) +1 -1
-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

author
#3 lore raw
In reply to Ross Burton
Quoted 5 lines · Ross Burton

Review

Quoted 3 lines · Barry Grussling via lists.openembedded.org
(quoted diff) +1 -1
-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