set_soenv.in                             |    1 +
 setup_native/scripts/source/getuid.c     |    7 ++++---
 solenv/bin/modules/installer/download.pm |   22 +++++++++++++++++++---
 solenv/bin/modules/installer/epmfile.pm  |   16 +++++++++++++---
 solenv/bin/modules/installer/worker.pm   |   14 ++++++++++++--
 sysui/desktop/debian/makefile.mk         |    8 +++++++-
 6 files changed, 56 insertions(+), 12 deletions(-)

New commits:
commit 25ff67a743487f42a43079c261c3f0b01824d5b6
Author:     Jim Jagielski <j...@apache.org>
AuthorDate: Wed Jan 16 14:33:38 2019 +0000
Commit:     Jim Jagielski <j...@apache.org>
CommitDate: Wed Jan 16 14:33:38 2019 +0000

    As long as we have the full path, use it

diff --git a/solenv/bin/modules/installer/download.pm 
b/solenv/bin/modules/installer/download.pm
index 0f75e7b138d1..7142f69df2d0 100644
--- a/solenv/bin/modules/installer/download.pm
+++ b/solenv/bin/modules/installer/download.pm
@@ -305,7 +305,7 @@ sub tar_package
     my $ldpreloadstring = "";
 
     if ($ENV{'FAKEROOT'} ne "no") {
-        $ldpreloadstring = "fakeroot"
+        $ldpreloadstring = $ENV{'FAKEROOT'};
     } else {
         if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
     }
@@ -376,7 +376,7 @@ sub create_tar_gz_file_from_package
     my $ldpreloadstring = "";
 
     if ($ENV{'FAKEROOT'} ne "no") {
-        $ldpreloadstring = "fakeroot"
+        $ldpreloadstring = $ENV{'FAKEROOT'};
     } else {
         if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
     }
@@ -801,7 +801,7 @@ sub create_tar_gz_file_from_directory
     my $ldpreloadstring = "";
 
     if ($ENV{'FAKEROOT'} ne "no") {
-        $ldpreloadstring = "fakeroot"
+        $ldpreloadstring = $ENV{'FAKEROOT'};
     } else {
         if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
     }
