external/python3/ExternalPackage_python3.mk |   14 ++++++++++----
 external/python3/ExternalProject_python3.mk |    4 ++++
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 5931638fdabb033c2f957c90ae27d075477b1261
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Feb 22 16:26:45 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Feb 23 11:12:10 2022 +0100

    external/python3: Explicitly check that all extension modules got built
    
    ...to avoid issues like we now experienced on Jenkins box tb76, where e.g.
    <https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/108402/> failed 
with
    just an unhelpful
    
    > 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/external/python3/ExternalPackage_python3.mk:46:
 *** file 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/python3/LO_lib/_elementtree.cpython-3.8d.so
 does not exist in the tarball.  Stop.
    > make[1]: *** Waiting for unfinished jobs....
    > Makefile:299: recipe for target 'build' failed
    > make: *** [build] Error 2
    
    after ExternalProject_python3 had been built successfully, outputting just
    
    > [build PRJ] python3
    
    even though its workdir/UnpackedTarball/python3/build.log states
    
    > *** WARNING: renaming "_elementtree" since importing it failed: pyexpat 
version is incompatible
    
    and
    
    > Following modules built successfully but were removed because they could 
not be imported:
    > _elementtree
    
    (but which got hidden by gbuild)
    
    Change-Id: I28904ef41cb823e308bb8e15cbe969872702cb55
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130355
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/external/python3/ExternalPackage_python3.mk 
b/external/python3/ExternalPackage_python3.mk
index faddf06fc36a..9987ab138792 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -25,7 +25,7 @@ $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYT
 ifeq ($(MSVC_USE_DEBUG_RUNTIME),)
 $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYTHON_VERSION_MAJOR).dll,PCbuild/$(python_arch_subdir)python$(PYTHON_VERSION_MAJOR).dll))
 endif
-$(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+python3_EXTENSION_MODULES= \
        PCbuild/$(python_arch_subdir)_asyncio$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_ctypes$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)_decimal$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
@@ -40,6 +40,9 @@ $(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
        PCbuild/$(python_arch_subdir)select$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)unicodedata$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
        PCbuild/$(python_arch_subdir)winsound$(if 
$(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
+
+$(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
+       $(python3_EXTENSION_MODULES) \
 ))
 else
 $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python.bin,python))
@@ -49,14 +52,14 @@ $(eval $(call 
gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python.bin-
 
 # Unfortunately the python build system does not allow to explicitly enable or
 # disable these, it just tries to build them and then prints which did not
-# build successfully without stopping; so the build will break on delivering if
-# one of these failed to build.
+# build successfully without stopping; that's why ExternalProject_python3 
explicitly checks for the
+# existence of all the files on the python3_EXTENSION_MODULES list at the end 
of the build.
 # Obviously this list should not contain stuff with external dependencies
 # that may not be available on baseline systems.
 
 ifneq ($(OS),AIX)
 
python3_EXTENSION_MODULE_SUFFIX=cpython-$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)$(if
 $(ENABLE_DBGUTIL),d)
-$(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib-dynload,\
+python3_EXTENSION_MODULES= \
        LO_lib/array.$(python3_EXTENSION_MODULE_SUFFIX).so \
        LO_lib/_asyncio.$(python3_EXTENSION_MODULE_SUFFIX).so \
        LO_lib/audioop.$(python3_EXTENSION_MODULE_SUFFIX).so \
@@ -121,6 +124,9 @@ $(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-cor
        LO_lib/_xxsubinterpreters.$(python3_EXTENSION_MODULE_SUFFIX).so \
        LO_lib/_xxtestfuzz.$(python3_EXTENSION_MODULE_SUFFIX).so \
        LO_lib/zlib.$(python3_EXTENSION_MODULE_SUFFIX).so \
+
+$(eval $(call 
gb_ExternalPackage_add_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/lib-dynload,\
+       $(python3_EXTENSION_MODULES) \
 ))
 endif
 endif
diff --git a/external/python3/ExternalProject_python3.mk 
b/external/python3/ExternalProject_python3.mk
index ac9b7f93ece8..f1b71a037b4a 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -44,6 +44,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
                        /maxcpucount \
                        /p:PlatformToolset=$(VCTOOLSET) 
/p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
                        $(if $(filter 
10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
+               $(foreach i,$(python3_EXTENSION_MODULES), \
+                       && { test -e ../$i || { printf 'Error: missing %s\n' 
$i; false; } }) \
        ,PCBuild)
        $(call gb_Trace_EndRange,python3,EXTERNAL)
 
@@ -123,6 +125,8 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
                        $(if $(filter 
MACOSX,$(OS)),DESTDIR=$(EXTERNAL_WORKDIR)/python-inst install) \
                        $(if 
$(SYSTEM_ZLIB),,ZLIB_INCDIR=$(WORKDIR)/UnpackedTarball/zlib) \
                && ln -s build/lib.* LO_lib \
+               $(foreach i,$(python3_EXTENSION_MODULES), \
+                       && { test -e $i || { printf 'Error: missing %s\n' $i; 
false; } }) \
        )
        $(call gb_Trace_EndRange,python3,EXTERNAL)
 

Reply via email to