Hi,
I'm trying to save an image under a different name. I have a image I'm working with (e.g. VNC enabled) and I like to create a derived image under a different name. I use MySetup>>deploy RFBServer doStopServer. SmalltalkImage current closeSourceFiles. SmalltalkImage current saveChangesInFileNamed: 'base-deploy.changes'. SmalltalkImage current saveImageInFileNamed: 'base-deploy.image'. SmalltalkImage current snapshot: false andQuit: true I can still use my working image but if I try to start the base-deploy.image it quits immediately. I tried different settings but the result is similar. Every time I save and quit the image from a method or a doit I get this result. But if I just use SmalltalkImage current snapshot: true andQuit: true in the workspace everything is fine. Norbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Norbert,
I hope the following code will make clear this "strange" behaviour. | i delay | i := 0. delay := Delay forMilliseconds: 1000. Transcript clear. 10 timesRepeat: [Transcript cr; show: (i := i + 1). delay wait]. SmalltalkImage current snapshot: true andQuit: true. 10 timesRepeat: [Transcript cr; show: (i := i + 1). delay wait]. you see this "strange" behaviour because all threads are suspending when you are closing your image and resuming when you're opening it again. When you're opening your "deploy" image the last line of code in MySetup>>deploy method is executing and image is closing again. I hope it'll help you. George. > Hi, > > I'm trying to save an image under a different name. I > have a image I'm working with (e.g. VNC enabled) and I > like to create a derived image under a different name. > > I use > > MySetup>>deploy > RFBServer doStopServer. > SmalltalkImage current closeSourceFiles. > SmalltalkImage current saveChangesInFileNamed: 'base-deploy.changes'. > SmalltalkImage current saveImageInFileNamed: 'base-deploy.image'. > SmalltalkImage current snapshot: false andQuit: true > > I can still use my working image but if I try to start > the base-deploy.image it quits immediately. I tried > different settings but the result is similar. Every time > I save and quit the image from a method or a doit I > get this result. But if I just use > > SmalltalkImage current snapshot: true andQuit: true > > in the workspace everything is fine. > > Norbert > > > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners > > > _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Fri, 2007-04-27 at 00:40 +0400, George Herolyants wrote:
> Hi Norbert, > I hope the following code will make clear this "strange" behaviour. > > | i delay | > i := 0. > delay := Delay forMilliseconds: 1000. > Transcript clear. > 10 timesRepeat: [Transcript cr; show: (i := i + 1). delay wait]. > SmalltalkImage current snapshot: true andQuit: true. > 10 timesRepeat: [Transcript cr; show: (i := i + 1). delay wait]. > > you see this "strange" behaviour because all threads are suspending when > you are closing your image and resuming when you're opening it again. > When you're opening your "deploy" image the last line of code in > MySetup>>deploy method is executing and image is closing again. > > I hope it'll help you. > it :) so it is very clear what is happening. But I'm wondering if my approach is the right one. I like to switch the image to a new name, tweak some things and save it without the original image being changed. Is there a better way to it? thanks, Norbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by NorbertHartl
Norbert Hartl wrote:
> Hi, > > I'm trying to save an image under a different name. I > have a image I'm working with (e.g. VNC enabled) and I > like to create a derived image under a different name. > > I use > > MySetup>>deploy > RFBServer doStopServer. > SmalltalkImage current closeSourceFiles. > SmalltalkImage current saveChangesInFileNamed: 'base-deploy.changes'. > SmalltalkImage current saveImageInFileNamed: 'base-deploy.image'. > SmalltalkImage current snapshot: false andQuit: true > > This is going to sound stupid but my solution to this is to save twice. I do exactly what you describe in several of my image building scripts. Basically the sequence: MCFileBasedRepository flushAllCaches. RFBServer stop. SmalltalkImage current saveAs: 'something' SmalltalkImage current snapshot: true andQuit: true The reason that I do this is that snapshot:andQuit: has logic to make sure that when an image is restarted it doesn't quit. You could probably duplicate that logic but I found this solution to be more expedient. I'm eager to hear a better way :-) :-) David _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Mon, 2007-04-30 at 15:17 -0400, David Shaffer wrote:
> Norbert Hartl wrote: > > Hi, > > > > I'm trying to save an image under a different name. I > > have a image I'm working with (e.g. VNC enabled) and I > > like to create a derived image under a different name. > > > > I use > > > > MySetup>>deploy > > RFBServer doStopServer. > > SmalltalkImage current closeSourceFiles. > > SmalltalkImage current saveChangesInFileNamed: 'base-deploy.changes'. > > SmalltalkImage current saveImageInFileNamed: 'base-deploy.image'. > > SmalltalkImage current snapshot: false andQuit: true > > > > > Norbert, > > This is going to sound stupid but my solution to this is to save twice. > I do exactly what you describe in several of my image building scripts. > Basically the sequence: > > MCFileBasedRepository flushAllCaches. > RFBServer stop. > SmalltalkImage current saveAs: 'something' > SmalltalkImage current snapshot: true andQuit: true > you using? > The reason that I do this is that snapshot:andQuit: has logic to make > sure that when an image is restarted it doesn't quit. You could > probably duplicate that logic but I found this solution to be more > expedient. I'm eager to hear a better way :-) :-) Yes, me too. And an idea to automatically upgrade the image to the last version found in Monticello ;) Norbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Norbert Hartl wrote:
> >> > I only have a saveAs selector but no saveAs: What squeak version are > you using? > Oops. I thought it was standard but it was one of my extensions (modeled off similar code in SmalltalkImage): SmalltalkImage>>saveAs: newName "Save the image under the specified new name." (SourceFiles at: 2) ifNotNil: [self closeSourceFiles; "so copying the changes file will always work" saveChangesInFileNamed: (self fullNameForChangesNamed: newName)]. self saveImageInFileNamed: (self fullNameForImageNamed: newName) > > Yes, me too. And an idea to automatically upgrade the image to the last > version found in Monticello ;) > > I hacked something together based on the code in the Monticello base mostly from MCFileRepositoryInspector>>refresh. It wasn't too pretty. I've asked for permission to post it from my employer...the more eyes on it the better. David _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Mon, 2007-04-30 at 20:06 -0400, David Shaffer wrote:
> Norbert Hartl wrote: > > > >> > > I only have a saveAs selector but no saveAs: What squeak version are > > you using? > > > > Oops. I thought it was standard but it was one of my extensions > (modeled off similar code in SmalltalkImage): > > SmalltalkImage>>saveAs: newName > "Save the image under the specified new name." > > (SourceFiles at: 2) ifNotNil: > [self closeSourceFiles; "so copying the changes file will always > work" > saveChangesInFileNamed: (self fullNameForChangesNamed: > newName)]. > self saveImageInFileNamed: (self fullNameForImageNamed: newName) Do you use the name of the image you run as an argument to saveAs: ? Using this approach does only work for me if the names are equal. Otherwise running image A with the script and using saveAs: 'B' gives a working image B and an image A which quits immediately after start. I thought the saveAs would change the images name. So I don't know how image A can be affected by this script. > > > > Yes, me too. And an idea to automatically upgrade the image to the last > > version found in Monticello ;) > > > > > I hacked something together based on the code in the Monticello base > mostly from MCFileRepositoryInspector>>refresh. It wasn't too pretty. > I've asked for permission to post it from my employer...the more eyes on > it the better. > path := [MC repository] repo := (MCDirectoryRepository new directory: (FileDirectory on: path) ). (repo loadVersionFromFileNamed: ( repo allFileNames first) ) load. Works ok for me. Additionally I tried to do a poor window closer: #( SystemWindow PluggableSystemWindow FlapTab PartsBin ) do: [:class| (Smalltalk classNamed: class) allInstances do: [:each| each delete]]. Here I don't know how I can force a close of a window which has unsaved changes. And I don't know how to switch of flaps permanently. But I'm lucky. I can copy my image to something like deploy.image and do squeak deploy deploy.st to customize the image like I want it. Norbert _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |