nss: fix parallel build race in nsinstall.py

File "/home/tdf/lode/jenkins/workspace/android_aarch64/external/nss/nsinstall.py", line 112, in nsinstall
    os.makedirs(args[0])
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '../../../../dist/public/dbm'
../../../coreconf/rules.mk:119: recipe for target '../../../../dist/public/dbm/d' failed

Change-Id: I4273e6d3d5fa520353fff8738823ef281fe237ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109619
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
Michael Stahl 2021-01-19 11:28:41 +01:00
parent 1783f11862
commit 6f5186a94d
2 changed files with 12 additions and 8 deletions

View file

@ -16,7 +16,9 @@ $(eval $(call gb_ExternalProject_register_targets,nss,\
))
ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecutable_get_dependencies,python)
$(call gb_ExternalProject_get_state_target,nss,build): \
$(call gb_ExternalExecutable_get_dependencies,python) \
$(SRCDIR)/external/nss/nsinstall.py
$(call gb_Trace_StartRange,nss,EXTERNAL)
$(call gb_ExternalProject_run,build,\
$(if $(MSVC_USE_DEBUG_RUNTIME),USE_DEBUG_RTL=1,BUILD_OPT=1) \
@ -43,7 +45,9 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecuta
else # OS!=WNT
# make sure to specify NSPR_CONFIGURE_OPTS as env (before make command), so nss can append it's own defaults
# OTOH specify e.g. CC and NSINSTALL as arguments (after make command), so they will overrule nss makefile values
$(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecutable_get_dependencies,python)
$(call gb_ExternalProject_get_state_target,nss,build): \
$(call gb_ExternalExecutable_get_dependencies,python) \
$(SRCDIR)/external/nss/nsinstall.py
$(call gb_Trace_StartRange,nss,EXTERNAL)
$(call gb_ExternalProject_run,build,\
$(if $(filter ANDROID FREEBSD LINUX MACOSX,$(OS)),$(if $(filter X86_64,$(CPUNAME)),USE_64=1)) \

View file

@ -99,17 +99,17 @@ def nsinstall(argv):
if options.D:
if len(args) != 1:
return 1
if os.path.exists(args[0]):
try:
if options.m:
os.makedirs(args[0], options.m)
else:
os.makedirs(args[0])
except FileExistsError:
if not os.path.isdir(args[0]):
sys.stderr.write('nsinstall: ' + args[0] + ' is not a directory\n')
sys.exit(1)
if options.m:
os.chmod(args[0], options.m)
sys.exit()
if options.m:
os.makedirs(args[0], options.m)
else:
os.makedirs(args[0])
return 0
# nsinstall arg1 [...] directory