Hi all,
I am trying to load a specific version of PetitParser in a Moose image. A Moose image comes with the latest development version of PetitParser. So, I am trying to downgrade to an older version. So, when I load the version manually, older versions of the packages are loaded: (ConfigurationOfPetitParser project version: '1.51') load But when I try to load the same version within my ConfigOf the expected packages are not loaded and list of the PetitParser packages loaded remains unchanged. Here is how my baseline looks like: ConfigurationOfDummyParser>>baseline01: spec <version: '0.1-baseline'> spec for: #'common' do: [ spec blessing: #'baseline'. spec project: 'PetitParser' with: [ spec className: #ConfigurationOfPetitParser; versionString: '1.51'; repository: 'http://smalltalkhub.com/mc/Moose/PetitParser/main/' ]. ]. I also tried creating a version but it didn't help. ConfigurationOfDummyParser>>version10: spec <version: '1.0' imports: #('0.1-baseline' )> spec for: #'common' do: [ spec blessing: #'stable'. spec description: 'version 1.0'. spec author: 'usmanbhatti'. spec timestamp: '12/19/2014 16:35'. spec project: 'PetitParser' with: '1.51'. ]. I also had a look at the package the configuration tries to load and the list shows correct packages to be loaded (see screenshot). Does anyone have an idea what may be problematic in my code or that of Metacello? I am attaching the code of my ConfigOf for a Moose image. Thanks in advance. Usman ConfigurationOfDummyParser.st (7K) Download Attachment |
Usman,
With classic Metacello (using the `(ConfigurationOfxxx project version: 'xxx') load` pattern) you can only downgrade via an explicit load of a particular version of the project. When loading projects indirectly via a project reference from another project Metacello is biased towards upgrade. With the Metacello Scripting API[1], you may include an #onDowngradeUseIncoming: clause to selectively permit downgrades: Metacello new configuration: 'DummyParser'; version: '1.0'; repository: '???'; onDowngradeUseIncoming: #('PetitParser'); load. For additional downgrade options see[2]. Since you are interested in using a specific version of a project you may also be interested in locking the project[3][4]. With a `lock` Metacello will not upgrade or downgrade the project but always `honor` the lock unless an #onLock: clause is used ... Note that for `locking` to work, you must use the Metacello Scripting API to do all of your project loads ... Dale [1] https://github.com/dalehenrich/metacello-work/blob/master/docs/MetacelloUserGuide.md#metacello-user-guide [2] https://github.com/dalehenrich/metacello-work/blob/master/docs/MetacelloUserGuide.md#downgrade [3] https://github.com/dalehenrich/metacello-work/blob/master/docs/MetacelloUserGuide.md#locking [4] https://github.com/dalehenrich/metacello-work/blob/master/docs/LockCommandReference.md#lock-command-reference On 12/19/2014 07:44 AM, Usman Bhatti
wrote:
|
I will add that to the metacello chapter!
Le 19/12/14 19:00, Dale Henrichs a écrit : > With classic Metacello (using the `(ConfigurationOfxxx project > version: 'xxx') load` pattern) you can only downgrade via an explicit > load of a particular version of the project. When loading projects > indirectly via a project reference from another project Metacello is > biased towards upgrade. > > With the Metacello Scripting API[1], you may include an > #onDowngradeUseIncoming: clause to selectively permit downgrades: > > Metacello new > configuration: 'DummyParser'; > version: '1.0'; > repository: '???'; > onDowngradeUseIncoming: #('PetitParser'); > load. > > For additional downgrade options see[2]. > > Since you are interested in using a specific version of a project you > may also be interested in locking the project[3][4]. With a `lock` > Metacello will not upgrade or downgrade the project but always `honor` > the lock unless an #onLock: clause is used ... > > Note that for `locking` to work, you must use the Metacello Scripting > API to do all of your project loads ... > > Dale > > [1] > https://github.com/dalehenrich/metacello-work/blob/master/docs/MetacelloUserGuide.md#metacello-user-guide > [2] > https://github.com/dalehenrich/metacello-work/blob/master/docs/MetacelloUserGuide.md#downgrade > [3] > https://github.com/dalehenrich/metacello-work/blob/master/docs/MetacelloUserGuide.md#locking > [4] > https://github.com/dalehenrich/metacello-work/blob/master/docs/LockCommandReference.md#lock-command-reference |
In reply to this post by Dale Henrichs-3
Dale,
Thanks for your detailed explanations. Metacello class in my image does not seem to define the messages described in the documentation for handling downgrading and upgrading conflicts: I am using Pharo 3.0 with Moose. Did I miss something? regards, Usman On Fri, Dec 19, 2014 at 7:00 PM, Dale Henrichs <[hidden email]> wrote:
|
Usman,
It is likely that Pharo3.0 is not using the latest version of Metacello. You should be able to upgrade to the latest versions following the install instructions for Pharo3.0[1]. Dale [1] https://github.com/dalehenrich/metacello-work#pharo30 On 1/2/15 6:23 AM, Usman Bhatti wrote:
|
Dale, Steps I did: 1. Download moose image: 2. Update my Metacello to the 'full' version: Metacello new baseline: 'Metacello'; repository: 'github://dalehenrich/metacello-work:master/repository'; get. Metacello new baseline: 'Metacello'; repository: 'github://dalehenrich/metacello-work:master/repository'; onConflict: [:ex | ex allow]; load 3. File in the ConfigurationOfDummyParser (see the first message in the thread). 4. Run this script to downgrade to PetitParser version 1.51 Metacello new configuration: 'DummyParser';version: '1.0'; repository: '???'; onDowngradeUseIncoming: #('PetitParser'); load. The desired version is still not loaded, am I missing something here? regards, A question: I always use Metacello with ConfigOf and have never used the scripting API myself or saw it being used elsewhere. Can you provide a link that describes the use cases for both: ConfigOf vs. Scripting API? On Fri, Jan 2, 2015 at 6:47 PM, Dale Henrichs <[hidden email]> wrote:
|
On 1/6/15 7:16 AM, Usman Bhatti wrote:
Good question, I don't have a lot of time today to spend time trying to reproduce your problem, but if you send me a copy of the Transcript produced while doing the load I might be able to spot the problem ... I've noticed the same thing:) My "elevator pitch" for the script api goes like this: 1. The scripting api maintains a registry of the actual project versions loaded into the image, making #currentVersion obsolete. #currentVersion is bad because it does a calculation of the current version that can be very slow and sometimes completely incorrect. 2. The old api has rules that it follows when loading projects (i.e., newer projects always win) and there is no mechanism for altering those rules. The scripting api provides mechanisms for for bending those rules to fit your needs ... like allowing a downgrade of a project. Part of the reason that people haven't changed has to do with how incredibly difficult it is to change the existing inertia. Another part of it is that I continue to support the old way of doing things, so there is no explicit motivation to change. If you look back 2-3 years in the archives of the Metacello mailing list[1] you should be able to find a number of posts where I make a more detailed cases for the scripting api:) At the end of the day, it isn't important to me to "get people to use the scripting api," as I said, I continue to support using the old api. I figure that when enough people start asking questions about how to "bend the Metacello rules" that folks will begin to use the "new" scripting api:) Dale [1] https://groups.google.com/forum/#!forum/metacello |
On Tue, Jan 6, 2015 at 6:56 PM, Dale Henrichs <[hidden email]> wrote:
It looks to me that the downgrade command is not working. Whenever I point to the version preceding the one loaded, the packages are not fetched. I am attaching here two files. The first (Transcript-PP151) is the output of the transcript as you asked. You can see that PetitParser packages as defined by the version 1.51 are not fetched. All that is loaded is Glamour because the version 1.51 of PetitParser loads the latest packages of Glamour. The load works because it is an upgrade from the current version of Glamour which is a stable. When I saw that only Glamour packages are loaded, I thought of testing Glamour downgrade too to see if the problem is specific to PetitParser. You can see the result in the second file (Transcript-downgrade-glamour). No packages of Glamour are fetched because the configuration tries to downgrade it (stable is more recent than 3.0.0 which I try to load). In my opinion, downgrade is not working as required. If you want I can share my image thru dropbox so that you can have a look to see what might be wrong.
So, what I learn is that I am trying to bend the rules of Metacello which is a rare use case :). I am thinking of avoiding this downgrading altogether by forking to create my own ConfigOf that loads the correct versions. Downgrading might be an anti-pattern. Thank you for your patient so far :) regards. Transcript-PP151.txt (4K) Download Attachment Transcript-downgrade-glamour.txt (730 bytes) Download Attachment |
Usman,
No, I appreciate your patience:) If creating your own configuration works for you then that is a good route to go... Sharing your image will make it much easier for me to get the bottom of this (on my own schedule:), so please send me a link for accessing your image and I'll dig into this in more detail when I have time ... If you find yourself stuck and needing the `downgrade directive` again, I'll bump up the priority ... Dale On 01/07/2015 09:19 AM, Usman Bhatti
wrote:
|
On Wed, Jan 7, 2015 at 8:25 PM, Dale Henrichs <[hidden email]> wrote:
Here is the image. You just need to execute the script in the workspace/playground to reproduce the problem (i.e. launching the directive to load PP 1.51 and that not happening).
I can still wait till next week. If you could have a look by then, it'll be great. tx. Usman
|
Usman,
Thanks for supplying the image ... with that I could diagnose the problem. In the final analysis, the onDowngrade: feature just does not work[1]. I haven't had a `downgrade` use case in my own work flow, so I did not notice that it wasn't working and the test cases that I do have are obviously faulty. Along the way, I discovered that in the Moose image, there is a custom MetacelloPlatform class installed (GTMetacelloPlatform) that is not compatible with the Scripting API. With that class installed, the scripting API will not work. I was able to install the proper platform class myself, but it requires manual intervention ... Also, it turns out the PetitParser 1.10 is the version that is installed and your new version 1.51 is not technically a downgrade ... I think that the version needs to be named 1.5.1 to be a downgrade ... I changed that as well and that's when I was able determine that onDowngrade: wasn't functioning correctly. Basically, the code said "go ahead and downgrade" but when it came time to actually load the packages, Metacello went ahead with it's standard algorithm of only loading newer versions of each package. I plan to take a crack at fixing this bug this weekend ... and will let you when I have a fix. Dale [1] https://github.com/dalehenrich/metacello-work/issues/317 On 1/8/15 12:32 AM, Usman Bhatti wrote:
|
In reply to this post by Usman Bhatti
Usman,
Well I don't have an official bugfix yet, but if you filein the attached method and run the following, PetitParser will downgrade and get loaded correctly (at least it worked for me)...The fist two statements are intended to replace GTMetacelloPlatform with MetacelloPharo30Platform and initialize the registry correctly ... not sure what impact on Moose these changes will have) : MetacelloPharo30Platform initialize. [ MetacelloProjectRegistration resetRegistry; primeRegistryFromImage ] on: Warning do: [ :ex | Transcript cr; show: 'Warning resumed: ' , ex description. ex resume ]. Metacello new configuration: 'DummyParser'; version: '1.0'; repository: '???'; onDowngrade: [:ex :existing :new | existing projectName = 'PetitParser' ifTrue: [ new projectSpec operator: #=. ex allow ] ifFalse: [ ex disallow ] ] ; load. The new method will be part of the next Metacello release and has been tested[1], but I may take a slightly different approach with the official bugfix. Setting the operator achieves the desired result, but is not quite how I would like to address the issue. HTH, Dale [1] https://travis-ci.org/dalehenrich/metacello-work/builds/46640819 On 1/8/15 12:32 AM, Usman Bhatti wrote:
MetacelloProjectSpecForLoad-performCurrentVersionTestAgainstoperatortargetVersionStatususing.st (2K) Download Attachment |
In reply to this post by Dale Henrichs-3
On Sat, Jan 10, 2015 at 5:22 PM, Dale Henrichs <[hidden email]> wrote:
I do not know the use case for GTMetacelloPlatform.
Yes, this is something I remarked as well. Thanks for working on this problem. regards,
|
In reply to this post by Dale Henrichs-3
On Sun, Jan 11, 2015 at 7:14 PM, Dale Henrichs <[hidden email]> wrote:
I tried this script as you told but it didn't load the specific version I was expecting. I had this message printed on Transcript: Warning resumed: Warning: Error finding current version of ConfigurationOfMoose. Probably an invalid specification. Warning resumed: Warning: Error finding current version of ConfigurationOfSmallDude. Probably an invalid specification. Loading 1.0 of ConfigurationOfDummyParser... Project: PetitParser 1.51 ...finished 1.0 I can wait until you do an official release for this bug fix. In the meantime, I've created a configOf my own which means I can find alternate solutions to replace downgrade. I felt that downgrade is yet a must because one would not like to upgrade all the time. And one would not like to load packages by hand when configOf is complex. My configOf works currently but with downgrade available it'll be much more cleaner. regards, Usman
|
On 1/12/15 1:43 AM, Usman Bhatti wrote:
Ah ... sorry ... I had made one other change and forgot to mention that:( I did rename the version to 1.5.1 both in petitparser and dummy ... Ah well, you are functional and you have certainly helped me, so I appreciate your help ... My first cut at a fix solves the downgrade but introduces other issues, so I still working things out:) Thanks again! Dale |
On Mon, Jan 12, 2015 at 5:14 PM, Dale Henrichs <[hidden email]> wrote:
I can only help with testing because I do not quite understand the internals of Metacello yet to contribute something significant. Please keep us updated about your progress, I am still interested in using downgrade feature.
|
Free forum by Nabble | Edit this page |