[Squeak 4.0] Anyone know much about the format of the sources/changes files?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

[Squeak 4.0] Anyone know much about the format of the sources/changes files?

Casey Ransberger
Good people of Squeak,

We need to have a license statement at the top of our sources file for
the 4.0 release. I've been futsing with it without success.

I've tried:

'foo'!
'foo'!!
!'foo'!

And a variety of varied nasty things happened when (to test) doing:



--
Ron

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Casey Ransberger
Left the snippet out that I've been using to test:

Smalltalk allClassesAndTraits do:[:cls| cls compileAll].

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Randal L. Schwartz
In reply to this post by Casey Ransberger
>>>>> "Ronald" == Ronald Spengler <[hidden email]> writes:

Ronald> Good people of Squeak,
Ronald> We need to have a license statement at the top of our sources file for
Ronald> the 4.0 release. I've been futsing with it without success.

Ronald> I've tried:

Ronald> 'foo'!
Ronald> 'foo'!!
Ronald> !'foo'!

(I think) The sources file is always accessed according to byte offsets.  Look
at the code for #condenseSources, and make sure the first thing it does is
write the license before rewriting everything else.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Bert Freudenberg
On 25.02.2010, at 02:38, Randal L. Schwartz wrote:

>
>>>>>> "Ronald" == Ronald Spengler <[hidden email]> writes:
>
> Ronald> Good people of Squeak,
> Ronald> We need to have a license statement at the top of our sources file for
> Ronald> the 4.0 release. I've been futsing with it without success.
>
> Ronald> I've tried:
>
> Ronald> 'foo'!
> Ronald> 'foo'!!
> Ronald> !'foo'!
>
> (I think) The sources file is always accessed according to byte offsets.  Look
> at the code for #condenseSources, and make sure the first thing it does is
> write the license before rewriting everything else.

Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

laza
Btw, is there something speaking against #condenseSources asking for
the destination of the new sources file? At least on unix like systems
the assumption, that the sources file encompass the vm file in the
same directory (e.g. /usr/bin) is most likely wrong.

Alex

On Thu, Feb 25, 2010 at 09:16, Bert Freudenberg <[hidden email]> wrote:

> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>>
>>>>>>> "Ronald" == Ronald Spengler <[hidden email]> writes:
>>
>> Ronald> Good people of Squeak,
>> Ronald> We need to have a license statement at the top of our sources file for
>> Ronald> the 4.0 release. I've been futsing with it without success.
>>
>> Ronald> I've tried:
>>
>> Ronald> 'foo'!
>> Ronald> 'foo'!!
>> Ronald> !'foo'!
>>
>> (I think) The sources file is always accessed according to byte offsets.  Look
>> at the code for #condenseSources, and make sure the first thing it does is
>> write the license before rewriting everything else.
>
> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>
> - Bert -
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Enrico Schwass-2
Alexander Lazarević <[hidden email]> writes:

> Btw, is there something speaking against #condenseSources asking for
> the destination of the new sources file? At least on unix like systems
> the assumption, that the sources file encompass the vm file in the
> same directory (e.g. /usr/bin) is most likely wrong.

+1

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Bert Freudenberg
On 25.02.2010, at 10:42, Enrico Schwass wrote:
>
> Alexander Lazarević <[hidden email]> writes:
>
>> Btw, is there something speaking against #condenseSources asking for
>> the destination of the new sources file? At least on unix like systems
>> the assumption, that the sources file encompass the vm file in the
>> same directory (e.g. /usr/bin) is most likely wrong.
>
> +1

Or simply create it in FileDirectory default.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Git repositories and sources/changes files (was Re: [squeak-dev] [Squeak 4.0] Anyone know much about the format of the sources/changes files?)

Tony Garnock-Jones-2
In reply to this post by Bert Freudenberg
Bert Freudenberg wrote:
> Randal is right. You can not just add something at the beginning of
> the sources or changes file. These are *NOT* text files but
> databases, the offsets are held in the image (each method knows the
> file position of its source code).

So, just as an aside, over an idle couple of days this week I
implemented the Git repository format in Smalltalk. (This is why I was
asking about the SystemChangeNotifier earlier.)

