flux-sched: set the version if the ver file is missing (#44068)

* flux-sched: set the version if the ver file is missing

problem: flux-sched needs a version, it normally gets this from a
release tarball or from git tags, but if using a source archive or a git
clone without tags the version is missing

solution: set the version through cmake based on the version spack sees
when the version file is missing

* Update var/spack/repos/builtin/packages/flux-sched/package.py

Co-authored-by: Alec Scott <hi@alecbcs.com>

---------

Co-authored-by: Alec Scott <hi@alecbcs.com>
This commit is contained in:
Tom Scogland 2024-05-09 11:50:42 -07:00 committed by GitHub
parent 3381899c69
commit b79761b7eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -186,6 +186,10 @@ def setup_run_environment(self, env):
class CMakeBuilder(CMakeBuilder):
def cmake_args(self):
ver_in_src = os.path.exists(os.path.join(self.stage.source_path, "flux-sched.ver"))
# flux-sched before v0.33 does not correctly set the version even when the file is present.
if self.spec.satisfies("@:0.33") or not ver_in_src:
return [self.define("FLUX_SCHED_VER", self.spec.version)]
return []