[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 4 commits - configure.ac solenv/bin sysui/CustomTarget_deb.mk sysui/CustomTarget_rpm.mk sysui/CustomTarget_solaris.mk

Michael Weghorn m.weghorn at posteo.de
Tue Feb 20 08:27:20 UTC 2018


 configure.ac                                  |    9 ++++++
 solenv/bin/modules/installer/download.pm      |   37 +++++++++-----------------
 solenv/bin/modules/installer/epmfile.pm       |   19 ++-----------
 solenv/bin/modules/installer/simplepackage.pm |   10 ++-----
 sysui/CustomTarget_deb.mk                     |    7 ++--
 sysui/CustomTarget_rpm.mk                     |    2 -
 sysui/CustomTarget_solaris.mk                 |    2 -
 7 files changed, 35 insertions(+), 51 deletions(-)

New commits:
commit c70b7c94a2c173e2f967204ab0b31d89c4cf3292
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Thu Feb 15 16:37:23 2018 +0100

    tdf#115554: Fix ownership in desktop-integration tars
    
    Use fakeroot to call tar when creating the tar.gz archives
    holding the desktop-integration parts to have root:root
    as owner of the files inside those.
    
    Change-Id: Idcdcb4dd398f330773671266dafb354711b0f093
    Reviewed-on: https://gerrit.libreoffice.org/49827
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 0add6dbacbed852f2b5180e04571f039cbf9dd0b)

diff --git a/sysui/CustomTarget_deb.mk b/sysui/CustomTarget_deb.mk
index dd75ee913c62..92cda34a3bfe 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
-	$(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" | \
diff --git a/sysui/CustomTarget_rpm.mk b/sysui/CustomTarget_rpm.mk
index 8cc56ed80e34..a76b4161e2af 100644
--- a/sysui/CustomTarget_rpm.mk
+++ b/sysui/CustomTarget_rpm.mk
@@ -54,6 +54,6 @@ $(foreach product,$(PRODUCTLIST),\
 ))
 
 $(rpm_WORKDIR)/%-desktop-integration.tar.gz:
-	$(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 20072fe0cd7f..42a0a8a90633 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 $(call gb_CustomTarget_get_workdir,sysui/share)/%/openoffice.org.xml
 #	pkgmk -l 1073741824 -r $(solaris_WORKDIR) -f $(solaris_WORKDIR)/$*/prototype -o -d $(solaris_WORKDIR) ARCH=all VERSION=$(PKGVERSION.$*)
-	$(GNUTAR) -cf - -C $(solaris_WORKDIR) $* | gzip > $@
+	fakeroot $(GNUTAR) -cf - -C $(solaris_WORKDIR) $* | gzip > $@
 
 # vim: set noet sw=4 ts=4:
commit d949f44c84caf517f6491e1d6f5f1b0c97265eba
Author: Richard PALO <richard at NetBSD.org>
Date:   Fri Sep 29 16:37:21 2017 +0200

    tdf#100013 sysui: fix invalid tar invocation
    
    Change-Id: Ie7c482d387f9ffd3be92759200446951b9084408
    (cherry picked from commit ba65817fb927b1b2db8872fc981fd878219ab968)

diff --git a/sysui/CustomTarget_solaris.mk b/sysui/CustomTarget_solaris.mk
index ed264fe95960..20072fe0cd7f 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 $(call gb_CustomTarget_get_workdir,sysui/share)/%/openoffice.org.xml
 #	pkgmk -l 1073741824 -r $(solaris_WORKDIR) -f $(solaris_WORKDIR)/$*/prototype -o -d $(solaris_WORKDIR) ARCH=all VERSION=$(PKGVERSION.$*)
-	$(GNUTAR) -cf - -C $(solaris_WORKDIR) $*$(LIBO_MAJOR) -desktop-int | gzip > $@
+	$(GNUTAR) -cf - -C $(solaris_WORKDIR) $* | gzip > $@
 
 # vim: set noet sw=4 ts=4:
commit 54d25bd74a80f77b7960d3ed9ca52d4eff744310
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Tue Feb 13 20:29:10 2018 +0100

    tdf#115554:  Create tar archives using 'fakeroot'
    
    'tar' must be run as root or faked to be run as root,
    to make sure that file ownerships and permissions inside
    the created tar archives are as desired (root:root).
    
    Have fakeroot take care about creating an appropriate
    environment rather than using the custom "libgetuid",
    to no longer have to care about tar internals by ourselves.
    
    This fixes the problem that file ownerships are incorrect
    when tar version >= 1.24 is used for
    
    * tar archives holding all the generated deb/rpm packages
      (created in 'download.pm')
    * tar archives created by using the
      '--with-pacakage-format=archive' autogen option
      (created in 'simplepackage.pm')
    
    Change-Id: Id20ccce4d002ff95c75292eda8080ca299eee3a5
    Reviewed-on: https://gerrit.libreoffice.org/49682
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 2b266a338718ccd994a4cef05f128eb0c1b9fdc7)

