Monthly Archives: March 2012

Fixing unresolved dependencies error

For a while now we’ve been getting the following errors on one of our sites:

WARNING GenericSetup There are unresolved or circular dependencies. Graphviz
diagram:: digraph dependencies {"typeinfo" -> "toolset"; "tinymce_settings"
-> "componentregistry"; "transmogrifier" -> "toolset"; "kss_mimetype" ->
"mimetypes-registry-various"; "pleonformgen" -> "toolset"; "pleonformgen" ->
"propertiestool"; "pleonformgen" -> "typeinfo"; "atcttool" -> "catalog";
"atcttool" -> "componentregistry"; "actions" -> "componentregistry";
[snip]

Apparently they are not harmful so I let them be for a while. But yesterday, while upgrading to Plone 4.2b2, it was time to track down the source of these errors and hopefully fix them.

I started by downloading GraphViz to vizualize the dependency diagram reported by GenericSetup. After I had it installed it was time to create a .dot file that I could feed into GraphViz. I did that by creating an empty file, adding strict digraph G to the first line, followed by whatever GS outputted in curly braces:

strict digraph G {"typeinfo" -> "toolset"; "tinymce_settings" ->
"componentregistry"; "transmogrifier" -> "toolset"; "kss_mimetype" ->
"mimetypes-registry-various"; "pleonformgen" -> "toolset"; "pleonformgen" ->
"propertiestool"; "pleonformgen" -> "typeinfo"; "atcttool" -> "catalog";
"atcttool" -> "componentregistry"; "actions" -> "componentregistry";
[snip]

Opening my graph.dot in GraphViz I was presented with the following diagram, showing two unresolved dependencies: plonepas and collective.prettyphoto.

blog/graph.png

I started with collective.prettyphoto as it’s an add-on and probably easier to fix than Plone Core. After some research I found out that this issue was already fixed by Ross Patterson. Pinning collective.prettyphoto to the latest release, 0.4.4, indeed fixed the problem:

blog/graph2.png

Moving on to the remaining issue: plonepas. I first wanted to check whether this issue is relevant just to my site or is it a general Plone bug. I created a vanilla Plone instance, tried installing some add-ons and everything was OK, no errors. Apparently it was something in the state of my site that was broken.

Glancing through the long discussion on Trac about these issues I dediced to dig deeper. Using the following (ugly) one-liner I got the list of dependencies for plonepas as set in my portal_setup:

>>> [i for i in self.context.portal_setup.getImportStepRegistry(), _import_step_registry][0]._registered['plonepas']['dependencies']
(u'componentregistry', u'controlpanel', u'memberdata-properties', u'plonepas-contents', u'rolemap')

Hmm, that plonepas-content seemed suspicious as it was already reported as non-existent step. Looking at Products.PlonePAS-4.0.11 (that comes with Plone 4.2b2) and its configure.zcml,depenedencies should be the following:

  • componentregistry
  • controlpanel
  • memberdata-properties
  • rolemap

Time to remove that plonepas-content from the dependencies list! I used the following migration script to take care of it:

def fix_plonepas_dependencies(setup_tool):
    """Remove 'plonepas-content' as a dependency for 'plonepas' GS profile."""
    from Products.GenericSetup.registry import _import_step_registry
    for registry in setup_tool.getImportStepRegistry(), _import_step_registry:
        registry._registered.get('plonepas')['dependencies'] = \
            (u'componentregistry', u'memberdata-properties', u'rolemap', u'controlpanel')

And that’s it! We no longer get unresolved dependencies errors when (re)installing add-ons or doing upgrades. Yay!