Hi Dale,
Thanks. We are getting close.
Your first script also returns the Configuration packages which are defined by project references. How do I now get those ones?
Cheers, Doru
On 29 Apr 2011, at 23:27, Dale Henrichs wrote:
Hey Doru,
So what you are looking for is the list of packages that would be loaded if the following expression were loaded into an "empty" image:
(ConfigurationOfFuelMooseExtension new project version: '1.1') load.
Then you will want to do something like the following. My example is for Metacello:
| version directive pkgs | version := ConfigurationOfMetacello new project version: #stable. version ignoreImage: true. directive := version record loadDirective. pkgs := OrderedCollection new. directive versionDirectivesDo: [:vrsnDirective | | spec | spec := vrsnDirective spec. (spec notNil and: [ spec project configuration class name == #ConfigurationOfMetacello]) ifTrue: [ vrsnDirective packagesDo: [:pkgDirective | pkgs add: pkgDirective file ]]]. pkgs
The above assumes that you want only the packages loaded by ConfigurationOfMetacello ... If you want all of the packages that would be loaded the following will do the trick:
| version directive pkgs | version := ConfigurationOfMetacello new project version: #stable. version ignoreImage: true. directive := version record loadDirective. pkgs := OrderedCollection new. directive packageDirectivesDo: [:pkgDirective | pkgs add: pkgDirective file ]. pkgs
Take a look at MetacelloPackageLoadDirective to see the other inforamtion that's availalble.
Use the #record and #record: messages just like the #load and #load: messages.
Dale
On 04/29/2011 01:13 PM, Tudor Girba wrote:
Hi Dale,
On 29 Apr 2011, at 21:47, Dale Henrichs wrote:
Okay,
What is it about FuelMooseExtensionBenchmarks that makes you think that it shoulldn't be returned by the expression?
You have a package named FuelMooseExtensionBenchmarks defined in version 1.1, so the #packages method returns the three packages defined in version 1.1...
Is it the fact that the package isn't loaded in the image that makes it unique or is the fact that it is not defined in the baseline that makes it unique? ... As far as you are concerned...
I am looking for the incantation that would return only the two packages that actually get loaded. The scenario is like this:
- I load the code with a configuration
- I want to use a script that takes the same configuration as input to find which packages were loaded so that I can analyze them
Cheers, Doru
Dale
On 04/29/2011 12:02 PM, Tudor Girba wrote:
Hi,
Sorry for not being clear.
I am doing this: ((ConfigurationOfFuelMooseExtension new project version: '1.1') spec packages select: [:each | each isKindOf: MetacelloPackageSpec ]) collect: [:each | each name] ==> an OrderedCollection('FuelMooseExtensionBenchmarks' 'FuelFameExtension' 'FuelMooseExtension')
I would like to get the invocation that would give me the list of packages without FuelMooseExtensionBenchmarks.
Cheers, Doru
On 29 Apr 2011, at 20:45, Dale Henrichs wrote:
Doru,
Just to clarify, are you looking for the list of packages that are already loaded in the image or do you mean something else?
Some sample code and expected values might help?
Dale
On 04/29/2011 11:44 AM, Tudor Girba wrote:
Hi,
Indeed, the issue is that I do not know how to get only the packages that would load. I need this to be able to do static analysis (e.g., import in Moose) of all packages from a version.
Cheers, Doru
On 29 Apr 2011, at 20:38, Dale Henrichs wrote:
> Doru, > > When you "query version 1.1 for packages", you get the extra package, because it is *part of the project*, just not loaded. > > But when you "query version 1.1 for packages" you'd like only the loaded packages? > > Is that the issue? > > Dale > On 04/29/2011 11:17 AM, Tudor Girba wrote: >> Hi, >> >> ConfigurationOfFuelMooseExtensions has the following baseline and >> version definitions and I am not sure whether they are correct. The >> problem is that the baseline defines a package only in a group, and then >> the version defines the version for it. >> >> Loading seems to load just fine. If I simply load the version, it loads >> the two packages defined in the Core group as expected. However, my >> problem is that when I query version 1.1 for packages, it retrieves the >> extra *FuelMooseExtensionBenchmarks *package. >> >> Could someone look into this? >> >> >> baseline11: spec >> <version: '1.1-baseline'> >> >> spec for: #common do: [ >> spec blessing: #baseline. >> spec repository: 'http://www.squeaksource.com/Fuel'. >> spec >> package: 'FuelFameExtension' with: [ spec requires: 'Fuel' ]; >> package: 'FuelMooseExtension' with: [ spec requires: 'FuelFameExtension' ]. >> spec >> group: 'default' with: #('Core'); >> group: 'Core' with: #('FuelFameExtension' 'FuelMooseExtension'); >> group: 'Tests' with: #('FuelFameExtension' 'FuelMooseExtension'); >> *group: 'Benchmarks' with: #('FuelFameExtension' 'FuelMooseExtension' >> 'FuelMooseExtensionBenchmarks'*). >> spec >> project: 'Fuel' with: [ >> spec >> className: 'ConfigurationOfFuel'; >> loads: #('CoreWithProgressBar' ); >> file: 'ConfigurationOfFuel'; >> repository: 'http://www.squeaksource.com/Fuel' ] ]. >> >> version11: spec >> <version: '1.1' imports: #('1.1-baseline')> >> >> spec for: #common do: [ >> spec blessing: #release. >> spec >> project: 'Fuel' with: '1.1'; >> package: 'FuelFameExtension' with: 'FuelFameExtension-MartinDias.28'; >> package: 'FuelMooseExtension' with: 'FuelMooseExtension-MartinDias.8'; >> *package: 'FuelMooseExtensionBenchmarks' with: >> 'FuelMooseExtensionBenchmarks-MartinDias.2'].* >> >> >> Cheers, >> Doru >> >> >> -- >> www.tudorgirba.comhttp://www.tudorgirba.com >> >> "Some battles are better lost than fought." >> >> >> >
-- www.tudorgirba.com
"In a world where everything is moving ever faster, one might have better chances to win by moving slower."
-- www.tudorgirba.com
"Being happy is a matter of choice."
-- www.tudorgirba.com
"Live like you mean it."
-- www.tudorgirba.com
"Reasonable is what we are accustomed with."