From Fedora Project Wiki

Revision as of 10:02, 15 July 2010 by Caolanm (talk | contribs) (Created page with '== General OpenOffice.org extension rpm guidelines == # Extensions '''Must''' be named openoffice.org-FOO. # Extensions '''Should''' be both installed unpacked, see next sectio...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

General OpenOffice.org extension rpm guidelines

  1. Extensions Must be named openoffice.org-FOO.
  2. Extensions Should be both installed unpacked, see next section for how to correct install an unpacked extension.
  3. Unpacked Extensions Must be installed in a dir called NAME.oxt, NAME.uno.pkg or NAME.zip
  4. An extension should normally just be able to just Require: an appropriate openoffice.org component e.g. openoffice.org-core, without a specific n-v-r as extensions use the stable UNO abi which rarely changes, and then only to add extra APIs. So unless you require a specific feature of a openoffice.org release there is no need to require a specific n-v-r and force a rebuild on every n-v-r of openoffice.org.
  5. Extensions are similar to e.g. xorg video drivers in that there exist proprietary or binary only extensions, but of course normal Fedora rules apply to what extensions can be packaged, i.e. see normal packaging licensing etc. rules. The license Must be acceptable, and the package Must be built from source.
  6. Extensions can be written in any language that has a uno binding, e.g. C++, python, java or StarBasic. Consider the additional packaging guidelines of the language that the extension is written in if such guidelines exists.
  7. Some obsolete versions of openoffice.org < F9 had bugs in unopkg, so the minimum Requires are: 2.3.0-6.12 for F8, and 2.3.0-6.6 for F7

F-14 or later, i.e. OpenOffice.org 3.3 or later

  1. >= 3.3.0 supports bundled extensions which are simpler to manage than 'shared' extensions.
  2. Extensions Must be installed unpacked. This importantly allows the standard rpmbuild tooling to determine additional autorequires for a package or find flaws that cannot be seen if an opaque zip/oxt is installed.
  3. The location where an extension is unpacked Must be %{_libdir}/openoffice.org/extensions

An example for >= 3.3.0...

Requires:    openoffice.org-core >= 1:3.3.0

%define baseinstdir %{_libdir}/openoffice.org

%install
install -d -m 755 $RPM_BUILD_ROOT%{baseinstdir}/extensions/writer2latex.oxt
unzip target/lib/writer2latex.oxt -d $RPM_BUILD_ROOT%{baseinstdir}/extensions/writer2latex.oxt

F-13 or earlier, i.e. OpenOffice.org 3.2.1 or earlier

  1. <= 3.2.1 does not support bundled extensions, and must use 'shared' extensions.
  2. Extensions Should be both installed unpacked and then registered with 'unopkg --shared --force --link' where possible. Otherwise during registration of a packed .oxt or .uno.pkg with unopkg the package is automatically unzipped and the contents copied into a persistent cache directory. Using -link and an unpacked .oxt/.uno.pkg dir allows this additional copy to be omitted and importantly allows the rest of the standard rpmbuild tooling to determine additional autorequires for a package or find flaws that cannot be seen in the opaque zip case.
  3. The location where an extension is unpacked Should be in an arch or arch-independent location depending on if the extension has been written in an arch or arch-independent language. e.g. StarBasic and Java only extensions are noarch and Should be unpacked under /usr/share/openoffice.org/extensions, while e.g. C++ extensions are arch-dependant and Must be unpacked under %{_libdir}/openoffice.org/extensions.
  4. Extensions deinstalled with unopkg remove Must have a %postun of 'unopkg list --shared > /dev/null 2>&1' because the actual removal of files is deferred until the next start, so this ensures that this takes place under the control of your rpm on deinstallation.

An example for <= 3.2.1...

Requires(pre):    openoffice.org-core >= 1:2.3.0-6.6
Requires(post):   openoffice.org-core >= 1:2.3.0-6.6
Requires(preun):  openoffice.org-core >= 1:2.3.0-6.6
Requires(postun): openoffice.org-core >= 1:2.3.0-6.6

%install
mkdir -p $RPM_BUILD_ROOT%{_libdir}/openoffice.org/extensions/writer2latex.uno.pkg
unzip target/lib/writer2latex.uno.pkg -d $RPM_BUILD_ROOT%{_libdir}/openoffice.org/extensions/writer2latex.uno.pkg

%pre
if [ $1 -gt 1 ] ; then
unopkg remove --shared org.openoffice.da.writer2latex.oxt > /dev/null 2>&1 || :
fi

%post
unopkg add --shared --force --link %{_libdir}/openoffice.org/extensions/writer2latex.oxt || :

%preun
if [ $1 -eq 0 ] ; then
unopkg remove --shared org.openoffice.da.writer2latex.oxt || :
fi

%postun
unopkg list --shared > /dev/null 2>&1 || :

Special case, migrating packages from shared extensions to bundled extensions, i.e. <= F-13 to >= F-14

  1. If the extension was originally installed as a shared extensions, i.e. with unopkg --shared then on upgrade from <= 3.2.1 to >= 3.3.0 a package Should attempt to deregister the old 'shared' extension before replacing it with the 'bundled' extensions

An example for migrating an extension from <= 3.2.1 to >= 3.3.0...

Requires:    openoffice.org-core >= 1:3.3.0
Requires(pre):    openoffice.org-core >= 1:3.3.0

%define baseinstdir %{_libdir}/openoffice.org

%install
install -d -m 755 $RPM_BUILD_ROOT%{baseinstdir}/extensions/writer2latex.oxt
unzip target/lib/writer2latex.oxt -d $RPM_BUILD_ROOT%{baseinstdir}/extensions/writer2latex.oxt

%pre
if [ $1 -gt 1 ] ; then
# Upgrade => deregister old < 3.3. extension
unopkg remove --shared org.openoffice.da.writer2latex.oxt > /dev/null 2>&1 || :
# Clear disk cache
unopkg list --shared > /dev/null 2>&1 || :
fi