diff --git a/solenv/bin/modules/installer/epmfile.pm 
b/solenv/bin/modules/installer/epmfile.pm
index 87a42f891968..f5cdd055e3b4 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -893,7 +893,7 @@ sub get_ld_preload_string
 
     if ($ENV{'FAKEROOT'} ne "no") {
 
-        $ldpreloadstring = "fakeroot"
+        $ldpreloadstring = $ENV{'FAKEROOT'};
 
     } else {
 
diff --git a/solenv/bin/modules/installer/worker.pm 
b/solenv/bin/modules/installer/worker.pm
index 4046ad83e937..1849d4359012 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -3201,7 +3201,7 @@ sub tar_package
     my $ldpreloadstring = "";
 
     if ($ENV{'FAKEROOT'} ne "no") {
-        $ldpreloadstring = "fakeroot"
+        $ldpreloadstring = $ENV{'FAKEROOT'};
     } else {
         if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
     }
@@ -3245,7 +3245,7 @@ sub untar_package
     my $ldpreloadstring = "";
 
     if ($ENV{'FAKEROOT'} ne "no") {
-        $ldpreloadstring = "fakeroot"
+        $ldpreloadstring = $ENV{'FAKEROOT'};
     } else {
         if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
     }
diff --git a/sysui/desktop/debian/makefile.mk b/sysui/desktop/debian/makefile.mk
index 8ca9a0b30716..afed0c828171 100644
--- a/sysui/desktop/debian/makefile.mk
+++ b/sysui/desktop/debian/makefile.mk
@@ -46,7 +46,7 @@ DEBFILES=$(foreach,i,{$(PRODUCTLIST)} 
$(PKGDIR)$/$i4.2-$(TARGET)-menus_$(PKGVERS
 .ENDIF
 
 .IF "$(FAKEROOT)"!="no"
-FAKEROOT2="fakeroot"
+FAKEROOT2="$(FAKEROOT)"
 .ELSE
 FAKEROOT2="LD_PRELOAD=$(SOLARBINDIR)/getuid.so"
 .ENDIF
commit 741beaedaf0e14867cabf1b0181bc98c05dc662e
Author:     Jim Jagielski <j...@apache.org>
AuthorDate: Wed Jan 16 13:50:09 2019 +0000
Commit:     Jim Jagielski <j...@apache.org>
CommitDate: Wed Jan 16 13:50:09 2019 +0000

    Use fakeroot instead of our custom getuid.c LD_PRELOAD hack if available 
when creating Debian packages. This is because epm and dpkg (et.al.) need to be 
fooled into thinking that root is creating these packages for the correct 
permissions.

diff --git a/set_soenv.in b/set_soenv.in
index 00c09466b9a1..5f75d3c3aad7 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1806,6 +1806,7 @@ ToFile( "ENABLE_HYPHEN",  "@ENABLE_HYPHEN@", "e" );
 ToFile( "PERL",              $PERL,              "e" );
 ToFile( "RPM",               "@RPM@",            "e" );
 ToFile( "DPKG",              "@DPKG@",           "e" );
+ToFile( "FAKEROOT",          "@FAKEROOT@",       "e" );
 ToFile( "PKGMK",             "@PKGMK@",          "e" );
 ToFile( "GNUMAKE",           "@GNUMAKE@",        "e" );
 ToFile( "GNUTAR",            "@GNUTAR@",         "e" );
diff --git a/setup_native/scripts/source/getuid.c 
b/setup_native/scripts/source/getuid.c
index 7417c3018212..33f52b9bb22a 100644
--- a/setup_native/scripts/source/getuid.c
+++ b/setup_native/scripts/source/getuid.c
@@ -111,10 +111,11 @@ int fstatat64(int fildes, const char *path, struct stat64 
 *buf, int flag)
 }
 #elif  defined LINUX
 
-uid_t getuid  (void) {return 0;}
-uid_t geteuid (void) {return 0;}
+uid_t getuid  (void)    {return 0;}
+uid_t geteuid (void)    {return 0;}
+int setgid    (gid_t p) {return 0;}
 
-/* This is to fool tar */
+/* This is to fool epm, tar, dpkg, et.al. into thinking we are root */
 #ifdef X86_64
 int __lxstat(int n, const char *path, struct stat *buf)
 {
diff --git a/solenv/bin/modules/installer/download.pm 
b/solenv/bin/modules/installer/download.pm
index 01ac9c717ea3..0f75e7b138d1 100644
--- a/solenv/bin/modules/installer/download.pm
+++ b/solenv/bin/modules/installer/download.pm
@@ -303,7 +303,12 @@ sub tar_package
     my ( $installdir, $tarfilename, $getuidlibrary) = @_;
 
     my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+
+    if ($ENV{'FAKEROOT'} ne "no") {
+        $ldpreloadstring = "fakeroot"
+    } else {
+        if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+    }
 
     my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - * > 
$tarfilename";
 
@@ -367,8 +372,14 @@ sub create_tar_gz_file_from_package
     $installer::globals::downloadfileextension = ".tar.gz";
     my $targzname = $packagename . $installer::globals::downloadfileextension;
     $installer::globals::downloadfilename = $targzname;
+
     my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+
+    if ($ENV{'FAKEROOT'} ne "no") {
+        $ldpreloadstring = "fakeroot"
+    } else {
+        if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+    }
 
     my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - $packagename 
| gzip > $targzname";
     $installer::logger::Info->printf("... %s ...\n", $systemcall);
@@ -788,7 +799,12 @@ sub create_tar_gz_file_from_directory
     installer::pathanalyzer::get_path_from_fullqualifiedname(\$changedir);
 
     my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+
+    if ($ENV{'FAKEROOT'} ne "no") {
+        $ldpreloadstring = "fakeroot"
+    } else {
+        if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+    }
 
     $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 21b35981f072..87a42f891968 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -887,10 +887,20 @@ sub get_ld_preload_string
 
     my $getuidlibraryname = "getuid.so";
 
+    my $ldpreloadstring;
+
     my $getuidlibraryref = 
installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$getuidlibraryname,
 $includepatharrayref, 0);
-    if ($$getuidlibraryref eq "") { installer::exiter::exit_program("ERROR: 
Could not find $getuidlibraryname!", "get_ld_preload_string"); }
 
-    my $ldpreloadstring = "LD_PRELOAD=" . $$getuidlibraryref;
+    if ($ENV{'FAKEROOT'} ne "no") {
+
+        $ldpreloadstring = "fakeroot"
+
+    } else {
+
+        if ($$getuidlibraryref eq "") { 
installer::exiter::exit_program("ERROR: Could not find $getuidlibraryname!", 
"get_ld_preload_string"); }
+
+        my $ldpreloadstring = "LD_PRELOAD=" . $$getuidlibraryref;
+    }
 
     return $ldpreloadstring;
 }
@@ -914,7 +924,7 @@ 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 fakeroot or our LD_PRELOAD hack for correct 
rights
 
     my $ldpreloadstring = "";
 
diff --git a/solenv/bin/modules/installer/worker.pm 
b/solenv/bin/modules/installer/worker.pm
index 3364db4fe9d6..4046ad83e937 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -3199,7 +3199,12 @@ sub tar_package
     my ( $installdir, $packagename, $tarfilename, $getuidlibrary) = @_;
 
     my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+
+    if ($ENV{'FAKEROOT'} ne "no") {
+        $ldpreloadstring = "fakeroot"
+    } else {
+        if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+    }
 
     my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - $packagename 
> $tarfilename";
     # my $systemcall = "cd $installdir; $ldpreloadstring tar -cf - * > 
$tarfilename";
@@ -3238,7 +3243,12 @@ sub untar_package
     my ( $installdir, $tarfilename, $getuidlibrary) = @_;
 
     my $ldpreloadstring = "";
-    if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+
+    if ($ENV{'FAKEROOT'} ne "no") {
+        $ldpreloadstring = "fakeroot"
+    } else {
+        if ( $getuidlibrary ne "" ) { $ldpreloadstring = "LD_PRELOAD=" . 
$getuidlibrary; }
+    }
 
     my $systemcall = "cd $installdir; $ldpreloadstring tar -xf $tarfilename";
 
diff --git a/sysui/desktop/debian/makefile.mk b/sysui/desktop/debian/makefile.mk
index 06d6d7a477c4..8ca9a0b30716 100644
--- a/sysui/desktop/debian/makefile.mk
+++ b/sysui/desktop/debian/makefile.mk
@@ -45,6 +45,12 @@ DEBFILES=$(foreach,i,{$(PRODUCTLIST)} 
$(PKGDIR)$/$i4.2-$(TARGET)-menus_$(PKGVERS
 
 .ENDIF
 
+.IF "$(FAKEROOT)"!="no"
+FAKEROOT2="fakeroot"
+.ELSE
+FAKEROOT2="LD_PRELOAD=$(SOLARBINDIR)/getuid.so"
+.ENDIF
+
 # --- Targets -------------------------------------------------------
 
 .INCLUDE :  target.mk
@@ -85,7 +91,7 @@ $(DEBFILES) : makefile.mk control postinst postrm prerm
     @chmod a+rx $(MISC)$/$(@:b)$/DEBIAN $(MISC)/$(@:b)/DEBIAN/post* 
$(MISC)/$(@:b)/DEBIAN/pre*
     @chmod g-s $(MISC)/$(@:b)/DEBIAN
     @mkdir -p $(PKGDIR)
-    /bin/bash -c "LD_PRELOAD=$(SOLARBINDIR)/getuid.so dpkg-deb --build 
$(MISC)/$(@:b) $@" 
+    /bin/bash -c "$(FAKEROOT2) dpkg-deb --build $(MISC)/$(@:b) $@" 
     $(RM) -r $(MISC)$/$(@:b)
 #      @chmod -R g+w $(MISC)/$(TARGET)/$(DEBFILE:f)
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to