summaryrefslogtreecommitdiff
path: root/tools/meson-vcs-tag.sh
Commit message (Collapse)AuthorAgeFilesLines
* Report version string as in the Boot Loader Spec, fix boot loader upgradesZbigniew Jędrzejewski-Szmek2022-10-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | We generate a "version string" that is reported by various tools. This patch changes this version string to use the characters specified for the version string in the Boot Loader Specification. We start using the special characters we have in the spec for this exact purpose and thus fix version comparisons. We also stop using '+' which is not part of the allowed charset and is used for boot attempt counting and should not be part of the version string. The version string is (among other places) used in sd-boot and the comparison result is used by 'bootctl update' to decide whether to install a new binary. Before, because 'nn-rc1' compares higher than 'nn', we would refuse to upgrade pre-release versions. The boot loader is the primary motivation. I'm not aware of programatic version comparisons in other places, but it makes sense to use the same versions string everywhere. (This patch effectively only matters for non-distro builds, because distro builds presumably use -Dversion-tag to set something meaningful. Ideally, those version strings are compatible with our version strings, but this is outside of our control.)
* tools: shellcheck-ify most of the tool scriptsFrantisek Sumsal2021-04-201-2/+2
|
* tree-wide: add spdx header on all scripts and helpersZbigniew Jędrzejewski-Szmek2021-01-281-0/+1
| | | | | | Even though many of those scripts are very simple, it is easier to include the header than to try to say whether each of those files is trivial enough not to require one.
* meson: Use configure_file when version-tag is specifiedDaan De Meyer2021-01-151-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | vcs_tag() is slow. When the version-tag meson option is set, we can use configure_file() directly to speed up incremental builds. Before (with version-tag set to v247): ``` ‣ Running build script... [1/418] Generating version.h with a custom command real 0m0.521s user 0m0.229s sys 0m0.067s ``` After (with version-tag set to v247): ``` ‣ Running build script... ninja: no work to do. real 0m0.094s user 0m0.048s sys 0m0.022s ```
* treewide: more portable bash shebangsJörg Thalheim2020-03-051-1/+1
| | | | | | | | | | | | | | | | As in 2a5fcfae024ffc370bb780572279f45a1da3f946 and in 3e67e5c9928f8b1e1c5a63def88d53ed1fed12eb using /usr/bin/env allows bash to be looked up in PATH rather than being hard-coded. As with the previous changes the same arguments apply - distributions have scripts to rewrite shebangs on installation and they know what locations to rely on. - For tests/compilation we should rather rely on the user to have setup there PATH correctly. In particular this makes testing from git easier on NixOS where do not provide /bin/bash to improve compose-ability.
* meson-vcs-tag: enhance version info generationJoe Lin2019-05-211-1/+5
| | | | | | | | | | | | When build from release tarball and where there is parent .git dir, this situtaion will get wrong version info. (build with buildroot) The systemd running show wrong version in dmesg log: systemd[1]: systemd 2019.02-1086-gf5f17c4 running in system mode. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Shoule be: systemd[1]: systemd 241 running in system mode. (-PAM -AUDIT -SEL ^^^^^^^^^^^
* scripts: use 4 space indentationZbigniew Jędrzejewski-Szmek2019-04-121-2/+2
| | | | | | | | | | | | | | | | | | We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed. 4 sp was the most common, in particular the majority of scripts under test/ used that. Let's standarize on 4 sp, because many commandlines are long and there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp also seems to be the default indentation, so this will make it less likely that people will mess up if they don't load the editor config. (I think people often use vi, and vi has no support to load project-wide configuration automatically. We distribute a .vimrc file, but it is not loaded by default, and even the instructions in it seem to discourage its use for security reasons.) Also remove the few vim config lines that were left. We should either have them on all files, or none. Also remove some strange stuff like '#!/bin/env bash', yikes.
* meson: use /bin/bash for scriptZbigniew Jędrzejewski-Szmek2018-12-211-1/+1
| | | | | It seems -o pipefail does not work on Ubunut. /bin/sh is most likely resolved to dash.
* meson: allow setting the version string during configurationZbigniew Jędrzejewski-Szmek2018-12-211-1/+7
| | | | | | This will be useful when building distro packages, because we can set the version string to the rpm/dpkg/whatever version string, and getter reports from end users.
* meson-vcs-tag: add work-around for git bugZbigniew Jędrzejewski-Szmek2018-12-211-2/+5
|
* meson: generate version tag from gitZbigniew Jędrzejewski-Szmek2018-12-211-0/+9
$ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.