Search code examples
version-controlsmalltalkpharomonticello

How to query all Monticello packages from a Metacello Configuration?


I have a Metacello configuration like ConfigurationOfAthens and I want to know which packages provides, the result would be :

  • Athens-Cairo
  • Athens-CairoPools
  • Athens-Core
  • etc.

I tried

(GoferConfigurationReference name: 'ConfigurationOfAthens') packages.

but it is not understood by the system.

It this supported in Pharo 4?


Solution

  • If you want just the package names you could use helper classes to query from a Configuration. And so your query would be

    (MTProject 
        newFromVersion: (ConfigurationOfAthens project version: #development)
        inConfiguration: ConfigurationOfAthens) dependenciesFilteredBy: MTPackage.
    

    These MT classes - which sounds like they should belong to Metacello - are not in Metacello package, but currently in Versionner (included by default in Pharo images).

    Diving into results reveals that some "MTPackages" has not their corresponding "RPackage" (this could be a bug, or some weird feature in the package representation models). So you would need further filtering:

    ((MTProject 
        newFromVersion: (ConfigurationOfAthens project version: #development)
        inConfiguration: ConfigurationOfAthens) dependenciesFilteredBy: MTPackage)
            select: [ :pkgName | 
                (RPackageOrganizer default 
                    packageNamed: pkgName name asSymbol
                    ifAbsent: []) notNil  ]