flux-framework / flux-sched

Fluxion Graph-based Scheduler
GNU Lesser General Public License v3.0
90 stars 41 forks source link

Descriptive error for missing git tags #1291

Closed wihobbs closed 2 months ago

wihobbs commented 2 months ago

@jacobtkeio was hitting this problem in the CI for his fork last week, and it took me an hour and a half to figure out why. It turns out, since his fork didn't have tags, running git push --tags made the whole world happy again.

This is a problem in flux-core too since both repositories determine version using git describe.

But, since this has come up a few times, I'm going to look in to making a better error message:

git fetch tags
  fatal: --unshallow on a complete repository does not make sense
build setup
autogen.sh
/usr/src
configure --prefix=/usr --sysconfdir=/etc --with-systemdsystemunitdir=/etc/systemd/system \
    --localstatedir=/var --prefix=/usr --sysconfdir=/etc
  Re-run cmake no build system arguments
  -- VER 0cb6cde5
  CMake Error at CMakeLists.txt:15 (project):
    VERSION "0cb6cde5" format invalid.
wihobbs commented 2 months ago

It's a different problem in core. Core will build with an invalid version, but fails on make check

In file included from version.c:15:
version.c: In function ‘flux_core_version’:
version.h:25:37: error: ‘ca5949d’ undeclared (first use in this function)
   25 | #define FLUX_CORE_VERSION_MAJOR     ca5949d
      |                                     ^~~~~~~
version.c:25:18: note: in expansion of macro ‘FLUX_CORE_VERSION_MAJOR’
   25 |         *major = FLUX_CORE_VERSION_MAJOR;
      |                  ^~~~~~~~~~~~~~~~~~~~~~~
version.h:25:37: note: each undeclared identifier is reported only once for each function it appears in
   25 | #define FLUX_CORE_VERSION_MAJOR     ca5949d
      |                                     ^~~~~~~
version.c:25:18: note: in expansion of macro ‘FLUX_CORE_VERSION_MAJOR’
   25 |         *major = FLUX_CORE_VERSION_MAJOR;
      |                  ^~~~~~~~~~~~~~~~~~~~~~~
version.h:26:37: error: ‘d’ undeclared (first use in this function)
   26 | #define FLUX_CORE_VERSION_MINOR     d
      |                                     ^
version.c:27:18: note: in expansion of macro ‘FLUX_CORE_VERSION_MINOR’
   27 |         *minor = FLUX_CORE_VERSION_MINOR;
      |                  ^~~~~~~~~~~~~~~~~~~~~~~
version.c:29:41: error: expected expression before ‘;’ token
   29 |         *patch = FLUX_CORE_VERSION_PATCH;
      |                                         ^
version.h:33:63: error: expected expression before ‘<<’ token
   33 |                                      (FLUX_CORE_VERSION_PATCH << 0))
      |                                                               ^~
version.c:30:12: note: in expansion of macro ‘FLUX_CORE_VERSION_HEX’
   30 |     return FLUX_CORE_VERSION_HEX;
      |            ^~~~~~~~~~~~~~~~~~~~~
version.c:31:1: error: control reaches end of non-void function [-Werror=return-type]
   31 | }
      | ^
cc1: all warnings being treated as errors

Autoconf takes the version of a shallow clone (depth 1) as:

checking Major version... ca5949d
checking Minor version... d
checking Point version...
grondo commented 2 months ago

A hash-only version should probably be rejected at configure time since it creates an invalid version.h