Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rebuild Libreoffice for ubuntu 14.04 trusty with python2 support for python-uno
#!/bin/sh
# we need some fixes from 14.10
# sudo add-apt-repository --enable-source ppa:libreoffice/libreoffice-4-3
sudo add-apt-repository --enable-source ppa:libreoffice/libreoffice-4-3 -y
# fetch this repository
sudo apt-get update -y
# update your libreoffice installation
sudo apt-get install libreoffice python3-uno -y
# get all build dependencies for libreoffice
sudo apt-get build-dep libreoffice -y
# that strangely enough doesn't come with the above
sudo apt-get install gcj-jdk python-dev fakeroot -y
# get the actual source code
sudo mkdir /mnt/libreoffice-build
chown ubuntu:ubuntu /mnt/libreoffice-build
cd /mnt/libreoffice-build
apt-get source libreoffice -y
# the folder name is versioned
cd libreoffice*
# we want to have python2
sed -ie 's/^\(ENABLE_PYTHON2=\)n$/\1y/' debian/rules
# and we add the package description to the control file (this is from the debian package)
echo "
Package: python-uno
Provides: \${python:Provides}
XB-Python-Version: \${python:Versions}
Section: oldlibs
Priority: extra
Architecture: alpha amd64 armel armhf hppa i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc powerpcspe ppc64 s390 s390x sparc
Enhances: libreoffice
Depends: libreoffice-core (= \${binary:Version}),
\${misc:Depends},
\${python:Depends},
\${shlibs:Depends}
Breaks: libreoffice-common (<< 1:3.5~), libreoffice-core (<< 1:3.5~)
Conflicts: python3-uno, python3.3-uno
Description: Python-UNO bridge (support for old python 2)
The Python-UNO bridge allows use of the standard LibreOffice API
with the Python scripting language. It additionally allows
others to develop UNO components in Python, thus Python UNO components
may be run within the LibreOffice process and can be called from C++
or the built in StarBasic scripting language.
.
This package is for compatibility with applications/libraries not ported
to python 3 yet. Prefer python3-uno over this.
Homepage: http://udk.openoffice.org/python/python-bridge.html" >> debian/control
# do the build
dpkg-buildpackage -us -uc
# have coffee. a lot of it
# install updated metapackage and the script provider so as not to depend on python3-uno any more
sudo dpkg --install ../libreoffice_*.deb ../libreoffice-script-provider-python*.deb
# remove python3-uno
sudo apt-get remove python3-uno -y
# and finally install the package we want
sudo dpkg --install ../python-uno*.deb
# Hold back so there are no updates made in apt-get update or upgrade
echo libreoffice-common hold | sudo dpkg --set-selections
echo libreoffice-core hold | sudo dpkg --set-selections
echo python-uno hold | sudo dpkg --set-selections
sudo apt-mark hold python-uno
sudo apt-mark hold libreoffice-common
sudo apt-mark hold libreoffice-core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment