jq icon indicating copy to clipboard operation
jq copied to clipboard

return version even if not using git sources

Open jonathanspw opened this issue 1 year ago • 11 comments

Downloading the source tarball from GitHub lacks .git structure and the version will be blank. This fixes it by using the directory name which contains the version.

This is currently impacting Fedora packaging, and potentially other distros if they use GitHub source tarballs.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2277743

jonathanspw avatar Apr 29 '24 18:04 jonathanspw

Hi, could the problem be that the build downloads the github auto generated tag artifact "Source code (tar.gz)" instead of the proper source distribution "jq-1.7.1.tar.gz"?

$ curl -sL https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-1.7.1.tar.gz | tar t | grep version.h
jq-1.7.1/src/version.h
$ curl -sL https://github.com/jqlang/jq/archive/refs/tags/jq-1.7.1.tar.gz | tar t | grep version.h
$

wader avatar Apr 29 '24 18:04 wader

Yes, "Source code (tar.gz)" is precisely what we use for sources in the Fedora package.

jonathanspw avatar Apr 29 '24 18:04 jonathanspw

Ok, could you try use "jq-1.7.1.tar.gz" instead? the other one is automatically added by github and it is currently not possible to disable or hide :(

wader avatar Apr 29 '24 18:04 wader

Is there any real reason to do so other than this bug? Generally speaking I try to use the auto generated source tarballs where possible, and other than this issue, it works fine for jq.

jonathanspw avatar Apr 29 '24 18:04 jonathanspw

I see, no reason really, so a fallback would be fine with me. Let's see what @nicowilliams, @itchyny other maintainers think about it.

wader avatar Apr 29 '24 18:04 wader

I believe even if using those sources that an autoreconf might wipe out the version stuff, so I'm going to test that and potentially expand this fallback to properly support directory names jq-<version> and jq-jq-<version> if necessary.

Please do not merge yet.

jonathanspw avatar Apr 29 '24 18:04 jonathanspw

👍 no worries, will wait for at least one more maintainer agrees and has reviewed

wader avatar Apr 29 '24 18:04 wader

The issue indeed exists even in the CI-generated tarballs that if you autoreconf for whatever reason it wipes out the version info.

$ ./jq --version
jq-

Committed a fix to deal with this as well, just updated regex.

jonathanspw avatar Apr 29 '24 18:04 jonathanspw

If you fix that i guess we can also remove the "skip the autoreconf step" from https://github.com/jqlang/jq?tab=readme-ov-file#instructions?

wader avatar Apr 29 '24 18:04 wader

We do autoreconf in Fedora without any other known side effects, so without it breaking the version stuff I guess it should be safe.

jonathanspw avatar Apr 29 '24 18:04 jonathanspw

The auto-generated tarball does not include the oniguruma submodule, so it requires system oniguruma library for regex filters support. Since we distribute archives (both tarball and zip) for distributors including the version and the oniguruma submodule (version of which we test), we recommend to use them. Also, using the directory name for version hint looks a bit weird to me. And /bin/sh is not always Bash.

itchyny avatar Apr 30 '24 08:04 itchyny

No explanation on not using the release tarballs, so closing.

itchyny avatar Aug 20 '24 12:08 itchyny