Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Rene Engelhard píše v St 19. 01. 2011 v 19:19 +0100:
Hi,

On Wed, Jan 19, 2011 at 07:15:12PM +0100, Petr Mladek wrote:
could you please review the attached patch for the libreoffice-3-3
branch?

OK for bin/generate-bash-completion obviously ...

It produces extra /etc/bash_completion_d/ooffice.sh for the compat
stuff. It was the easiest and most safe solution. It generates exactly
the same .sh files that I got by the previous builds here.

... but what happens if one has ooffice.sh and libreoffice.sh there? Isn't
one of them totally redundant? Would it cause problems?

Great catch! It seems that my testing was not sufficient.

Please, find attached 2nd version of the fix. What do you think about
it? ;-)

It uses different name for the generated bash function. It works here
for the oo* and lo* wrappers at the same time now.


Best Regards,
Petr

From b41209fd91bc8f71e99b34e2c7fec0530aa764d0 Mon Sep 17 00:00:00 2001
From: Petr Mladek <pmladek@suse.cz>
Date: Wed, 19 Jan 2011 18:51:37 +0100
Subject: [PATCH] install bash completion for oo* wrappers when enabled (bnc#665402)

---
 bin/bash-completion.in          |    8 ++++----
 bin/generate-bash-completion    |   19 +++++++++++++++++++
 bin/package-ooo                 |    7 +++++++
 bin/piece/file-list-postprocess |    8 ++++++--
 4 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/bin/bash-completion.in b/bin/bash-completion.in
index 30f4c9c..77087c5 100644
--- a/bin/bash-completion.in
+++ b/bin/bash-completion.in
@@ -1,4 +1,4 @@
-# Programmable bash_completion file for the main OpenOffice.org applications
+# Programmable bash_completion file for the main office applications
 # It is based on /etc/profile.d/complete.bash from SUSE Linux 10.1
 
 _def=; _dir=; _file=; _nosp=
@@ -16,8 +16,8 @@ if complete -o nospace _nullcommand &> /dev/null ; then
 fi
 complete -r _nullcommand &> /dev/null
 
-# General OOo expanding shell function
-_ooexp_ ()
+# General expanding shell function
+@OFFICE_SHELL_FUNCTION@ ()
 {
     # bash `complete' is broken because you can not combine
     # -d, -f, and -X pattern without missing directories.
@@ -84,7 +84,7 @@ _ooexp_ ()
 }
 
 
-complete -d -X '.[^./]*' -F _ooexp_ ${_file} \
+complete -d -X '.[^./]*' -F @OFFICE_SHELL_FUNCTION@ ${_file} \
 @BASH_COMPLETION_OOO_APPS@
 
 unset _def _dir _file _nosp _minusdd _minusdf
diff --git a/bin/generate-bash-completion b/bin/generate-bash-completion
index 3eb5aea..dafe413 100755
--- a/bin/generate-bash-completion
+++ b/bin/generate-bash-completion
@@ -55,12 +55,15 @@ my %APPS = (
        writer          => "lowriter",
 );
 
+my $office_shell_function = "_loexp_";
+
 sub usage()
 {
     print "Script to Generate bash completion for LO wrappers\n\n";
 
     print "Usage: $0 --help\n";
     print "       $0 [--binsuffix=suffix]\n";
+    print "\t\t[--compat-oowrappers]\n";
     print "\t\t[--office=wrapper_name]\n";
     print "\t\t[--master=wrapper_name]\n";
     print "\t\t[--base=wrapper_name]\n";
@@ -78,6 +81,7 @@ sub usage()
     print "Options:\n";
     print "\t--help\t\tprint this help\n";
     print "\t--binsuffix\tdefines a suffix that is added after each wrapper\n";
+    print "\t--compat-oowrappers\tset wrapper names to the old default oo* wrapper names\n";
 
     print "The other options allows to redefine the wrapper names.\n";
     print "The value \"\" can be used to disable any wrapper.\n\n";
@@ -92,6 +96,19 @@ foreach my $arg (@ARGV) {
        if ( $arg =~ /--help/ ) {
                usage();
                exit 0;
+        } elsif ( $arg =~ /--compat-oowrappers/ ) {
+                $APPS{'office'}   = "ooffice";
+                $APPS{'master'}   = "";
+                $APPS{'base'}     = "oobase";
+                $APPS{'calc'}     = "oocalc";
+                $APPS{'draw'}     = "oodraw";
+                $APPS{'impress'}  = "ooimpress";
+                $APPS{'math'}     = "oomath";
+                $APPS{'template'} = "oofromtemplate";
+                $APPS{'unopkg'}   = "unopkg";
+                $APPS{'web'}      = "ooweb";
+                $APPS{'writer'}   = "oowriter";
+                $office_shell_function = "_ooexp_";
        } elsif ( $arg =~ /--binsuffix=(.*)/ ) {
                $binsuffix = "$1";
        } elsif ( $arg =~ /--office=(.*)/ ) {
@@ -202,6 +219,8 @@ open (BCOUTFILE, "> $outfilename") || die "Error: can't open $outfilename for wr
 while (my $line = <BCINFILE>) {
     chomp $line;
 
+    $line =~ s/\@OFFICE_SHELL_FUNCTION\@/$office_shell_function/;
+
     if ($line =~ m/\@BASH_COMPLETION_SUFFIXES_CHECKS\@/) {
        print_suffixes_checks();
     } elsif ($line =~ m/\@BASH_COMPLETION_OOO_APPS\@/) {
diff --git a/bin/package-ooo b/bin/package-ooo
index 3d6b1a6..7427e29 100755
--- a/bin/package-ooo
+++ b/bin/package-ooo
@@ -127,6 +127,9 @@ fi
 # create bash completion
 mkdir -p $OODESTDIR/etc/bash_completion.d
 $TOOLSDIR/bin/generate-bash-completion --binsuffix="$BINSUFFIX" $TOOLSDIR/bin/bash-completion.in 
$OODESTDIR/etc/bash_completion.d/libreoffice${BINSUFFIX}.sh
+if test "$COMPAT_OOWRAPPERS" = "YES" ; then
+    $TOOLSDIR/bin/generate-bash-completion --compat-oowrappers --binsuffix="$BINSUFFIX"  
$TOOLSDIR/bin/bash-completion.in $OODESTDIR/etc/bash_completion.d/ooffice${BINSUFFIX}.sh
+fi
 
 if test "z$VENDORNAME" != "zRedHat"; then
        mkdir -p $MANDIR/man1
@@ -952,6 +955,10 @@ else
        mv usr/share/man/man1/libreoffice$BINSUFFIX.1 \
                pkg/libreoffice-common/usr/share/man/man1
        mkdir -p pkg/libreoffice-common/etc/bash_completion.d
+       if test "$COMPAT_OOWRAPPERS" = "YES" ; then
+               mv etc/bash_completion.d/ooffice$BINSUFFIX.sh \
+                       pkg/libreoffice-common/etc/bash_completion.d
+       fi
        mv etc/bash_completion.d/libreoffice$BINSUFFIX.sh \
                pkg/libreoffice-common/etc/bash_completion.d
        mv .$OOINSTBASE/basis$VERSION/program/java-set-classpath \
diff --git a/bin/piece/file-list-postprocess b/bin/piece/file-list-postprocess
index efe0d68..d0252ab 100755
--- a/bin/piece/file-list-postprocess
+++ b/bin/piece/file-list-postprocess
@@ -24,8 +24,12 @@ fi
 
 # create bash completion
 mkdir -p $DESTDIR/etc/bash_completion.d
-$OO_TOOLSDIR/generate-bash-completion --binsuffix="$BINSUFFIX" $OO_TOOLSDIR/bash-completion.in 
$DESTDIR/etc/bash_completion.d/ooffice${BINSUFFIX}.sh || exit 1;
-echo /etc/bash_completion.d/ooffice${BINSUFFIX}.sh >>files-$piece.txt
+$OO_TOOLSDIR/generate-bash-completion --binsuffix="$BINSUFFIX" $OO_TOOLSDIR/bash-completion.in 
$DESTDIR/etc/bash_completion.d/libreoffice${BINSUFFIX}.sh || exit 1;
+echo /etc/bash_completion.d/libreoffice${BINSUFFIX}.sh >>files-$piece.txt
+if test "$COMPAT_OOWRAPPERS" == 'YES' ; then
+    $OO_TOOLSDIR/generate-bash-completion --compat-oowrappers --binsuffix="$BINSUFFIX" 
$OO_TOOLSDIR/bash-completion.in $DESTDIR/etc/bash_completion.d/ooffice${BINSUFFIX}.sh || exit 1;
+    echo /etc/bash_completion.d/ooffice${BINSUFFIX}.sh >>files-$piece.txt
+fi
 
 echo "Installing $OO_INSTDIR/basis$VERSION/program/java-set-classpath"
 sed -e "s|@OOINSTBASE@|$OO_INSTDIR|g" $OO_TOOLSDIR/java-set-classpath.in 
$DESTDIR$OO_INSTDIR/basis$VERSION/program/java-set-classpath || exit 1;
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.