http://www.squeaksource.com/Git.html

So far, it can

 - initialize repositories
 - read and write loose objects (blobs, trees, commits, tags)
 - read packed objects (but not write them, yet)
 - resolve and update refs (tags and branch heads)

I remember hearing something about a bit of good refactoring recently
that permitted *switching out the sources implementation* for an image.
Perhaps it could be backed onto a Git repository using this code.
Methods would then know the sha1 of the blob that holds the source.

#condenseSources feels very much like "git pack-objects" or "git gc".

I haven't done the network protocol yet (in large part because I can't
yet build (good) packs) so shelling out to "git fetch" and "git push" is
still needed for that.

Regards,
  Tony

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

laza
In reply to this post by Bert Freudenberg
And is

        self setMacFileInfoOn: SmalltalkImage current changesName.
        self setMacFileInfoOn: SmalltalkImage current sourcesName.

still necessary??

Alex

On Thu, Feb 25, 2010 at 10:49, Bert Freudenberg <[hidden email]> wrote:

> On 25.02.2010, at 10:42, Enrico Schwass wrote:
>>
>> Alexander Lazarević <[hidden email]> writes:
>>
>>> Btw, is there something speaking against #condenseSources asking for
>>> the destination of the new sources file? At least on unix like systems
>>> the assumption, that the sources file encompass the vm file in the
>>> same directory (e.g. /usr/bin) is most likely wrong.
>>
>> +1
>
> Or simply create it in FileDirectory default.
>
> - Bert -
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Git repositories and sources/changes files (was Re: [squeak-dev] [Squeak 4.0] Anyone know much about the format of the sources/changes files?)

Bert Freudenberg
In reply to this post by Tony Garnock-Jones-2
On 25.02.2010, at 11:08, Tony Garnock-Jones wrote:

>
> Bert Freudenberg wrote:
>> Randal is right. You can not just add something at the beginning of
>> the sources or changes file. These are *NOT* text files but
>> databases, the offsets are held in the image (each method knows the
>> file position of its source code).
>
> So, just as an aside, over an idle couple of days this week I
> implemented the Git repository format in Smalltalk. (This is why I was
> asking about the SystemChangeNotifier earlier.)
>
> http://www.squeaksource.com/Git.html
>
> So far, it can
>
> - initialize repositories
> - read and write loose objects (blobs, trees, commits, tags)
> - read packed objects (but not write them, yet)
> - resolve and update refs (tags and branch heads)

Awesome!

> I remember hearing something about a bit of good refactoring recently
> that permitted *switching out the sources implementation* for an image.
> Perhaps it could be backed onto a Git repository using this code.
> Methods would then know the sha1 of the blob that holds the source.

That might work indeed.

However, the method source pointer is not only used for accessing the current code, but previous versions of the method too. So you would need some more info than just the blob.

> #condenseSources feels very much like "git pack-objects" or "git gc".

Not quite, #condenseSources is destructive. It's rather more like pruning history - it deletes all previous versions. With something like git we might never have to do that again. Yay!

> I haven't done the network protocol yet (in large part because I can't
> yet build (good) packs) so shelling out to "git fetch" and "git push" is
> still needed for that.

Do you have ideas yet for how to map the Smalltalk structure to file names? Possibly you could reuse the mapping from SqueakSVN
http://www.hpi.uni-potsdam.de/hirschfeld/projects/squeaksvn/

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Casey Ransberger
In reply to this post by Bert Freudenberg
I have a change in place for condenseSources   My question was really
about how to put the license at the top in a way that can be written.

I want to be sure though, is there a particular method which should be
called within condenseSources to add comment text to the top?

My (perhaps naive) implementation is doing something like:

f nextPutall: license

On Thursday, February 25, 2010, Bert Freudenberg <[hidden email]> wrote:

> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>>
>>>>>>> "Ronald" == Ronald Spengler <[hidden email]> writes:
>>
>> Ronald> Good people of Squeak,
>> Ronald> We need to have a license statement at the top of our sources file for
>> Ronald> the 4.0 release. I've been futsing with it without success.
>>
>> Ronald> I've tried:
>>
>> Ronald> 'foo'!
>> Ronald> 'foo'!!
>> Ronald> !'foo'!
>>
>> (I think) The sources file is always accessed according to byte offsets.  Look
>> at the code for #condenseSources, and make sure the first thing it does is
>> write the license before rewriting everything else.
>
> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>
> - Bert -
>
>
>
>

