On Fri, Jun 9, 2017 at 4:01 PM, Pavel Krivanek <pavel.kriva...@gmail.com>
wrote:

> Hi,
>
> because during the image bootstrapping all source code is reloaded, it is
> all placed in the changes file and the sources file is useless. It would be
> strange to deliver Pharo with empty sources file and big changes so we
> decided to do sources compacting for every build.
>
> So Pharo 7 development versions will be delivered in an archive with three
> files named like:
>
> Pharo7.0-117934d.image
> Pharo7.0-117934d.changes
> Pharo7.0-117934d.sources
>
> where "117934d" is an abbreviated hash of the Git commit from which the
> Pharo image was bootstrapped. The sources file will be build-specific and
> of course you will be able to share it between images based on the same
> build. In changes file you will have only you own changes.
>
>
>
So what we need is for CompiledMethod>>#sourceCode to be based on
git-hashes and directly access git, with one git repository shared by
multiple Images.

Debugging into...
     (Object>>#printString) sourceCode
I see the trailer has "kind == #SourcePointer"
and in #getSourceFromFile method #decodeSourcePointer does some interesting
magic to calculate its "data" that later is returned by #sourcePointer in
 "SourceFiles sourceCodeAt: self sourcePointer"
where SourceFiles is ...PharoV60.sources and ...PharoV60.changes.

So I guess we'd need something like "kind == #ContentHash"
and then in CompiledMethod>>sourceCode ahead of getSourceFromFile
we add ...
   [ self getSourceFromUserLocalGit: contentHash ] ifNotNil: [:s | ^s].
   [ self getSourceFromUserGitServer: contentHash ] ifNotNil: [:s | ^s].
   [ self getSourceFromPharoGitServer: contentHash ] ifNotNil: [:s | ^s].
   [ self getSourceFromPrivateEncryptedRepository: contentHash ] ifNotNil:
[:s | ^s].
   [ self getSourceFromIPFS: contentHash ] ifNotNil: [:s | ^s].
and such like.  Perhaps some would need separate "kind"s,
and this is oversimplistic since I haven't considered saving sources,
but you get the idea.

cheers -ben

Reply via email to