Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
343 stars 230 forks source link

Moved git state from version.dd to version.m2 #3404

Closed mahrud closed 1 month ago

mahrud commented 1 month ago

Finally closes #3250, which has been such a pain ...

The main difficulty was rearranging startup.m2 to:

  1. set prefixDirectory
  2. set currentLayout
  3. and based on those find the Core directory where version.m2 lives

all before the version is printed.

If version.m2 is not found, for whatever reason, we get:

Macaulay2, version 1.24.05-bin (version.m2 not found)

The "-bin" indicates that this is the version stored in the binary only.

mahrud commented 1 month ago

I hope the last commit fixed the autotools issue, but if it didn't work, @d-torrance do you mind looking into what's missing?

d-torrance commented 1 month ago

Figured it out! We need to use AC_SUBST instead of AC_DEFINE now.

mahrud commented 1 month ago

Apparently neither cmake nor autotools have been detecting the git description and branch correctly on development when building on GitHub. I don't know where this started, but on autotools we've just been getting:

configure: configuring Macaulay2 version 1.24.05
...
configure: with  GIT_DESCRIPTION   = release-1.24.05
configure: with  GIT_BRANCH        = 

And on cmake:

     M2 version        = 1.24.05
     Git description   = 
     Git branch        = 
mahrud commented 1 month ago

It seems like it's because github uses a shallow checkout, which doesn't pull tags. This makes sense and I don't necessarily think we should change it (though for future reference, here is how one would change it: https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches)