[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Build instructions fail (#209)

Jakob Reschke forums.jakob at resfarm.de
Sun Feb 4 18:59:08 UTC 2018


Hi Eliot,

2018-02-03 16:52 GMT+01:00 Eliot Miranda <eliot.miranda at gmail.com>:
> With many SCCS systems, including Subversion, which was used to manage the source before git, one can use a metalanguage in the source file that is recognized and replaced by commit information on each commit.  Git doesn't support this (?!?!?!).

Somehow I often feel the urge to defend git, please bear with me. ;-)
Git does support it just the way it is done for opensmalltalk-vm:
through smudge and clean filters. Actually this is much more flexible
than in Svn. The "problem" is that git will not touch your files
unless you tell it to: if the sqSCCSVersion.h was not modified, git
will not update it just because you committed something else. Hence,
you need to run additional scripts (as post-commit, post-checkout
hook, or manually) to get that effect.

> So we have to do it manually with this script.

At least for the first time after a clone (not checkout), after which
the script will have installed itself as hooks. Also you need to run
the script manually again if it was changed, so the hooks are
accordingly overwritten as well.

Since GitHub will not run our scripts or install the filters, their
effects are neither visible on the web nor in the tarballs, but see
below.

> Ideally we would have rewritten the makefiles to do this automatically but not yet :-)

+1, usually this should happen in a configure step. But it should
check that git is actually available on the build machine. (And perl,
as the filters are currently implemented in perl.)

For release tar and zip downloads (which would not have a git
repository available to extract version info), have a look at
https://git-scm.com/docs/gitattributes#_code_export_subst_code Maybe
the placeholders and the filters could be updated to converge with
this.

For example:

    "Rev: $Format:%h$"
    "Date: $Format:%ad$"
    "Url: (hard-code official URL or "tarball" here. If the filter
and, thus, git are available, it is overwritten)".

.gitconfig

    [filter "rev"]
        smudge = set -x && perl -pe 's/\"Rev:
\\$Format:[^\\$]*\\$/\"Rev: '\"$(git log -1 --format=%h)\"'/'
        clean = set -x && perl -pe 's/\"Rev: [0-9a-f]*/\"Rev: \\$Format:%h\\$/'

.gitattributes

    sq*SCCSVersion.h filter=rev export-subst

testing the tarball results

    $ git archive HEAD platforms/Cross/vm/sqSCCSVersions.h | tar xO |
grep GitRawRevisionString[]

The username+machine-inserting stuff in the smudge script could be
moved out of the filter into the make-invoked code, so that tarball
users can also benefit from it. But I guess none of this is urgent, I
just wanted to dump this info for now. ;-)

Best regards,
Jakob


More information about the Vm-dev mailing list