<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15563</bug_id>
          
          <creation_ts>2024-07-24 15:06:34 +0000</creation_ts>
          <short_desc>Building a recipe that inherits cpan-base creates an image runtime dependency on perl</short_desc>
          <delta_ts>2024-08-05 14:37:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>oe-core other</component>
          <version>5.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>5.1 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Barry G">mr.scada</reporter>
          <assigned_to name="Barry G">mr.scada</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99429</commentid>
    <comment_count>0</comment_count>
      <attachid>5061</attachid>
    <who name="Barry G">mr.scada</who>
    <bug_when>2024-07-24 15:06:34 +0000</bug_when>
    <thetext>Created attachment 5061
Patch to break hard runtime dependency on perl

Hello,

I build an image with Postgresql in it via the meta-openembedded recipe:
https://github.com/openembedded/meta-openembedded/blob/scarthgap/meta-oe/recipes-dbs/postgresql/postgresql.inc#L40
said recipe inherits cpan-base.

cpan-base.bbclass (https://git.yoctoproject.org/poky/tree/meta/classes-recipe/cpan-base.bbclass?h=scarthgap#n14) adds
an RDEPEND for perl to the non-native package. This results in perl being installed in my rootfs, which is not desired
for CVEs, image size, etc.

I have &apos;PACKAGECONFIG:remove = &quot;perl&quot;&apos; in my local.conf and I&apos;ve verified that postgresql itself is actually configuring with the flag --without-perl,
but postgresql.do_prepare_recipe_sysroot adds a dependency on perl.

I&apos;ve created an attached patch (0001-cpan-base-Only-RDEPEND-on-perl-if-using-perl.patch) that limits the perl
runtime dependency based on the PACKAGECONFIG of the package that inherits cpan-base, but I&apos;m not certain such
action is wise.

Is there a better way to have postgresql in my image and not have perl?

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99435</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-07-25 14:44:54 +0000</bug_when>
    <thetext>The patch is a good start, Ross is going to comment on how to proceed.

This isn&apos;t a oe-core recipe so since the changes are likely only to the recipe, we&apos;re going to reject the bug for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99437</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-07-25 14:48:17 +0000</bug_when>
    <thetext>You can&apos;t check a PACKAGECONFIG in a base class unless its a well known and defined PACKAGECONFIG, which &apos;perl&apos; is not.

The cpan class is designed for recipes that fetch perl modules from cpan, so that class depending on perl makes sense.

I can&apos;t see why the postgresql recipe actually pulls that class in at all.  Would you be able to test a build of postgresql with perl enabled, but change the cpan-base inherit to perl-version?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99442</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-07-25 14:54:10 +0000</bug_when>
    <thetext>I&apos;d suggest removing cpan-base from:
https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-dbs/postgresql/postgresql.inc#n40

And add a line where the inherit conditionally happens if the perl PACKAGECONFIG is set.

And please send patches to the mailing list:
https://git.openembedded.org/meta-openembedded/tree/meta-oe/README.md</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99446</commentid>
    <comment_count>4</comment_count>
    <who name="Barry G">mr.scada</who>
    <bug_when>2024-07-25 15:01:44 +0000</bug_when>
    <thetext>(In reply to Ross Burton from comment #2)
&gt; You can&apos;t check a PACKAGECONFIG in a base class unless its a well known and
&gt; defined PACKAGECONFIG, which &apos;perl&apos; is not.

Thanks for the explanation. I figured patch was sketchy.

&gt; The cpan class is designed for recipes that fetch perl modules from cpan, so
&gt; that class depending on perl makes sense.
&gt; 
&gt; I can&apos;t see why the postgresql recipe actually pulls that class in at all. 
&gt; Would you be able to test a build of postgresql with perl enabled, but
&gt; change the cpan-base inherit to perl-version?

Swapping cpan-base to perl-version in the inherit leads to:
Traceback (most recent call last):
  File &quot;Var &lt;PERLCONFIGTARGET&gt;&quot;, line 1, in &lt;module&gt;
bb.data_smart.ExpansionError: Failure expanding variable PERLCONFIGTARGET, expression was ${@is_target(d)} which triggered exception NameError: name &apos;is_target&apos; is not defined
The variable dependency chain for the failure is: PERLCONFIGTARGET

Since they call that is_target function on https://github.com/openembedded/meta-openembedded/blob/scarthgap/meta-oe/recipes-dbs/postgresql/postgresql.inc#L126</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99493</commentid>
    <comment_count>5</comment_count>
    <who name="Barry G">mr.scada</who>
    <bug_when>2024-08-05 14:37:20 +0000</bug_when>
    <thetext>Just for administrative housekeeping; I submitted a patch to meta-openembedded:
https://github.com/openembedded/meta-openembedded/commit/f311f1f01c19924d8cced61fa915f1387f92455b

Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5061</attachid>
            <date>2024-07-24 15:06:34 +0000</date>
            <delta_ts>2024-07-24 15:06:34 +0000</delta_ts>
            <desc>Patch to break hard runtime dependency on perl</desc>
            <filename>0001-cpan-base-Only-RDEPEND-on-perl-if-using-perl.patch</filename>
            <type>text/plain</type>
            <size>1158</size>
            <attacher name="Barry G">mr.scada</attacher>
            
              <data encoding="base64">RnJvbSAwZmE1M2M5MzUyOWE3NGFjYTc2M2VkNzU4OGQ3NjRmOGU2Mzc5YjY3IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBCYXJyeSBHcnVzc2xpbmcgPG1yLnNjYWRhQGdtYWlsLmNvbT4K
RGF0ZTogVHVlLCAyMyBKdWwgMjAyNCAwODoxMzoyNCAtMDcwMApTdWJqZWN0OiBbUEFUQ0hdIGNw
YW4tYmFzZTogT25seSBSREVQRU5EIG9uIHBlcmwgaWYgdXNpbmcgcGVybAoKU29tZSByZWNpcGVz
IGxpa2UgcG9zdGdyZXNxbCBpbmhlcml0IGNwYW4tYmFzZSBidXQgZG9uJ3QgbmVjZXNzYXJpbHkK
d2FudCBhIHJ1bi10aW1lIGRlcGVuZGVuY3kgb24gcGVybC4gVGhpcyBjaGFuZ2VzZXQgbG9va3Mg
YXQgdGhlClBBQ0tBR0VDT05GSUcgdG8gZGV0ZXJtaW5lIGlmIGEgcGVybCBSREVQRU5EIGlzIGFw
cHJvcHJpYXRlLgoKU2lnbmVkLW9mZi1ieTogQmFycnkgR3J1c3NsaW5nIDxtci5zY2FkYUBnbWFp
bC5jb20+Ci0tLQogbWV0YS9jbGFzc2VzLXJlY2lwZS9jcGFuLWJhc2UuYmJjbGFzcyB8IDIgKy0K
IDEgZmlsZSBjaGFuZ2VkLCAxIGluc2VydGlvbigrKSwgMSBkZWxldGlvbigtKQoKZGlmZiAtLWdp
dCBhL21ldGEvY2xhc3Nlcy1yZWNpcGUvY3Bhbi1iYXNlLmJiY2xhc3MgYi9tZXRhL2NsYXNzZXMt
cmVjaXBlL2NwYW4tYmFzZS5iYmNsYXNzCmluZGV4IDFkYjBhNGRlZDYuLjRlN2NlOGQ4OGQgMTAw
Nj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