Skip to content. | Skip to navigation

Navigation

You are here: Home / Support / Guides / Tools / Plone / Upgrading to Plone 4 / Build Plone 4

Personal tools

Upgrading to Plone 4

Issues encountered with upgrading to Plone 4 from Plone 3.3.5

Build Plone 4

A few Problems building Plone 4 on OpenSolaris

With the all singing all-dancing Unified Installer it should be a breeze.

Well, perhaps on more mainstream systems. Here in the OpenSolaris backwaters we have to do a bit of jiggery-pokery.

This is for OpenSolaris snv_134, the last released version before Oracle put a stop to it.

Install Plone

This is going to fail but we need to bootstrap the system. We'll be doing this as root and for a zeo system.

Note

We need to ask for zlib to be built as a libz.a is likely to be found which doesn't work.

Note

To avoid complications, this document will use ${PLONEDIR} for where Plone is to be installed.

# ./install.sh --target=${PLONEDIR} --zlib=yes zeo
...
Installing Python 2.6.6. This takes a while...
Installing distribute...
${PLONEDIR}/Python-2.6/bin/easy_install missing. Aborting.

Installation has failed.
See the detailed installation log at .../Plone-4.0.3-UnifiedInstaller/install.log to determine the cause.

easy_install is missing because, ultimately, the build of Python failed to build the _socket module. It also failed to build the _cursesmodule which is another OpenSolaris peculiarity which we can fix though isn't required.

Warning

At this point in time there is an installed but broken Python installed in ${PLONEDIR}/Python-2.6 which will interfere with our subsequent attempts to build and install a patched version of Python. So:

# rm -rf ${PLONEDIR}/Python-2.6

Build Python Separately

Having Python built as part of Plone causes problems as Plone uses a tarball inside its distribution -- we'd need to patch the tarball.

Instead, we'll take a copy of the tarball, unpack it, patch it and install it where Plone would have installed it ( ${PLONEDIR}/Python-2.6 based on the --target argument above).

# bzcat packages/Python-2.6.6.tar.bz2 | tar xf -
# cd Python-2.6.6
# ./configure --prefix=${PLONEDIR}/Python-2.6

_socket

Plone's install.sh script has the necessary fix for us (see helper_scripts/build_python.sh) but it doesn't get applied because SunOS' /usr/bin/sed is a bit pedantic. In particular ^ and $ only have their meanings if they are the first or last characters in the regexp. The fix reads:

# mv pyconfig.h pyconfig.h.bak
# /usr/bin/sed -e "s|\(^#define HAVE_NETPACKET_PACKET_H 1$\)|/* \1 */|" pyconfig.h.bak >pyconfig.h

but should either read:

# /usr/gnu/bin/sed -e "s|\(^#define HAVE_NETPACKET_PACKET_H 1$\)|/* \1 */|" pyconfig.h.bak >pyconfig.h

or:

# /usr/bin/sed -e "s|^\(#define HAVE_NETPACKET_PACKET_H 1\)$|/* \1 */|" pyconfig.h.bak >pyconfig.h

We have to do this after running configure.

_cursesmodule

This also fails for peculiar OpenSolaris reasons. Here, the stock readline library does not have the mvwchgat and wchgat functions. This isn't necessary for Plone so you can skip this if you want.

Much googling reveals a Solaris-specific patch which needs a little tweaking.

autoconf

As a general purpose solution (for all platforms) the patch also requires autoconf to rebuild configure from configure.in! Ultimately, the patches to _cursesmodule requires that HAVE_CURSES_WCHGAT be defined in pyconfig.h for the functions to be used. If we don't make these changes to configure.in then (obviously?) HAVE_CURSES_WCHGAT won't be defined in pyconfig.h and we can simply build Python on Solaris/OpenSolaris.

If you want to (re-)use the same Python sources on other platforms you'll want to apply the configure.in patch.

Patch configure.in

