savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.35k stars 122 forks source link

Build with dev informations without Git dependency #3899

Open vitoyucepi opened 1 month ago

vitoyucepi commented 1 month ago

Is your feature request related to a problem? Please describe. I would like to be able to build without having a direct dependency on git.

Describe the solution you'd like

  1. If git exists, and the git repository was found, and the exit code of the git command is 0, then use the result of the git command.
  2. Otherwise, if an environment variable such as VERSION_HASH, COMMIT_ID or GIT_COMMIT is set, then use it.
  3. Otherwise, use an empty string or literally unknown. (none) is also fine, I guess.

Describe alternatives you've considered Maybe it would be great to integrate with IS_SNAPSHOT somehow.

Additional context If the project is built from github source archives like https://github.com/savonet/liquidsoap/archive/$_commit.tar.gz, then the git repository will not be available, but the commit could easily be set using the environment variable.

In addition, it would be great to explain all build time environment variables in the build manual.

toots commented 1 month ago

Thanks I see what you mean. Do you have a specific situation where you would like to build from a downloaded archive instead of a git pull and yet retain the github SHA in the build?

vitoyucepi commented 1 month ago

The alpine APKBUILD I use has no support for sourcing git repositories, unlike archlinux PKGBUILD which has support for something like git+https://github.com/savonet/liquidsoap.git#commit=$_commit. So I have to rely on the archive tarball to build from the rolling release and main branches.