From 402a392bd406feaf3b6fd3c19c1b7cc70f107de5 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Tue, 2 Jun 2026 11:47:26 +0200 Subject: [PATCH] packaging: faked-tcp can cause hangs, prefer fakeroot-sysv especiall when creating installsets with high parallelism, the packaging stage can hang until faked-tcp is killed. So avoid this race-condition altogether by switching to the sysv backend if available. Change-Id: If554abb8fb51218e6055e70c98622be77ecce58e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205896 Reviewed-by: Christian Lohmaier Tested-by: Jenkins --- config_host.mk.in | 1 + configure.ac | 7 ++++--- instsetoo_native/CustomTarget_install.mk | 1 + solenv/bin/modules/installer/download.pm | 4 ++-- solenv/bin/modules/installer/epmfile.pm | 2 +- solenv/bin/modules/installer/simplepackage.pm | 2 +- sysui/CustomTarget_deb.mk | 4 ++-- sysui/CustomTarget_rpm.mk | 2 +- sysui/CustomTarget_solaris.mk | 2 +- 9 files changed, 14 insertions(+), 11 deletions(-) diff --git a/config_host.mk.in b/config_host.mk.in index af417c73fde6..67440ae00a0b 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -285,6 +285,7 @@ export EPUBGEN_LIBS=$(gb_SPACE)@EPUBGEN_LIBS@ export ETONYEK_CFLAGS=$(gb_SPACE)@ETONYEK_CFLAGS@ export ETONYEK_LIBS=$(gb_SPACE)@ETONYEK_LIBS@ export debug=@ENABLE_DEBUG@ +FAKEROOT=@FAKEROOT@ export FIND=@FIND@ export FIREBIRD_CFLAGS=$(gb_SPACE)@FIREBIRD_CFLAGS@ export FIREBIRD_LIBS=$(gb_SPACE)@FIREBIRD_LIBS@ diff --git a/configure.ac b/configure.ac index 0137919fa139..6f3d1ba44dcb 100644 --- a/configure.ac +++ b/configure.ac @@ -6104,11 +6104,11 @@ msi - Windows .msi # fakeroot is needed to ensure correct file ownerships/permissions # inside deb packages and tar archives created on Linux and Solaris. if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then - AC_PATH_PROG(FAKEROOT, fakeroot, no) - if test "$FAKEROOT" = "no"; then + # prefer fakeroot-sysv since faked-tcp can cause port collisions when packaging in parallel + AC_PATH_PROG(FAKEROOT, [fakeroot-sysv fakeroot-tcp fakeroot], AC_MSG_ERROR( [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.]) - fi + ) fi PKGFORMAT="$with_package_format" AC_MSG_RESULT([$PKGFORMAT]) @@ -6117,6 +6117,7 @@ else AC_MSG_RESULT([none]) fi AC_SUBST(PKGFORMAT) +AC_SUBST(FAKEROOT) dnl =================================================================== dnl handle help related options diff --git a/instsetoo_native/CustomTarget_install.mk b/instsetoo_native/CustomTarget_install.mk index 5c2bfd4ce462..a0930f431947 100644 --- a/instsetoo_native/CustomTarget_install.mk +++ b/instsetoo_native/CustomTarget_install.mk @@ -108,6 +108,7 @@ $(gb_Make_JobLimiter): $(SRCDIR)/solenv/bin/job-limiter.cpp # packaging (since packaging the main installer takes longer than packaging sdk and all helppacks # even with the reduced parallelism (the higher the parallelism, the higher the chance for random # failures during the cscript call to WiLangId.vbs) +$(instsetoo_installer_targets): export FAKEROOT:=$(FAKEROOT) $(instsetoo_installer_targets): $(SRCDIR)/solenv/bin/make_installer.pl \ $(foreach ulf,$(instsetoo_ULFLIST),$(gb_CustomTarget_workdir)/instsetoo_native/install/win_ulffiles/$(ulf).ulf) \ $(if $(filter-out WNT,$(OS)),\ diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm index ad5f94560751..597e1fbccfb1 100644 --- a/solenv/bin/modules/installer/download.pm +++ b/solenv/bin/modules/installer/download.pm @@ -222,7 +222,7 @@ sub tar_package my ( $installdir, $tarfilename, $usefakeroot) = @_; my $fakerootstring = ""; - if ( $usefakeroot ) { $fakerootstring = "fakeroot"; } + if ( $usefakeroot ) { $fakerootstring = $ENV{'FAKEROOT'}; } my $systemcall = "cd $installdir; $fakerootstring tar -cf - * > $tarfilename"; @@ -497,7 +497,7 @@ sub create_tar_gz_file_from_directory installer::pathanalyzer::get_path_from_fullqualifiedname(\$changedir); my $fakerootstring = ""; - if ( $usefakeroot ) { $fakerootstring = "fakeroot"; } + if ( $usefakeroot ) { $fakerootstring = $ENV{'FAKEROOT'}; } $installer::globals::downloadfileextension = ".tar.gz"; $installer::globals::downloadfilename = $downloadfilename . $installer::globals::downloadfileextension; diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index 3ca28a4061f1..4046336881e5 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -824,7 +824,7 @@ sub call_epm my $fakerootstring = ""; - if ( $installer::globals::debian ) { $fakerootstring = "fakeroot "; } + if ( $installer::globals::debian ) { $fakerootstring = "$ENV{'FAKEROOT'} "; } my $extraflags = ""; if ($ENV{'EPM_FLAGS'}) { $extraflags = $ENV{'EPM_FLAGS'}; } diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index a8b98a222e5f..769c389bd923 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -488,7 +488,7 @@ sub create_package my $fakerootstring = ""; if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild )) { - $fakerootstring = "fakeroot"; + $fakerootstring = $ENV{'FAKEROOT'}; } $systemcall = "cd $tempdir; $fakerootstring tar -cf - . | $installer::globals::packertool > $archive"; diff --git a/sysui/CustomTarget_deb.mk b/sysui/CustomTarget_deb.mk index b31df46f0fe0..1e3b1867d519 100644 --- a/sysui/CustomTarget_deb.mk +++ b/sysui/CustomTarget_deb.mk @@ -25,7 +25,7 @@ $(foreach product,$(PRODUCTLIST),\ )) $(deb_WORKDIR)/%-desktop-integration.tar.gz: $(deb_WORKDIR)/%$(PKGVERSIONSHORT)-debian-menus_$(PKGVERSION)-$(LIBO_VERSION_PATCH)_all.deb - fakeroot $(GNUTAR) -C $(deb_WORKDIR) -cf - $(notdir $<) | gzip > $@ + $(FAKEROOT) $(GNUTAR) -C $(deb_WORKDIR) -cf - $(notdir $<) | gzip > $@ $(deb_WORKDIR)/%/DEBIAN/postrm: $(deb_SRCDIR)/postrm cat $< | tr -d "\015" | \ @@ -65,6 +65,6 @@ $(deb_WORKDIR)/%$(PKGVERSIONSHORT)-debian-menus_$(PKGVERSION)-$(LIBO_VERSION_PAT chmod a+rx $(deb_WORKDIR)/$*/DEBIAN \ $(deb_WORKDIR)/$*/DEBIAN/pre* $(deb_WORKDIR)/$*/DEBIAN/post* chmod g-s $(deb_WORKDIR)/$*/DEBIAN - fakeroot dpkg-deb --build $(deb_WORKDIR)/$* $@ + $(FAKEROOT) dpkg-deb --build $(deb_WORKDIR)/$* $@ # vim: set noet sw=4 ts=4: diff --git a/sysui/CustomTarget_rpm.mk b/sysui/CustomTarget_rpm.mk index 075d3e324b27..e4b3c1d4bb56 100644 --- a/sysui/CustomTarget_rpm.mk +++ b/sysui/CustomTarget_rpm.mk @@ -55,6 +55,6 @@ $(foreach product,$(PRODUCTLIST),\ )) $(rpm_WORKDIR)/%-desktop-integration.tar.gz: - fakeroot $(GNUTAR) -C $(rpm_WORKDIR)/$* -cf - $(foreach distro,$(RPMDISTROS),$*$(PKGVERSIONSHORT)-$(distro)-menus-$(PKGVERSION)-$(LIBO_VERSION_PATCH).noarch.rpm) | gzip > $@ + $(FAKEROOT) $(GNUTAR) -C $(rpm_WORKDIR)/$* -cf - $(foreach distro,$(RPMDISTROS),$*$(PKGVERSIONSHORT)-$(distro)-menus-$(PKGVERSION)-$(LIBO_VERSION_PATCH).noarch.rpm) | gzip > $@ # vim: set noet sw=4 ts=4: diff --git a/sysui/CustomTarget_solaris.mk b/sysui/CustomTarget_solaris.mk index a38c45f53a60..293cf9655d5a 100644 --- a/sysui/CustomTarget_solaris.mk +++ b/sysui/CustomTarget_solaris.mk @@ -50,6 +50,6 @@ $(solaris_WORKDIR)/%/prototype: $(solaris_SRCDIR)/prototype $(solaris_WORKDIR)/%-desktop-integration.tar.gz: $(solaris_WORKDIR)/%/copyright $(solaris_WORKDIR)/%/pkginfo $(solaris_WORKDIR)/%/depend $(solaris_WORKDIR)/%/mailcap $(solaris_WORKDIR)/%/postinstall $(solaris_WORKDIR)/%/postremove $(solaris_WORKDIR)/%/prototype $(gb_CustomTarget_workdir)/sysui/share/%/openoffice.org.xml # pkgmk -l 1073741824 -r $(solaris_WORKDIR) -f $(solaris_WORKDIR)/$*/prototype -o -d $(solaris_WORKDIR) ARCH=all VERSION=$(PKGVERSION.$*) - fakeroot $(GNUTAR) -cf - -C $(solaris_WORKDIR) $* | gzip > $@ + $(FAKEROOT) $(GNUTAR) -cf - -C $(solaris_WORKDIR) $* | gzip > $@ # vim: set noet sw=4 ts=4: