Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gawk-ism in Makefile #1831

Merged
merged 2 commits into from
Sep 9, 2024
Merged

Conversation

daviesrob
Copy link
Member

The awk script used to extract htscodec's version string (if git describe fails or returns a hash) used a three-argument form of match, which is a GNU extension. Rewrite for better compatibility with other awk implementations, notably mawk, which supplies awk in some Cirrus-CI images.

This doesn't appear to show up on HTSlib's tests, which get a suitable version number from git describe, but does on SAMtools' where HTSlib (and so htscodecs) is cloned separately.

Also fix the cirrus-ci badge, which linked to the wrong location.

The awk script used to extract htscodec's version string (if
git describe fails or returns a hash) used a three-argument
form of "match", which is a GNU extension.  Rewrite for
better compatibility with other awk implementations,
notably "mawk", which supplies awk in some Cirrus-CI images.

Also fix the cirrus-ci badge, which linked to the wrong location.
@jkbonfield
Copy link
Contributor

jkbonfield commented Sep 5, 2024

The awkism change works, and is simpler.

However in review I've noticed the regexp has always been wrong as it doesn't permit more than one digit. At the risk of falsely accepting 12.34..56 we could just replace the regexp with /[0-9.]+/ which is much easier to understand.

Edit: or /[0-9]+(\.[0-9]+)*/ to return 12.34 instead of 12.34..56, but really I don't care as both are assuming something wrong and the version string is our string in the first place so don't create duff ones and the simplest regexp works fine. (And arguably it could just be arg 2 from AC_INIT and it'd accept string versions, but let's not go there!)

@daviesrob
Copy link
Member Author

Multiple digits should now be accepted.

@jkbonfield jkbonfield merged commit 86b0652 into samtools:develop Sep 9, 2024
9 checks passed
@daviesrob daviesrob deleted the awk-compatibility branch September 9, 2024 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants