An interesting example of on of the bugs fixed with 1.0-beta.23 as well as some of the new features of the currentVersion algorithm.
If you take a Pharo1.0-10508-rc2dev10.01.2 and update to 1.0-beta.23 (loadLatestVersion) and then do: ConfigurationOfMetacello project currentVersion You'll get back >=1.0-beta.21 which appears to be wrong. During the update the following packages are loaded: Loaded -> Gofer-Core-lr.116 Preparing to Load -> Metacello-Core-DaleHenrichs.348 Preparing to Load -> Metacello-MC-DaleHenrichs.332 Preparing to Load -> Metacello-Platform.pharo-DaleHenrichs.13 Bug number 1 is that Gofer had already been loaded into the image (which started at 1.0-beta.21) with the following package versions installed: Gofer-Core-lr.115 Gofer-Tests-AdrianLienhard.115 ConfigurationOfGofer was introduced with version 1.0-beta.22 and version 1.0 (the only version) calls for Gofer-Core-lr.116 Gofer-Tests-lr.115 During the load, you not that Gofer-Core-lr.116 was loaded, but Gofer-Tests-lr.115 was not loaded and this is not correct ... with 1.0-beta.23, Metacello notices that Gofer-Tests is already loaded and loads versions of the already loaded packages along with the 'required' packages. In fact if you reload 1.0-beta.23 (using the new code), Gofer-Tests-lr.115 will be loaded. 1.0-beta.21 appears to be the current version, because Gofer-Tests-AdrianLienhard.115 sorts earlier than the packages listed in ConfigurationOfGofer, so ConfigurationOfGofer "isn't loaded". The currentVersion of ConfigurationOfGover prints as '<>1.0': ConfigurationOfGofer project currentVersion versionStatus answers #somethingLoaded, which means exactly what is says: one or more packages are loaded for the configuration, but none of the specified versions match. Because no version matches in ConfigurationOfGofer, both of the Metacello versions that use ConfigurationOfGofer don't have valid versions either. which brings us to 1.0-beta.21: Gofer-Tests-AdrianLienhard.115 is listed in the spec and all of the other Metacello packages are >= the versions specified in 1.0-beta.21, so it looks like the current version: ConfigurationOfMetacello project currentVersion versionStatus answers #loadedMatchConstraints, which means that all of the loaded packages and projects versions are #>= the packages and projects specified in 1.0-beta.21 and there are no later versions that "match". Once you reload 1.0-beta.23 (loading Gofer-Tests-lr.115), the currentVersion of Metacello is ~1.0-beta.23 and: ConfigurationOfMetacello project currentVersion versionStatus answers #loadedToSpec, which means that the all of the loaded packages and project versions match exactly the packages and projects specified in 1.0-beta.23. If you load all of the Metacello packages, the currentVersion versionStatus answers #allLoadedToSpec, which means that all of the packages and projects are loaded and they match the packages and projects specified in 1.0-beta.23. You can tell the versionStatus by looking at the version printString: leading '<>' -> versionStatus == #somethingLoaded leading '>=' -> versionStatus == #loadedMatchConstraints leading '~' -> versionStatus == #loadedToSpec no leading '' -> versionStatus == #allLoadedToSpec I'm on the fence as to #somethingLoaded. On the one hand it interesting to know that a package or two are loaded by looking at the version number, but on the other hand it can be a little misleading if you don't know the code ... So it just might be better to answer that there is no currentVersion when #somethingLoaded is the status ... internally #somethingLoaded is basically treated as nothing loaded... Dale |
Free forum by Nabble | Edit this page |