When reproducible builds are enabled and externalsrc is in use, the
source date epoch function is added. The conditions on the conditional
code removing the unpack task need to match the deltask function, else
the source date epoch function can end up running twice and the functions
can race with each other causing build failures or corruption.

Signed-off-by: Richard Purdie <[email protected]>
---
 meta/classes/externalsrc.bbclass | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 7f1a760eec5..ad93b2d2abf 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -109,16 +109,15 @@ python () {
             if local_srcuri and task in fetch_tasks:
                 continue
             bb.build.deltask(task, d)
-
-        if bb.data.inherits_class('reproducible_build', d) and 'do_unpack' in 
d.getVar("SRCTREECOVEREDTASKS").split():
-            # The reproducible_build's create_source_date_epoch_stamp function 
must
-            # be run after the source is available and before the
-            # do_deploy_source_date_epoch task.  In the normal case, it's 
attached
-            # to do_unpack as a postfuncs, but since we removed do_unpack 
(above)
-            # we need to move the function elsewhere.  The easiest thing to do 
is
-            # move it into the prefuncs of the do_deploy_source_date_epoch 
task.
-            # This is safe, as externalsrc runs with the source already 
unpacked.
-            d.prependVarFlag('do_deploy_source_date_epoch', 'prefuncs', 
'create_source_date_epoch_stamp ')
+            if bb.data.inherits_class('reproducible_build', d) and task == 
'do_unpack':
+                # The reproducible_build's create_source_date_epoch_stamp 
function must
+                # be run after the source is available and before the
+                # do_deploy_source_date_epoch task.  In the normal case, it's 
attached
+                # to do_unpack as a postfuncs, but since we removed do_unpack 
(above)
+                # we need to move the function elsewhere.  The easiest thing 
to do is
+                # move it into the prefuncs of the do_deploy_source_date_epoch 
task.
+                # This is safe, as externalsrc runs with the source already 
unpacked.
+                d.prependVarFlag('do_deploy_source_date_epoch', 'prefuncs', 
'create_source_date_epoch_stamp ')
 
         d.prependVarFlag('do_compile', 'prefuncs', 
"externalsrc_compile_prefunc ")
         d.prependVarFlag('do_configure', 'prefuncs', 
"externalsrc_configure_prefunc ")
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#156539): 
https://lists.openembedded.org/g/openembedded-core/message/156539
Mute This Topic: https://lists.openembedded.org/mt/86032664/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to