Search code examples
dependency-managementsmalltalkpharo

Pharo dependency hell


I am trying to develop a simple project in Pharo, and I would like to add its dependencies in Metacello. My project depends on Glamour, Roassal and XMLSupport.

A way to cleanly install my project is to install the dependencies by hand first. Following the book Deep into Pharo one can do

Gofer new
  smalltalkhubUser: 'Moose' project: 'Glamour';
  package: 'ConfigurationOfGlamour';
  load.
(Smalltalk at: #ConfigurationOfGlamour) perform: #loadDefault.

Gofer new smalltalkhubUser: 'ObjectProfile'
  project: 'Roassal';
  package: 'ConfigurationOfRoassal';
  load.
(Smalltalk at: #ConfigurationOfRoassal) load.

Gofer new
  squeaksource: 'XMLSupport'; 
  package: 'ConfigurationOfXMLSupport';
  load.
(Smalltalk at: #ConfigurationOfXMLSupport) perform: #loadDefault.

and then my project will work fine.

I have tried to create a ConfigurationOfMyProject using the Versionner, and I have added Glamour, Roassal and XMLSupport as dependencies, using the version that are currently installed in my image (2.6-snapshot, 1.430 and 1.2.1 respectively).

The problem is that I am not able to load my project using Metacello in a fresh image. The project loads fine, but whenever I try to load my classes I get method missing errors in Glamour. Moreover, it is apparent that something is different, because even the world menu has different entries.

I have tried other combinations of versions, including using the stable Glamour (2.1) but I have obtained more errors, including not even being able to open the project in the Versioner (it complains about a missing Roassal name).

What is the correct way to add these dependencies cleanly?


Solution

  • First of all I want to highlight that if configuration is in class ConfigurationOf<proj-name> you can load it as using #configuration message:

    Gofer new
      smalltalkhubUser: 'Moose' project: 'Glamour';
      configuration;
      load.
    (Smalltalk at: #ConfigurationOfGlamour) perform: #loadDefault.
    

    A I don't see your project, I can just suggest you to write configuration by hand. There is an easy tutorial called Dead simple intro to Metacello.

    According to your description it should be something like:

    baseline01: spec 
      <version: '0.1'>
    
      spec for: #common do: [  
        spec blessing: #release.
        spec repository: 'your repo url'.
    
        spec 
          package: 'YourPackage' with: [
            spec requires: #('Glamour' 'Roassal' 'XMLSupport') ].
        "also maybe you have a couple of packages that depend on different projects"
    
        spec project: 'Glamour' with: [
          spec 
            className: 'ConfigurationOf Glamour';
            repository: 'http://smalltalkhub.com/mc/Moose/Glamour/main';
            version: #'2.6-snapshot' ].
    
        spec project: 'Roassal' with: [
          spec 
            className: 'ConfigurationOfRoassal';
            repository: 'http://smalltalkhub.com/mc/ObjectProfile/Roassal/main';
            version: #'1.430' ].
    
        "and same for XMLSupport" ].
    

    Also you can try to load #development versions, as I have an impression that projects like Roassal and Glamour have very outdated stable versions. Also please note that Roassal2 is actively developed and will replace original Roassal in Moose platform, maybe you want to consider using it.