diff --git a/configure.ac b/configure.ac
index 40f0b304c359..8ee626ced9f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4604,6 +4604,15 @@ msi - Windows .msi
             ;;
         esac
     done
+    # 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
+            AC_MSG_ERROR(
+                [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
+        fi
+    fi
     PKGFORMAT="$with_package_format"
     AC_MSG_RESULT([$PKGFORMAT])
 else
@@ -7422,10 +7431,6 @@ if test "$enable_epm" = "yes"; then
         if test "$DPKG" = "no"; then
             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
         fi
-        AC_PATH_PROG(FAKEROOT, fakeroot, no)
-        if test "$FAKEROOT" = "no"; then
-            AC_MSG_ERROR([fakeroot needed for deb creation. Install fakeroot.])
-        fi
     fi
     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm
index d62680d84ca0..63103816e89f 100644
--- a/solenv/bin/modules/installer/download.pm
+++ b/solenv/bin/modules/installer/download.pm
@@ -187,17 +187,6 @@ sub call_sum
 }
 
 #########################################################
-# Searching for the getuid.so
-#########################################################
-
-sub get_path_for_library
-{
-    my $getuidlibrary = $ENV{'WORKDIR'} . '/LinkTarget/Library/libgetuid.so';
-    if ( ! -e $getuidlibrary ) { installer::exiter::exit_program("File $getuidlibrary does not exist!", "get_path_for_library"); }
-    return $getuidlibrary;
-}
-
-#########################################################
 # Include the tar file into the script
 #########################################################
 
@@ -230,12 +219,12 @@ sub include_tar_into_script
 
 sub tar_package
 {
-    my ( $installdir, $tarfilename, $getuidlibrary) = @_;
+    my ( $installdir, $tarfilename, $usefakeroot) = @_;
 
-    my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; }
+    my $fakerootstring = "";
+    if ( $usefakeroot ) { $fakerootstring = "fakeroot"; }
 
-    my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - * > $tarfilename";
+    my $systemcall = "cd $installdir; $fakerootstring tar -cf - * > $tarfilename";
 
     my $returnvalue = system($systemcall);
 
@@ -505,7 +494,7 @@ sub set_download_filename
 
 sub create_tar_gz_file_from_directory
 {
-    my ($installdir, $getuidlibrary, $downloaddir, $downloadfilename) = @_;
+    my ($installdir, $usefakeroot, $downloaddir, $downloadfilename) = @_;
 
     my $infoline = "";
 
@@ -514,8 +503,8 @@ sub create_tar_gz_file_from_directory
     my $changedir = $installdir;
     installer::pathanalyzer::get_path_from_fullqualifiedname(\$changedir);
 
-    my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; }
+    my $fakerootstring = "";
+    if ( $usefakeroot ) { $fakerootstring = "fakeroot"; }
 
     $installer::globals::downloadfileextension = ".tar.gz";
     $installer::globals::downloadfilename = $downloadfilename . $installer::globals::downloadfileextension;
@@ -527,7 +516,7 @@ sub create_tar_gz_file_from_directory
         unlink("$installdir/install");
     }
 
-    my $systemcall = "cd $changedir; $ldpreloadstring tar -cf - $packdir | gzip > $targzname";
+    my $systemcall = "cd $changedir; $fakerootstring tar -cf - $packdir | gzip > $targzname";
 
     my $returnvalue = system($systemcall);
 
@@ -714,13 +703,13 @@ sub create_download_sets
     if ( ! $installer::globals::iswindowsbuild )    # Unix specific part
     {
 
-        # getting the path of the getuid.so (only required for Solaris and Linux)
-        my $getuidlibrary = "";
-        if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild )) { $getuidlibrary = get_path_for_library(); }
+        # whether to use fakeroot (only required for Solaris and Linux)
+        my $usefakeroot = 0;
+        if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild )) { $usefakeroot = 1; }
 
         if ( $allvariableshashref->{'OOODOWNLOADNAME'} )
         {
-            my $downloadfile = create_tar_gz_file_from_directory($installationdir, $getuidlibrary, $downloaddir, $downloadname);
+            my $downloadfile = create_tar_gz_file_from_directory($installationdir, $usefakeroot, $downloaddir, $downloadname);
         }
         else
         {
@@ -741,7 +730,7 @@ sub create_download_sets
 
             # create tar file
             my $temporary_tarfile_name = $downloaddir . $installer::globals::separator . 'installset.tar';
-            my $size = tar_package($installationdir, $temporary_tarfile_name, $getuidlibrary);
+            my $size = tar_package($installationdir, $temporary_tarfile_name, $usefakeroot);
             installer::exiter::exit_program("ERROR: Could not create tar file $temporary_tarfile_name!", "create_download_sets") unless $size;
 
             # calling sum to determine checksum and size of the tar file
diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm
index 95ccfe75255f..23b9983a6eb5 100644
--- a/solenv/bin/modules/installer/simplepackage.pm
+++ b/solenv/bin/modules/installer/simplepackage.pm
@@ -438,16 +438,14 @@ sub create_package
     }
     else
     {
-        # getting the path of the getuid.so (only required for Solaris and Linux)
-        my $getuidlibrary = "";
-        my $ldpreloadstring = "";
+        # use fakeroot (only required for Solaris and Linux)
+        my $fakerootstring = "";
         if (( $installer::globals::issolarisbuild ) || ( $installer::globals::islinuxbuild ))
         {
-            $getuidlibrary = installer::download::get_path_for_library($includepatharrayref);
-            if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . $getuidlibrary; }
+            $fakerootstring = "fakeroot";
         }
 
-        $systemcall = "cd $tempdir; $ldpreloadstring tar -cf - . | gzip > $archive";
+        $systemcall = "cd $tempdir; $fakerootstring tar -cf - . | gzip > $archive";
     }
 
     if ( $makesystemcall )
commit b18be37dd5a2740701e59b6c90b31b54c7c38d5f
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Mon Feb 12 12:35:47 2018 +0100

    tdf#115554:  Use 'fakeroot' to build Debian packages
    
    The command to create Debian packages must be run
    as root or faked to be run as root.
    The 'fakeroot' makes sure the command is run in an environment
    faking root privileges for file manipulation.
    
    This makes sure that file ownerships and permissions inside the
    created deb packages are correct.
    
    Using fakeroot instead of the custom "libgetuid" makes it
    unnecessary to care about internals of the underlying tools
    (like tar) and changes in those by ourselves.
    
    Change-Id: I2cbb203ab84f740377e535c1051c2b879779b164
    Reviewed-on: https://gerrit.libreoffice.org/49597
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit bcc5790554f02d65b03eebcc47fb8859fcf44643)

diff --git a/configure.ac b/configure.ac
index d08c964bac99..40f0b304c359 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7422,6 +7422,10 @@ if test "$enable_epm" = "yes"; then
         if test "$DPKG" = "no"; then
             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
         fi
+        AC_PATH_PROG(FAKEROOT, fakeroot, no)
+        if test "$FAKEROOT" = "no"; then
+            AC_MSG_ERROR([fakeroot needed for deb creation. Install fakeroot.])
+        fi
     fi
     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm
index 3ee2ca0db107..2f434c47e2d1 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -789,17 +789,6 @@ sub set_patch_state
 }
 
 #################################################
-# LD_PRELOAD string for Debian packages
-#################################################
-
-sub get_ld_preload_string
-{
-    my $getuidlibrary = $ENV{'WORKDIR'} . '/LinkTarget/Library/libgetuid.so';
-    if ( ! -e $getuidlibrary ) { installer::exiter::exit_program("File $getuidlibrary does not exist!", "get_ld_preload_string"); }
-    return 'LD_PRELOAD=' . $getuidlibrary;
-}
-
-#################################################
 # Calling epm to create the installation sets
 #################################################
 
@@ -818,11 +807,11 @@ sub call_epm
     my $outdirstring = "";
     if ( $installer::globals::epmoutpath ne "" ) { $outdirstring = " --output-dir $installer::globals::epmoutpath"; }
 
-    # Debian package build needs a LD_PRELOAD for correct rights
+    # Debian package build needs to be run with fakeroot for correct ownerships/permissions
 
-    my $ldpreloadstring = "";
+    my $fakerootstring = "";
 
-    if ( $installer::globals::debian ) { $ldpreloadstring = get_ld_preload_string($includepatharrayref) . " "; }
+    if ( $installer::globals::debian ) { $fakerootstring = "fakeroot "; }
 
     my $extraflags = "";
         if ($ENV{'EPM_FLAGS'}) { $extraflags = $ENV{'EPM_FLAGS'}; }
@@ -832,7 +821,7 @@ sub call_epm
     my $verboseflag = "-v";
     if ( ! $installer::globals::quiet ) { $verboseflag = "-v2"; };
 
-    my $systemcall = $ldpreloadstring . $epmname . " -f " . $packageformat . " " . $extraflags . " " . $localpackagename . " " . $epmlistfilename . $outdirstring . " " . $verboseflag . " " . " 2\>\&1 |";
+    my $systemcall = $fakerootstring . $epmname . " -f " . $packageformat . " " . $extraflags . " " . $localpackagename . " " . $epmlistfilename . $outdirstring . " " . $verboseflag . " " . " 2\>\&1 |";
 
     installer::logger::print_message( "... $systemcall ...\n" );
 
diff --git a/sysui/CustomTarget_deb.mk b/sysui/CustomTarget_deb.mk
index 8a48894177aa..dd75ee913c62 100644
--- a/sysui/CustomTarget_deb.mk
+++ b/sysui/CustomTarget_deb.mk
@@ -60,13 +60,12 @@ $(deb_WORKDIR)/%/DEBIAN/control: $(deb_SRCDIR)/control $(call gb_CustomTarget_ge
 	echo "Version: $(PKGVERSION)-$(LIBO_VERSION_PATCH)" >>$@
 	du -k -s $(deb_WORKDIR)/$* | $(gb_AWK) -F ' ' '{ printf "Installed-Size: %s\n", $$1 ; }' >>$@
 
-$(deb_WORKDIR)/%$(PKGVERSIONSHORT)-debian-menus_$(PKGVERSION)-$(LIBO_VERSION_PATCH)_all.deb: $(deb_WORKDIR)/%/DEBIAN/postrm $(deb_WORKDIR)/%/DEBIAN/postinst $(deb_WORKDIR)/%/DEBIAN/prerm $(deb_WORKDIR)/%/DEBIAN/control $(call gb_Library_get_target,getuid)
+$(deb_WORKDIR)/%$(PKGVERSIONSHORT)-debian-menus_$(PKGVERSION)-$(LIBO_VERSION_PATCH)_all.deb: $(deb_WORKDIR)/%/DEBIAN/postrm $(deb_WORKDIR)/%/DEBIAN/postinst $(deb_WORKDIR)/%/DEBIAN/prerm $(deb_WORKDIR)/%/DEBIAN/control
 
 	chmod -R g-w $(deb_WORKDIR)/$*
 	chmod a+rx $(deb_WORKDIR)/$*/DEBIAN \
 		$(deb_WORKDIR)/$*/DEBIAN/pre* $(deb_WORKDIR)/$*/DEBIAN/post*
 	chmod g-s $(deb_WORKDIR)/$*/DEBIAN
-	LD_PRELOAD=$(call gb_Library_get_target,getuid) \
-		   dpkg-deb --build $(deb_WORKDIR)/$* $@
+	fakeroot dpkg-deb --build $(deb_WORKDIR)/$* $@
 
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list