openoffice.org-voikko broken in F7 and F8, please review some changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I noticed my package openoffice.org-voikko being broken in F7 and F8 after it 
had already been pushed to the stable updates, so now there's a broken 
package in these releases and I'd like to fix it ASAP. In the future, I'll 
definitely try to be more thorough with testing my packages.

There are two problems with this package:

1) It tries to install an .oxt extension unzipped (an .oxt file is basically a 
library and some XML files in a zip). However, apparently unzipped extensions 
only work in Rawhide, so in F7 and F8 I need to install the .oxt file as 
such.

Is it ok to install the .oxt file into %{_libdir}/%{name} 
(/usr/lib/openoffice.org-voikko) even though it's not actually a library as 
such, but there is a library inside the file? Any better locations?

2) /usr/lib/openoffice.org/program/unopkg creates files into the user's home 
directory when it's being used. This creates problems if the package is 
installed with sudo and the user invoking sudo is currently running OO.o, the 
extension won't be installed into OO.o even though the files get copied onto 
the filesystem. 

And even if the user is not running OO.o while installing the package with 
sudo, unopkg apparently creates root owned files in the user's home 
directory. There's a following workaround in the Debian package:

TMP_HOME="$(mktemp -t -d $PACKAGE_NAME.XXXXXX)" || exit 1
export HOME="$TMP_HOME"
<run unopkg here>
rm -rf "$TMP_HOME"

Running the rm -rf is a bit ugly, but what do you think, is it ok or too 
risky? I've tested it on my own systems, it appears to not cause any 
problems. If I don't do this, installing openoffice.org-voikko with sudo may 
cause problems to the user. I'd like to get an 'ok' from at least one other 
packager before doing this, though.

Here's the spec file so you can see the whole situation, it still echoes the 
dir it's about to remove, just for safety reasons while testing:

Name:           openoffice.org-voikko
Version:        2.1 
Release:        2%{?dist}
Summary:        Finnish spellchecker and hyphenator extension for 
OpenOffice.org

Group:          Applications/Productivity
License:        GPLv2+
URL:            http://voikko.sourceforge.net/
Source0:        
http://downloads.sourceforge.net/voikko/%{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: openoffice.org-sdk >= 2.0.4 libvoikko-devel >= 1.5
Requires(pre):    openoffice.org-core
Requires(post):   openoffice.org-core
Requires(preun):  openoffice.org-core
Requires(postun): openoffice.org-core
Requires: openoffice.org-core >= 2.0.4 libvoikko >= 1.5

%define oo2_sdk %{_libdir}/openoffice.org/sdk
%define oo2 %{_libdir}/openoffice.org
%define unopkg %{oo2}/program/unopkg
%define voikkodir %{_libdir}/%{name}
%define voikkoext %{_libdir}/%{name}/voikko.oxt

# Can't make debug package as long as we need to install the .oxt file
%define debug_package %{nil}

%description
This package contains a Finnish spell-checking and hyphenation component for
OpenOffice.org. The actual spell-checking and hyphenation functionality is
provided by the Voikko library.


%prep
%setup -q


%build
. %{oo2_sdk}/setsdkenv_unix.sh
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
cd build
voikkoPackage=$(pwd)/voikko.oxt;
# OOo extension
install -d -m 755 $RPM_BUILD_ROOT%{voikkodir}
install -p -m 644 "$voikkoPackage" $RPM_BUILD_ROOT%{voikkodir}

# The TMP_HOME trick is taken from the Debian scripts by Teemu Likonen:
# Registering program 'unopkg' writes things to $HOME/.openoffice* directory
# (even with the '--shared' option). We must set $HOME to some temporary
# directory so that these (root owned) files don't get written to the regular
# user's HOME in case he/she runs this with sudo.

%pre
if [ $1 -gt 1 ]; then
    # Upgrade => deregister old extension
    TMP_HOME="$(mktemp -t -d $PACKAGE_NAME.XXXXXX)" || exit 1
    export HOME="$TMP_HOME"
    echo pre home $HOME
    %{unopkg} remove --shared 
org.puimula.ooovoikko -env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1 || :
    rm -rf "$TMP_HOME"
fi

%post
    # register extension
    TMP_HOME="$(mktemp -t -d $PACKAGE_NAME.XXXXXX)" || exit 1
    export HOME="$TMP_HOME"
    echo post home $HOME
    %{unopkg} 
add --shared %{voikkoext} -env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1 || :
    rm -rf "$TMP_HOME"
 

%preun
if [ $1 -eq 0 ]; then
    # not upgrading => deregister
    TMP_HOME="$(mktemp -t -d $PACKAGE_NAME.XXXXXX)" || exit 1
    export HOME="$TMP_HOME"
    echo preun home $HOME
    %{unopkg} remove --shared 
org.puimula.ooovoikko -env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1 || :
    rm -rf "$TMP_HOME"
fi

%postun
    # clear disk cache
    TMP_HOME="$(mktemp -t -d $PACKAGE_NAME.XXXXXX)" || exit 1
    export HOME="$TMP_HOME"
    echo postun home $HOME
    %{unopkg} list --shared -env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1 
> /dev/null 2>&1 || :
    rm -rf "$TMP_HOME"



%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{voikkodir}
%doc ChangeLog COPYING README


%changelog
<snip>

-- 
Ville-Pekka Vainio

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux