[meta-java,v3] WORKDIR and ARCHIVER_WORKDIR support

Submitted by Robert Berger on May 9, 2020, 9:50 a.m. | Patch ID: 172435

Details

Message ID 20200509095010.25808-1-robert.berger@ReliableEmbeddedSystems.com
State Master Next
Delegated to: Richard Leitner
Headers show

Commit Message

Robert Berger May 9, 2020, 9:50 a.m.
From: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>

do_unpack_extract_submodules was called via postfuncs[do_unpack].
This breaks the build when the archiver.bbclass is used in a way
where do_unpack_and_patch is called by it. In this mode the archiver
class modifies WORKDIR, S, B,... and those modifications are lost 
via postfuncs.

In order to pick up WORKDIR, S, B,... (potentially modified by 
archiver.bbclass) do_patch_prepend is used instead of pre/postfuncs 
and calls do_unpack_extract_submodules now.

Without this patch the build will break when you add this to local.conf:

INHERIT += "archiver"
ARCHIVER_MODE[src] = "original"
ARCHIVER_MODE[diff] = "1"
ARCHIVER_MODE[dumpdata] = "1"
ARCHIVER_MODE[recipe] = "1"
COPYLEFT_LICENSE_INCLUDE = "GPL* LGPL*"

Signed-off-by: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
---
 recipes-core/openjdk/openjdk-8-common.inc | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index c78bb2a..04acc59 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -42,6 +42,21 @@  do_unpack_extract_submodules () {
     tar xjf ${WORKDIR}/${NASHORN_FILE_LOCAL} --transform "s,-${NASHORN_CHANGESET},,g"
 }
 
+do_patch_prepend() {
+    # use do_patch_prepend syntax and not pre/postfuncs to
+    # call do_unpack_extract_submodules
+    # *) the archiver.bbclass modifies WORKDIR, S, B,...
+    #    and those modifications are lost otherwise,
+    #    which leads to build failures in do_unpack_and_patch -> do_patch
+    func = 'do_unpack_extract_submodules'
+    bb.build.exec_func(func, d)
+
+    # delete X11 wrappers if x11 is not part of PACKAGECONFIG
+    if bb.utils.contains('PACKAGECONFIG', 'x11', False, True, d):
+       func_delete = 'do_unpack_delete_X11_wrappers'
+       bb.build.exec_func(func_delete, d)
+}
+
 do_unpack_delete_X11_wrappers() {
     find ${S}/jdk/src/solaris/classes/sun/awt/X11 -maxdepth 1 -name '*.java' -delete
 }
@@ -155,8 +170,8 @@  def jdk_configure_options(d):
     options = package_config_option_cleanup(d)
     return options[3]
 
-do_unpack[postfuncs] += "do_unpack_extract_submodules"
-do_unpack[postfuncs] += "${@bb.utils.contains('PACKAGECONFIG', 'x11', '', 'do_unpack_delete_X11_wrappers', d)}"
+#do_unpack[postfuncs] += "do_unpack_extract_submodules"
+#do_unpack[postfuncs] += "${@bb.utils.contains('PACKAGECONFIG', 'x11', '', 'do_unpack_delete_X11_wrappers', d)}"
 
 export DEBUG_BINARIES = "true"
 

Comments

Richard Leitner June 10, 2020, 9:10 a.m.
Hi,
thank you for your patch!

This is a note to let you know that I've just added this patch to the
master-next branch of the meta-java repository at
	git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be
merged to the master branch.

If you have any questions, please let me know.

regards;rl

On Sat, May 09, 2020 at 12:50:10PM +0300, oecore.mailinglist@gmail.com wrote:
> From: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
> 
> do_unpack_extract_submodules was called via postfuncs[do_unpack].
> This breaks the build when the archiver.bbclass is used in a way
> where do_unpack_and_patch is called by it. In this mode the archiver
> class modifies WORKDIR, S, B,... and those modifications are lost 
> via postfuncs.
> 
> In order to pick up WORKDIR, S, B,... (potentially modified by 
> archiver.bbclass) do_patch_prepend is used instead of pre/postfuncs 
> and calls do_unpack_extract_submodules now.
> 
> Without this patch the build will break when you add this to local.conf:
> 
> INHERIT += "archiver"
> ARCHIVER_MODE[src] = "original"
> ARCHIVER_MODE[diff] = "1"
> ARCHIVER_MODE[dumpdata] = "1"
> ARCHIVER_MODE[recipe] = "1"
> COPYLEFT_LICENSE_INCLUDE = "GPL* LGPL*"
> 
> Signed-off-by: Robert Berger <robert.berger@ReliableEmbeddedSystems.com>
> ---
>  recipes-core/openjdk/openjdk-8-common.inc | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
> index c78bb2a..04acc59 100644
> --- a/recipes-core/openjdk/openjdk-8-common.inc
> +++ b/recipes-core/openjdk/openjdk-8-common.inc
> @@ -42,6 +42,21 @@ do_unpack_extract_submodules () {
>      tar xjf ${WORKDIR}/${NASHORN_FILE_LOCAL} --transform "s,-${NASHORN_CHANGESET},,g"
>  }
>  
> +do_patch_prepend() {
> +    # use do_patch_prepend syntax and not pre/postfuncs to
> +    # call do_unpack_extract_submodules
> +    # *) the archiver.bbclass modifies WORKDIR, S, B,...
> +    #    and those modifications are lost otherwise,
> +    #    which leads to build failures in do_unpack_and_patch -> do_patch
> +    func = 'do_unpack_extract_submodules'
> +    bb.build.exec_func(func, d)
> +
> +    # delete X11 wrappers if x11 is not part of PACKAGECONFIG
> +    if bb.utils.contains('PACKAGECONFIG', 'x11', False, True, d):
> +       func_delete = 'do_unpack_delete_X11_wrappers'
> +       bb.build.exec_func(func_delete, d)
> +}
> +
>  do_unpack_delete_X11_wrappers() {
>      find ${S}/jdk/src/solaris/classes/sun/awt/X11 -maxdepth 1 -name '*.java' -delete
>  }
> @@ -155,8 +170,8 @@ def jdk_configure_options(d):
>      options = package_config_option_cleanup(d)
>      return options[3]
>  
> -do_unpack[postfuncs] += "do_unpack_extract_submodules"
> -do_unpack[postfuncs] += "${@bb.utils.contains('PACKAGECONFIG', 'x11', '', 'do_unpack_delete_X11_wrappers', d)}"
> +#do_unpack[postfuncs] += "do_unpack_extract_submodules"
> +#do_unpack[postfuncs] += "${@bb.utils.contains('PACKAGECONFIG', 'x11', '', 'do_unpack_delete_X11_wrappers', d)}"
>  
>  export DEBUG_BINARIES = "true"
>  
> -- 
> 2.17.1
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#84938): https://lists.openembedded.org/g/openembedded-devel/message/84938
Mute This Topic: https://lists.openembedded.org/mt/74092510/3617530
Group Owner: openembedded-devel+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub  [oe-patchwork@oe-patch.openembedded.org]
-=-=-=-=-=-=-=-=-=-=-=-