MidCOM PEAR 1.4 packaging works

cover image for MidCOM PEAR 1.4 packaging works

After a bit of discussion and goading from the PEAR community, we decided to package MidCOM for the package.xml 2.0 format and only support PEAR 1.4 or newer.

This decision meant a bit of extra work for me as I had to rewrite the supporting utilities that handle component packaging. However, now that work is done, and I made my first PEAR-powered MidCOM installation today. The result was a working but a bit limited MidCOM environment, as can be seen from this AIS screenshot:

Component selector in AIS

Nice points

PEAR packaging of MidCOM brings lots of benefits, including:

  • Components can have other PEAR packages, components, or even PHP extensions as dependencies that PEAR installer will handle
  • Users can install only the components that they actually need
  • MgdSchema file installation in components is much easier than it used to be
  • We can start shipping static files inside the component package and install using Role_Web

Trying it out

Since packaging is not 100% complete yet, you need an existing Midgard 1.7.x and MidCOM installation to try it out. Here are the steps to follow:

  • Upgrade PEAR to 1.4

      # pear clear-cache
      # pear upgrade PEAR
    
  • Download MidCOM PEAR packages from http://www.nehmer.net/~bergie/pear/

  • Create a new empty MidCOM site using Midgard Site Wizard

  • Log into the site as administrator and go to midcom-admin/settings

  • Set Path to Filesystem MidCOM to point to midcom/lib your PEAR directory
    • In my case the path is /usr/share/php/midcom/lib
    • You can find the directory out by running pear config-get php_dir
  • Install the packages you need. Probably at least these:

      # pear install Role_MgdSchema-1.0.0.tgz
      # pear install midcom-2.5.1cvs.tgz
      # pear install midcom_helper_datamanager-1.tgz
      # pear install de_linkm_taviewer-2.tgz
      # pear install midcom_admin_content-1.tgz
    
  • Invalidate the MidCOM cache by calling http://www.example.net/midcom-cache-invalidate

  • Enjoy! You should now have a working but limited MidCOM 2.5 installation

Note: You might have to create the database tables used by MidCOM core by importing the /usr/share/php/midcom/lib/midcom/config/mgdschema/sql/midcom_dbobjects_full.sql file

Caveats

PEAR packaging of MidCOM is still a bit unfinished. The main missing points are:

  • Most components don’t have the necessary package.xml and status keys in their manifest files yet
  • Actual database tables are not generated for installed MgdSchema XML files. This should be done by calling the midgard-schema utility
  • Package installation and dependency handling is not yet as easy as it will be when we set up a PEAR channel
  • Static files are not packaged yet pending their reorganization in CVS

These missing pieces should be resolves quickly after the mRFC 0021 gets approved.


Read more Midgard posts.