--
Ron

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Levente Uzonyi-2
On Thu, 25 Feb 2010, Ronald Spengler wrote:

> I have a change in place for condenseSources   My question was really
> about how to put the license at the top in a way that can be written.
>
> I want to be sure though, is there a particular method which should be
> called within condenseSources to add comment text to the top?
>
> My (perhaps naive) implementation is doing something like:
>
> f nextPutall: license

AFAIK the sources and the changes file are both a series of chunks, so
#nextChunkPut: is the method you're looking for.


Levente

>
> On Thursday, February 25, 2010, Bert Freudenberg <[hidden email]> wrote:
>> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>>>
>>>>>>>> "Ronald" == Ronald Spengler <[hidden email]> writes:
>>>
>>> Ronald> Good people of Squeak,
>>> Ronald> We need to have a license statement at the top of our sources file for
>>> Ronald> the 4.0 release. I've been futsing with it without success.
>>>
>>> Ronald> I've tried:
>>>
>>> Ronald> 'foo'!
>>> Ronald> 'foo'!!
>>> Ronald> !'foo'!
>>>
>>> (I think) The sources file is always accessed according to byte offsets.  Look
>>> at the code for #condenseSources, and make sure the first thing it does is
>>> write the license before rewriting everything else.
>>
>> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>>
>> - Bert -
>>
>>
>>
>>
>
> --
> Ron
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Andreas.Raab
In reply to this post by Casey Ransberger
I did a quick test, and I think this should work:

        license := 'Put your license text here'.
        stream nextChunkPut: license storeString.
        ".... Continue with condense changes ...."

What it does is storing the license as a string literal (#storeString)
so that the sources file will begin with the license as string and
consequently the license can be read back in and parsed via:

        license := Compiler evaluate: ((Smalltalk sourcesFile) position: 0;
nextChunk).

If you didn't use storeString you might have problems with utilities
that try to parse the sources file, i.e., ChangeList and friends.

Cheers,
   - Andreas

Ronald Spengler wrote:

> I have a change in place for condenseSources   My question was really
> about how to put the license at the top in a way that can be written.
>
> I want to be sure though, is there a particular method which should be
> called within condenseSources to add comment text to the top?
>
> My (perhaps naive) implementation is doing something like:
>
> f nextPutall: license
>
> On Thursday, February 25, 2010, Bert Freudenberg <[hidden email]> wrote:
>> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>>>>>>>> "Ronald" == Ronald Spengler <[hidden email]> writes:
>>> Ronald> Good people of Squeak,
>>> Ronald> We need to have a license statement at the top of our sources file for
>>> Ronald> the 4.0 release. I've been futsing with it without success.
>>>
>>> Ronald> I've tried:
>>>
>>> Ronald> 'foo'!
>>> Ronald> 'foo'!!
>>> Ronald> !'foo'!
>>>
>>> (I think) The sources file is always accessed according to byte offsets.  Look
>>> at the code for #condenseSources, and make sure the first thing it does is
>>> write the license before rewriting everything else.
>> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>>
>> - Bert -
>>
>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

johnmci
In reply to this post by laza
yes, otherwise they get tagged with meta-data as being text files to be opened with bbedit.
versus iconized with squeak change and source icons and clicking them would open your
primary Squeak VM.

On 2010-02-25, at 2:54 AM, Alexander Lazarević wrote:

> And is
>
> self setMacFileInfoOn: SmalltalkImage current changesName.
> self setMacFileInfoOn: SmalltalkImage current sourcesName.
>
> still necessary??
>
> Alex
>
> On Thu, Feb 25, 2010 at 10:49, Bert Freudenberg <[hidden email]> wrote:
>> On 25.02.2010, at 10:42, Enrico Schwass wrote:
>>>
>>> Alexander Lazarević <[hidden email]> writes:
>>>
>>>> Btw, is there something speaking against #condenseSources asking for
>>>> the destination of the new sources file? At least on unix like systems
>>>> the assumption, that the sources file encompass the vm file in the
>>>> same directory (e.g. /usr/bin) is most likely wrong.
>>>
>>> +1
>>
>> Or simply create it in FileDirectory default.
>>
>> - Bert -
>>
>>
>>
>

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Casey Ransberger
In reply to this post by Andreas.Raab
At least I was close:)

I will make the change to use #nextChunkPut: and #storeString. Thanks
for all your help, Squeakers!

On Thursday, February 25, 2010, Andreas Raab <[hidden email]> wrote:

> I did a quick test, and I think this should work:
>
>         license := 'Put your license text here'.
>         stream nextChunkPut: license storeString.
>         ".... Continue with condense changes ...."
>
> What it does is storing the license as a string literal (#storeString) so that the sources file will begin with the license as string and consequently the license can be read back in and parsed via:
>
>         license := Compiler evaluate: ((Smalltalk sourcesFile) position: 0; nextChunk).
>
> If you didn't use storeString you might have problems with utilities that try to parse the sources file, i.e., ChangeList and friends.
>
> Cheers,
>   - Andreas
>
> Ronald Spengler wrote:
>
> I have a change in place for condenseSources   My question was really
> about how to put the license at the top in a way that can be written.
>
> I want to be sure though, is there a particular method which should be
> called within condenseSources to add comment text to the top?
>
> My (perhaps naive) implementation is doing something like:
>
> f nextPutall: license
>
> On Thursday, February 25, 2010, Bert Freudenberg <[hidden email]> wrote:
>
> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>
> "Ronald" == Ronald Spengler <[hidden email]> writes:
>
> Ronald> Good people of Squeak,
> Ronald> We need to have a license statement at the top of our sources file for
> Ronald> the 4.0 release. I've been futsing with it without success.
>
> Ronald> I've tried:
>
> Ronald> 'foo'!
> Ronald> 'foo'!!
> Ronald> !'foo'!
>
> (I think) The sources file is always accessed according to byte offsets.  Look
> at the code for #condenseSources, and make sure the first thing it does is
> write the license before rewriting everything else.
>
> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>
> - Bert -
>
>
>
>
>
>
>
>
>
>

--
Ron

Reply | Threaded
Open this post in threaded view
|

Re: [Squeak 4.0] Anyone know much about the format of the sources/changes files?

Casey Ransberger
Aha! I see now. #nextChunkPut: handles the fileout formatting for me.
Fantastic. Also makes the one liner less messy.

On Thu, Feb 25, 2010 at 5:01 PM, Ronald Spengler <[hidden email]> wrote:

> At least I was close:)
>
> I will make the change to use #nextChunkPut: and #storeString. Thanks
> for all your help, Squeakers!
>
> On Thursday, February 25, 2010, Andreas Raab <[hidden email]> wrote:
>> I did a quick test, and I think this should work:
>>
>>         license := 'Put your license text here'.
>>         stream nextChunkPut: license storeString.
>>         ".... Continue with condense changes ...."
>>
>> What it does is storing the license as a string literal (#storeString) so that the sources file will begin with the license as string and consequently the license can be read back in and parsed via:
>>
>>         license := Compiler evaluate: ((Smalltalk sourcesFile) position: 0; nextChunk).
>>
>> If you didn't use storeString you might have problems with utilities that try to parse the sources file, i.e., ChangeList and friends.
>>
>> Cheers,
>>   - Andreas
>>
>> Ronald Spengler wrote:
>>
>> I have a change in place for condenseSources   My question was really
>> about how to put the license at the top in a way that can be written.
>>
>> I want to be sure though, is there a particular method which should be
>> called within condenseSources to add comment text to the top?
>>
>> My (perhaps naive) implementation is doing something like:
>>
>> f nextPutall: license
>>
>> On Thursday, February 25, 2010, Bert Freudenberg <[hidden email]> wrote:
>>
>> On 25.02.2010, at 02:38, Randal L. Schwartz wrote:
>>
>> "Ronald" == Ronald Spengler <[hidden email]> writes:
>>
>> Ronald> Good people of Squeak,
>> Ronald> We need to have a license statement at the top of our sources file for
>> Ronald> the 4.0 release. I've been futsing with it without success.
>>
>> Ronald> I've tried:
>>
>> Ronald> 'foo'!
>> Ronald> 'foo'!!
>> Ronald> !'foo'!
>>
>> (I think) The sources file is always accessed according to byte offsets.  Look
>> at the code for #condenseSources, and make sure the first thing it does is
>> write the license before rewriting everything else.
>>
>> Randal is right. You can not just add something at the beginning of the sources or changes file. These are *NOT* text files but databases, the offsets are held in the image (each method knows the file position of its source code). The normal way to put a license in the beginning would be via #condenseSources - which we need to do anyway to purge all older versions of methods.
>>
>> - Bert -
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> --
> Ron
>



--
Ron

Reply | Threaded
Open this post in threaded view
|

Re: Git repositories and sources/changes files (was Re: [squeak-dev] [Squeak 4.0] Anyone know much about the format of the sources/changes files?)

Casey Ransberger
In reply to this post by Bert Freudenberg
Wow, really? I was thinking of doing something at least conceptually
similar, but I didn't think I'd ever find the time. How long before
you can put this up somewhere where we can look at it?

Cool!

On Thursday, February 25, 2010, Bert Freudenberg <[hidden email]> wrote:

> On 25.02.2010, at 11:08, Tony Garnock-Jones wrote:
>>
>> Bert Freudenberg wrote:
>>> Randal is right. You can not just add something at the beginning of
>>> the sources or changes file. These are *NOT* text files but
>>> databases, the offsets are held in the image (each method knows the
>>> file position of its source code).
>>
>> So, just as an aside, over an idle couple of days this week I
>> implemented the Git repository format in Smalltalk. (This is why I was
>> asking about the SystemChangeNotifier earlier.)
>>
>> http://www.squeaksource.com/Git.html
>>
>> So far, it can
>>
>> - initialize repositories
>> - read and write loose objects (blobs, trees, commits, tags)
>> - read packed objects (but not write them, yet)
>> - resolve and update refs (tags and branch heads)
>
> Awesome!
>
>> I remember hearing something about a bit of good refactoring recently
>> that permitted *switching out the sources implementation* for an image.
>> Perhaps it could be backed onto a Git repository using this code.
>> Methods would then know the sha1 of the blob that holds the source.
>
> That might work indeed.
>
> However, the method source pointer is not only used for accessing the current code, but previous versions of the method too. So you would need some more info than just the blob.
>
>> #condenseSources feels very much like "git pack-objects" or "git gc".
>
> Not quite, #condenseSources is destructive. It's rather more like pruning history - it deletes all previous versions. With something like git we might never have to do that again. Yay!
>
>> I haven't done the network protocol yet (in large part because I can't
>> yet build (good) packs) so shelling out to "git fetch" and "git push" is
>> still needed for that.
>
> Do you have ideas yet for how to map the Smalltalk structure to file names? Possibly you could reuse the mapping from SqueakSVN
> http://www.hpi.uni-potsdam.de/hirschfeld/projects/squeaksvn/
>
> - Bert -
>
>
>
>

--
Ron

Reply | Threaded
Open this post in threaded view
|

Re: Git repositories and sources/changes files (was Re: [squeak-dev] [Squeak 4.0] Anyone know much about the format of the sources/changes files?)

keith1y

>> Awesome!
>>
>>> I remember hearing something about a bit of good refactoring  
>>> recently
>>> that permitted *switching out the sources implementation* for an  
>>> image.
>>> Perhaps it could be backed onto a Git repository using this code.
>>> Methods would then know the sha1 of the blob that holds the source.

This problem is a real tester for the process we use because it is so  
easy to break the image completely.

I posted some discussions that might interest you here, and I have  
completed phase 1.
feel free to comment/join the discussion here.

http://smalltalkers.pbworks.com/System-Sources

regards

Keith

p.s.

I just posted some brief highlights of the decision making involved  
between bzr,  git and mercurial.

http://smalltalkers.pbworks.com/Why-Bazaar