Opened 8 years ago

Closed 6 years ago

#106 closed todo (fixed)

Revise support for binary revisions for snapshot-based SCMs

Reported by: jan vrany Owned by:
Priority: major Milestone: 8.0.0
Component: stc Keywords:
Cc: Also affects CVS HEAD (eXept version): no

Description

...such as HG, GIT or SVN (actually all modern ones)

The problem is that class's A revision slot is filled with revision number at compilation time - say "REV1" So, when one moves to another revision, say "REV2" and class A is *not* changed between "REV1" and "REV2", then it's not recompiled and thus still refers old "REV1".

This leads to two problems:

  • It's bit confusing as one would expect binary revisions to always match the one from which class library was compiled
  • Mismatch in logical revision (taken from project definition class) and binary revision (stored in class itself). This results in messages like
SourceCodeManager [info]: "Method" has HGSourceCodeManager-revision (20377:90f13d5d7e00) vs. binary revision (69376f98c1b4) - trusting binaryRevision

One solution would be always take binary revision from project definition class. The project definition class is recompiled each time revision changes (see rules in Make.proto and bc.mak). Therefore, the class initialization routine could be something like:

  ...
if (phase == 2) {
  OBJ *__clits = __lits;
  unsigned *cOffs;
  OBJFUNC __refCode__;
  cOffs = __Method__codeOffsets;
  char revision[256] = { '\0' };
  __refCode__ = (OBJFUNC) ___codeArray___;
  {
      extern stx_libbasic_revision_HG; /* This is defined in stx_libbasic.c */      
      strncpy(revision, stx_libbasic_revision_HG, 256 - 30/*==strlen(" SHA1=4023f42bc997d23dedf633fb4dc0fa19d64e00b3 SCM=HG"*/);
      strcat(revision, " SHA1=4023f42bc997d23dedf633fb4dc0fa19d64e00b3 SCM=HG");
  }
  __DEFPKGSOURCE((char *)(__SYMBASE__+4440+sizeof(struct __symbolHeader)), "/home/jv/Private/Projects/SmalltalkX/sources/jv1_x32_lin/build/stx/libbasic/Method.st");
  __MKCLASS_META4__(&__STX_Method__MethodWhoInfo, (void *)0, Object, "Method::MethodWhoInfo", (void *)0,0, __MKSTRING_INIT(revision),2,"myClass mySelector", (char *)0,1);
#ifndef __STX_Method__MethodWhoInfoclass
# define __STX_Method__MethodWhoInfoclass __Class(__STX_Method__MethodWhoInfo)
#endif

The stx_libbasic_revision_HG will be defined stx_libbasic.o like:

const char* stx_libbasic_revision_HG = "$Changeset: 90f13d5d7e0097b5ddbd70ab184ae053aa1260d1 $";

This means we have to modify stc to:

  • Generate code as above
  • Detects that it compiles project definition class and generates stx_libbasic_revision_HG definition.

The downside is that it would require a couple strcpy() per each class that would make initialization slower. This can be optimized later by not concatenation strings together but
calling a new VM entry __MKSTRING_INIT_2() when creating a Smalltalk string passed to ___MKCLASS_META4__(), like:

...,__MKSTRING_INIT_2(stx_libbasic_revision_HG, " SHA1=4023f42bc997d23dedf633fb4dc0fa19d64e00b3 SCM=HG"),...

Change History (2)

comment:1 by jan vrany, 7 years ago

Milestone: 8.0.0

comment:2 by jan vrany, 6 years ago

Resolution: fixed
Status: newclosed

This has been addressed the way described above in:

Note: See TracTickets for help on using tickets.