Building autoconf is easy so let's assume you've done that.

The apply this patch:

# patch -p0 <<EOF

*** configure.in.orig  Tue May 25 03:27:03 2010
--- configure.in       Sun Feb 27 15:23:39 2011
***************
*** 3817,3822 ****
--- 3817,3840 ----
    [Define if WINDOW in curses.h offers a field _flags.])
  fi

+ AC_MSG_CHECKING(whether libcurses has wchgat and mvwchgat)
+ AC_CACHE_VAL(ac_cv_have_wchgat,
+ AC_TRY_COMPILE([#include <curses.h>], [
+   WINDOW *w;
+   int rtn;
+    rtn = mvwchgat(w,0,0,0,0,0,(void*)0);
+    rtn = wchgat(w,0,0,0,(void*)0);
+ ], ac_cv_have_wchgat=yes,
+    ac_cv_have_wchgat=no,
+    ac_cv_have_wchgat=no))
+ AC_MSG_RESULT($ac_cv_have_wchgat)
+
+ if test "$ac_cv_have_wchgat" = yes
+ then
+   AC_DEFINE(HAVE_CURSES_WCHGAT, 1,
+   [Define if mvwchgat and wchgat exist in libcurses])
+ fi
+
  AC_MSG_CHECKING(for is_term_resized)
  AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
    AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
EOF

Now run autoconf and re-run configure:

# autoconf
# ./configure ...
Patch pyconfig.h

Under Solaris/OpenSolaris the changes to configure will not add a line to pyconfig.h indicating that wchgat is available in curses so you don't need to do anything!

Modules/_cursesmodules.c

Now we need to patch _cursesmodule.c itself:

# patch -p0 <<EOF
*** Modules/_cursesmodule.c.orig       Thu Aug  5 17:35:53 2010
--- Modules/_cursesmodule.c    Sun Feb 27 15:25:10 2011
***************
*** 662,667 ****
--- 662,668 ----

  /* chgat, added by Fabian Kreutz <fabian.kreutz at gmx.net> */

+ #if defined(HAVE_CURSES_WCHGAT)
  static PyObject *
  PyCursesWindow_ChgAt(PyCursesWindowObject *self, PyObject *args)
  {
***************
*** 714,719 ****
--- 715,721 ----
      }
      return PyCursesCheckERR(rtn, "chgat");
  }
+ #endif /* HAVE_CURSES_WCHGAT */


  static PyObject *
***************
*** 1543,1549 ****
--- 1545,1553 ----
              {"attron",          (PyCFunction)PyCursesWindow_AttrOn, METH_VARARGS},
              {"attrset",         (PyCFunction)PyCursesWindow_AttrSet, METH_VARARGS},
              {"bkgd",            (PyCFunction)PyCursesWindow_Bkgd, METH_VARARGS},
+ #if defined(HAVE_CURSES_WCHGAT)
              {"chgat",           (PyCFunction)PyCursesWindow_ChgAt, METH_VARARGS},
+ #endif /* HAVE_CURSES_WCHGAT */
              {"bkgdset",         (PyCFunction)PyCursesWindow_BkgdSet, METH_VARARGS},
              {"border",          (PyCFunction)PyCursesWindow_Border, METH_VARARGS},
              {"box",             (PyCFunction)PyCursesWindow_Box, METH_VARARGS},
EOF

Which is basically commenting out the unavailable function!

Build and Install

Easy enough but remember that if you've re-run configure you'll have to repatch pyconfig.h for the HAVE_NETPACKET_H issue.

# make install

Re-Install Plone

Warning

install.sh makes some basic decisions about what to rebuild based on the presence of certain files and directories. You may need to delete ${PLONEDIR}/buildout-cache before re-running install.sh.

Note

Make sure you have GNU tar on your path before the standard SunOS tar:

PATH=/usr/gnu/bin:$PATH
# ./install --target=${PLONEDIR} --zlib=yes zeo

Document Actions