[Libreoffice-commits] core.git: configure.ac solenv/bin

Michael Weghorn m.weghorn at posteo.de
Sun Feb 18 01:24:30 UTC 2018


 configure.ac                                  |   13 ++++++---
 solenv/bin/modules/installer/download.pm      |   37 +++++++++-----------------
 solenv/bin/modules/installer/simplepackage.pm |   10 ++-----
 3 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit 2b266a338718ccd994a4cef05f128eb0c1b9fdc7
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>

diff --git a/configure.ac b/configure.ac
index 74a0a4e6844b..c40f61b3f1c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4359,6 +4359,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
@@ -7296,10 +7305,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 )


More information about the Libreoffice-commits mailing list