fpm icon indicating copy to clipboard operation
fpm copied to clipboard

fpm build fails with valid semantic version

Open molinav opened this issue 3 years ago • 1 comments

It seems that fpm is expecting version numbers only in the format "X.Y.Z", with the minor and patch versions being optional. However, semantic versioning allows to have additional data after the first three numbers, which is useful e.g. to indicate development versions or specific builds.

fpm version:

vic@onyx:~$ fpm --version
Version:     0.3.0, alpha
Program:     fpm(1)
Description: A Fortran package manager and build system
Home Page:   https://github.com/fortran-lang/fpm
License:     MIT
OS Type:     Linux

Steps to reproduce the problem:

fpm new testmodule
cd testmodule
sed -i 's/version = "0.1.0"/version = "0.1.0+dev"/' fpm.toml
fpm build

Actual traceback:

vic@onyx:~$ fpm new testmodule
 + mkdir -p testmodule
 + cd testmodule
 + mkdir -p testmodule/src
 + mkdir -p testmodule/app
 + mkdir -p testmodule/test
 + git init testmodule
Initialised empty Git repository in /home/vic/testmodule/.git/
fpm: Leaving directory '/home'
vic@onyx:~$ cd testmodule
vic@onyx:~/testmodule$ sed -i 's/version = "0.1.0"/version = "0.1.0+dev"/' fpm.toml
vic@onyx:~/testmodule$ fpm build
Invalid character in version number
  | 0.1.0+dev
  |-----^^
ERROR STOP 1

Error termination. Backtrace:
#0  0x48de81 in ???
#1  0x48e129 in ???
#2  0x48f112 in ???
#3  0x40b3e9 in __fpm_MOD_cmd_build
	at ./src/fpm.f90:259
#4  0x4029f1 in MAIN__
	at app/main.f90:67
#5  0x40195e in main
	at app/main.f90:10
vic@onyx:~/testmodule$

Expected traceback:

The library should be built without getting terminated, as it happens when one runs the steps from above but without replacing the initial version number "0.1.0".

molinav avatar Jul 14 '21 16:07 molinav

The implemented semantic version parser only supports the semver v1 specs right now. Having a more complete versioning library, maybe as separate fpm project, would be required at some point to support the full semver v2 specs at some point and implement accurate version checks.

awvwgk avatar Jul 26 '21 09:07 awvwgk