diff mbox series

perl: run builds from a pristine source tree

Message ID 20220831091906.3310501-1-alex@linutronix.de
State Accepted, archived
Commit 0919f5ec214594380eb5190b4878eadb30e3a471
Headers show
Series perl: run builds from a pristine source tree | expand

Commit Message

Alexander Kanavin Aug. 31, 2022, 9:19 a.m. UTC
Running builds from a previously used directory relies on correctness of
'make clean' or incremental 'make', and sadly perl (or perl-cross) does not have either.

The particularly nasty problem, currently occurring, is that sometimes, when reusing
a previous build, we arrive at a combination of timestamps in the tree,
where make becomes very confused, gets lost in its own rules and enters an infinite loop,
never figuring out what needs to be rebuild in what order. Worse, there is no reliable
trigger for this that was found, and any attempts to 'isolate the issue' haven't produced one.

Let's simply add a clean S/B separation for builds, and always run a build from a reproducible
set of files.

[YOCTO #14902]

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 ...ctly-list-modules-when-cleaning-them.patch | 24 ----------------
 ...file-do-not-clean-config.h-xconfig.h.patch | 28 -------------------
 .../perl-cross/perlcross_1.4.bb               |  2 --
 meta/recipes-devtools/perl/perl_5.36.0.bb     |  8 ++++--
 4 files changed, 5 insertions(+), 57 deletions(-)
 delete mode 100644 meta/recipes-devtools/perl-cross/files/0001-Makefile-correctly-list-modules-when-cleaning-them.patch
 delete mode 100644 meta/recipes-devtools/perl-cross/files/0001-Makefile-do-not-clean-config.h-xconfig.h.patch

Comments

Peter Kjellerstedt Aug. 31, 2022, 10:24 a.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Alexander Kanavin
> Sent: den 31 augusti 2022 11:19
> To: openembedded-core@lists.openembedded.org
> Cc: Alexander Kanavin <alex@linutronix.de>
> Subject: [OE-core] [PATCH] perl: run builds from a pristine source tree
> 
> Running builds from a previously used directory relies on correctness of
> 'make clean' or incremental 'make', and sadly perl (or perl-cross) does
> not have either.
> 
> The particularly nasty problem, currently occurring, is that sometimes, when reusing
> a previous build, we arrive at a combination of timestamps in the tree,
> where make becomes very confused, gets lost in its own rules and enters an infinite loop,
> never figuring out what needs to be rebuild in what order. Worse, there is no reliable
> trigger for this that was found, and any attempts to 'isolate the issue' haven't produced one.
> 
> Let's simply add a clean S/B separation for builds, and always run a build from a reproducible
> set of files.
> 
> [YOCTO #14902]
> 
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
> ---
>  ...ctly-list-modules-when-cleaning-them.patch | 24 ----------------
>  ...file-do-not-clean-config.h-xconfig.h.patch | 28 -------------------
>  .../perl-cross/perlcross_1.4.bb               |  2 --
>  meta/recipes-devtools/perl/perl_5.36.0.bb     |  8 ++++--
>  4 files changed, 5 insertions(+), 57 deletions(-)
>  delete mode 100644 meta/recipes-devtools/perl-cross/files/0001-Makefile-correctly-list-modules-when-cleaning-them.patch
>  delete mode 100644 meta/recipes-devtools/perl-cross/files/0001-Makefile-do-not-clean-config.h-xconfig.h.patch

[cut]

> diff --git a/meta/recipes-devtools/perl/perl_5.36.0.bb b/meta/recipes-devtools/perl/perl_5.36.0.bb
> index ead7dace16..2dc558aaa5 100644
> --- a/meta/recipes-devtools/perl/perl_5.36.0.bb
> +++ b/meta/recipes-devtools/perl/perl_5.36.0.bb
> @@ -28,7 +28,7 @@ SRC_URI:append:class-target = " \
> 
>  SRC_URI[perl.sha256sum] = "e26085af8ac396f62add8a533c3a0ea8c8497d836f0689347ac5abd7b7a4e00a"
> 
> -S = "${WORKDIR}/perl-${PV}"
> +B = "${WORKDIR}/perl-${PV}-build"

Any reason not to just set B = "${WORKDIR}/build" ?

> 
>  inherit upstream-version-is-even update-alternatives
> 
> @@ -48,7 +48,10 @@ export ENC2XS_NO_COMMENTS = "1"
>  CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
> 
>  do_configure:prepend() {
> -    cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${S}
> +    rm -rf ${B}
> +    cp -rfp ${S} ${B}
> +    cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${B}
> +    cd ${B}
>  }
> 
>  do_configure:class-target() {
> @@ -116,7 +119,6 @@ print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %
>              ")"
>          echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h
>      fi
> -    oe_runmake clean
>  }
> 
>  do_compile() {
> --
> 2.30.2

//Peter
Alexander Kanavin Aug. 31, 2022, 10:32 a.m. UTC | #2
On Wed, 31 Aug 2022 at 12:24, Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:
> > -S = "${WORKDIR}/perl-${PV}"
> > +B = "${WORKDIR}/perl-${PV}-build"
>
> Any reason not to just set B = "${WORKDIR}/build" ?

'build' is a convention set by cmake/autotools/etc classes, not
globally, and it implies the original source is not in it, which is
not the case here.

Alex
diff mbox series

Patch

diff --git a/meta/recipes-devtools/perl-cross/files/0001-Makefile-correctly-list-modules-when-cleaning-them.patch b/meta/recipes-devtools/perl-cross/files/0001-Makefile-correctly-list-modules-when-cleaning-them.patch
deleted file mode 100644
index 80388fa9b0..0000000000
--- a/meta/recipes-devtools/perl-cross/files/0001-Makefile-correctly-list-modules-when-cleaning-them.patch
+++ /dev/null
@@ -1,24 +0,0 @@ 
-From 7b8d819e012c24df228a313beb86e1942611c904 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex@linutronix.de>
-Date: Sat, 4 Jun 2022 13:00:12 +0200
-Subject: [PATCH] Makefile: correctly list modules when cleaning them
-
-Upstream-Status: Submitted [https://github.com/arsv/perl-cross/pull/133]
-Signed-off-by: Alexander Kanavin <alex@linutronix.de>
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 6b35fb0..9ef9324 100644
---- a/Makefile
-+++ b/Makefile
-@@ -462,7 +462,7 @@ clean-subdirs:
- 
- # assuming modules w/o Makefiles were never built and need no cleaning
- clean-modules: config.h
--	@for i in $(modules disabled); do \
-+	@for i in $(modules) $(disabled); do \
- 		test -f $$i/Makefile && \
- 		touch $$i/Makefile && \
- 		$(MAKE) -C $$i clean \
diff --git a/meta/recipes-devtools/perl-cross/files/0001-Makefile-do-not-clean-config.h-xconfig.h.patch b/meta/recipes-devtools/perl-cross/files/0001-Makefile-do-not-clean-config.h-xconfig.h.patch
deleted file mode 100644
index cbb935c71b..0000000000
--- a/meta/recipes-devtools/perl-cross/files/0001-Makefile-do-not-clean-config.h-xconfig.h.patch
+++ /dev/null
@@ -1,28 +0,0 @@ 
-From ade4a70308d3b9d79cc3db841c0f60385780fe1a Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex@linutronix.de>
-Date: Sat, 4 Jun 2022 13:45:20 +0200
-Subject: [PATCH] Makefile: do not clean config.h/xconfig.h
-
-These are generated by ./configure and not by make.
-
-Upstream-Status: Submitted [https://github.com/arsv/perl-cross/pull/134]
-Signed-off-by: Alexander Kanavin <alex@linutronix.de>
----
- Makefile | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 9ef9324..3de2c2e 100644
---- a/Makefile
-+++ b/Makefile
-@@ -473,7 +473,6 @@ clean-generated-files:
- 	-rm -f uudmap.h opmini.c generate_uudmap$X bitcount.h $(CONFIGPM)
- 	-rm -f git_version.h lib/re.pm lib/Config_git.pl
- 	-rm -f perlmini.c perlmain.c
--	-rm -f config.h xconfig.h
- 	-rm -f pod/perlmodlib.pod
- 	-rm -f ext.libs static.list
- 	-rm -f $(patsubst %,%/ppport.h,$(mkppport_lst))
--- 
-2.30.2
-
diff --git a/meta/recipes-devtools/perl-cross/perlcross_1.4.bb b/meta/recipes-devtools/perl-cross/perlcross_1.4.bb
index 9b2889647f..17ce901646 100644
--- a/meta/recipes-devtools/perl-cross/perlcross_1.4.bb
+++ b/meta/recipes-devtools/perl-cross/perlcross_1.4.bb
@@ -15,8 +15,6 @@  SRC_URI = "https://github.com/arsv/perl-cross/releases/download/${PV}/perl-cross
            file://0001-perl-cross-add-LDFLAGS-when-linking-libperl.patch \
            file://determinism.patch \
            file://0001-Makefile-check-the-file-if-patched-or-not.patch \
-           file://0001-Makefile-correctly-list-modules-when-cleaning-them.patch \
-           file://0001-Makefile-do-not-clean-config.h-xconfig.h.patch \
            file://0001-configure_func.sh-Add-_GNU_SOURCE-define-and-functio.patch \
            "
 UPSTREAM_CHECK_URI = "https://github.com/arsv/perl-cross/releases/"
diff --git a/meta/recipes-devtools/perl/perl_5.36.0.bb b/meta/recipes-devtools/perl/perl_5.36.0.bb
index ead7dace16..2dc558aaa5 100644
--- a/meta/recipes-devtools/perl/perl_5.36.0.bb
+++ b/meta/recipes-devtools/perl/perl_5.36.0.bb
@@ -28,7 +28,7 @@  SRC_URI:append:class-target = " \
 
 SRC_URI[perl.sha256sum] = "e26085af8ac396f62add8a533c3a0ea8c8497d836f0689347ac5abd7b7a4e00a"
 
-S = "${WORKDIR}/perl-${PV}"
+B = "${WORKDIR}/perl-${PV}-build"
 
 inherit upstream-version-is-even update-alternatives
 
@@ -48,7 +48,10 @@  export ENC2XS_NO_COMMENTS = "1"
 CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
 
 do_configure:prepend() {
-    cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${S}
+    rm -rf ${B}
+    cp -rfp ${S} ${B}
+    cp -rfp ${STAGING_DATADIR_NATIVE}/perl-cross/* ${B}
+    cd ${B}
 }
 
 do_configure:class-target() {
@@ -116,7 +119,6 @@  print(datetime.fromtimestamp($SOURCE_DATE_EPOCH, timezone.utc).strftime('%a %b %
             ")"
         echo "#define PERL_BUILD_DATE \"$PERL_BUILD_DATE\"" >> config.h
     fi
-    oe_runmake clean
 }
 
 do_compile() {