Andrea
Andrea

Reputation: 20493

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?

Upvotes: 4

Views: 1103

Answers (3)

Stephan Eggermont
Stephan Eggermont

Reputation: 15907

It looks like you are trying this in an old version of Pharo?

Roassal has been superseded by Roassal2, and the support for XML is on smalltalkhub, split into ConfigurationOfXMLWriter and ConfigurationOfXMLParser, both in PharoExtras.

If you load the right groups from Glamour you don't need to describe the dependencies on Roassal, as Glamour already depends on Roassal(2). That explains your cyclic dependency.

You have also run into the problem we've recently talk about on the pharo mailing lists that #stable is not a usable symbolic version name. In the Seaside/Magritte/Grease projects we've changed to using #'release3.1' style symbolic version names. That ensures that there is less of a ripple effect when progressing stable.

Snapshot versions should never be a dependency, they just describe what is loaded at the moment, and are basically not upgradable.

[edit] Metacello by default tries to be smart about not installing older versions over newer. This works pretty well as long as things are not moved to different packages. So it's a bit of bad luck there that you ended up with a non-working combination.

Metacello support complex workflows, and different smalltalk projects (need to) use different workflows. It often takes some time to reach consensus on the best way to do things.

Roassal does not depend on Glamour, but you can create the cycle in your own configuration :)

Packages were moved from squeaksource to ss3 and smalltalkhub because the server had had stability problems. More recently, those problems seem to have been fixed. The xml support was split as it was noted that a lot of applications actually don't need both writing and reading of xml.

Once you have a working configuration, it might be a good idea to build and test it on the continuous integration server of pharo: http://ci.inria.fr/pharo-contribution If not your actually application, at least the open source parts as used by you. That way the Pharo, Glamour & Roassal teams can know if a change they make breaks something.

Upvotes: 1

Uko
Uko

Reputation: 13386

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.

Upvotes: 3

Sean DeNigris
Sean DeNigris

Reputation: 6390

I would seriously discourage writing configs by hand - that is the assembly code of Metacello ;) Unless you are working on cross-Smalltalk-platform projects with platform-specific code (e.g. code for Pharo 1.4 vs Squeak 4.5) - an area which hasn't been explored yet, Versionner is the tool for you. I have written dozens of configs with it and have yet to run into a roadblock.

When you say you added them as dependencies, did you just add them as projects in the "Dependent projects" pane?

enter image description here

If so, you also have to specify which of your project's packages depend on them. To do this, you select the relevant package of your project on the "Packages" pane.

enter image description here

Now, click on the edit button with the pencil icon that just became enabled. In the dialog that appears, click the green + button and add the external projects of interest.

enter image description here

Upvotes: 1

Related Questions