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

Michael Weghorn m.weghorn at posteo.de
Sun Feb 18 01:23:40 UTC 2018


 configure.ac                            |    4 ++++
 solenv/bin/modules/installer/epmfile.pm |   19 ++++---------------
 sysui/CustomTarget_deb.mk               |    5 ++---
 3 files changed, 10 insertions(+), 18 deletions(-)

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

diff --git a/configure.ac b/configure.ac
index f18fa31dce5d..74a0a4e6844b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7296,6 +7296,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 eabab4cd05ae..bc6a76ccf44d 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