Merge pull request #31320 from DaanDeMeyer/versioning

meson: Start adding devel and rc suffixes to the project version
This commit is contained in:
Daan De Meyer 2024-02-15 20:15:04 +01:00 committed by GitHub
commit 55c2350e85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 53 additions and 38 deletions

View file

@ -12,17 +12,19 @@ SPDX-License-Identifier: LGPL-2.1-or-later
3. Update the time and place in NEWS
4. Update hwdb (`ninja -C build update-hwdb`, `ninja -C build update-hwdb-autosuspend`, commit separately).
5. Update syscall numbers (`ninja -C build update-syscall-tables update-syscall-header`).
6. [RC1] Update version and library numbers in `meson.build`
7. Check dbus docs with `ninja -C build update-dbus-docs`
8. Update translation strings (`cd build`, `meson compile systemd-pot`, `meson compile systemd-update-po`) - drop the header comments from `systemd.pot` + re-add SPDX before committing. If the only change in a file is the 'POT-Creation-Date' field, then ignore that file.
9. Tag the release: `version=vXXX~rcY && git tag -s "${version}" -m "systemd ${version}"`. Note that this uses a tilde (\~) instead of a hyphen (-) because tildes sort lower in version comparisons according to the [version format specification](https://uapi-group.org/specifications/specs/version_format_specification/), and we want `v255-rc1` to sort lower than `v255`.
10. Do `ninja -C build`
11. Make sure that the version string and package string match: `build/systemctl --version`
12. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones)
13. "Draft" a new release on github (https://github.com/systemd/systemd/releases/new), mark "This is a pre-release" if appropriate.
14. Check that announcement to systemd-devel, with a copy&paste from NEWS, was sent. This should happen automatically.
15. Update IRC topic (`/msg chanserv TOPIC #systemd Version NNN released | Online resources https://systemd.io/`)
16. [FINAL] Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`.
17. [FINAL] Build and upload the documentation (on the -stable branch): `ninja -C build doc-sync`
18. [FINAL] Change the default branch to latest release (https://github.com/systemd/systemd-stable/settings/branches).
19. [FINAL] Change the Github Pages branch in the stable repository to the newly created branch (https://github.com/systemd/systemd-stable/settings/pages) and set the 'Custom domain' to 'systemd.io'
6. [RC1] Update library numbers in `meson.build`
7. Update version number in `meson.version` (e.g. from `v256~devel` to `v256~rc1` or from `v256~rc3` to `v256`)
8. Check dbus docs with `ninja -C build update-dbus-docs`
9. Update translation strings (`cd build`, `meson compile systemd-pot`, `meson compile systemd-update-po`) - drop the header comments from `systemd.pot` + re-add SPDX before committing. If the only change in a file is the 'POT-Creation-Date' field, then ignore that file.
10. Tag the release: `version=vXXX~rcY && git tag -s "${version}" -m "systemd ${version}"`. Note that this uses a tilde (\~) instead of a hyphen (-) because tildes sort lower in version comparisons according to the [version format specification](https://uapi-group.org/specifications/specs/version_format_specification/), and we want `v255~rc1` to sort lower than `v255`.
11. Do `ninja -C build`
12. Make sure that the version string and package string match: `build/systemctl --version`
13. [FINAL] Close the github milestone and open a new one (https://github.com/systemd/systemd/milestones)
14. "Draft" a new release on github (https://github.com/systemd/systemd/releases/new), mark "This is a pre-release" if appropriate.
15. Check that announcement to systemd-devel, with a copy&paste from NEWS, was sent. This should happen automatically.
16. Update IRC topic (`/msg chanserv TOPIC #systemd Version NNN released | Online resources https://systemd.io/`)
17. [FINAL] Push commits to stable, create an empty -stable branch: `git push systemd-stable --atomic origin/main:main origin/main:refs/heads/${version}-stable`.
18. [FINAL] Build and upload the documentation (on the -stable branch): `ninja -C build doc-sync`
19. [FINAL] Change the default branch to latest release (https://github.com/systemd/systemd-stable/settings/branches).
20. [FINAL] Change the Github Pages branch in the stable repository to the newly created branch (https://github.com/systemd/systemd-stable/settings/pages) and set the 'Custom domain' to 'systemd.io'
21. [FINAL] Update version number in `meson.version` to the devel version of the next release (e.g. from `v256` to `v257~devel`)

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
project('systemd', 'c',
version : '255',
version : files('meson.version'),
license : 'LGPLv2+',
default_options: [
'c_std=gnu11',
@ -18,8 +18,9 @@ libudev_version = '1.7.8'
conf = configuration_data()
conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
conf.set('PROJECT_VERSION', meson.project_version(),
conf.set('PROJECT_VERSION', meson.project_version().split('~')[0],
description : 'Numerical project version (used where a simple number is expected)')
conf.set_quoted('PROJECT_VERSION_FULL', meson.project_version(), description : 'Full project version')
# This is to be used instead of meson.source_root(), as the latter will return
# the wrong result when systemd is being built as a meson subproject
@ -1857,13 +1858,12 @@ version_h = vcs_tag(
output : 'version.h',
command: [project_source_root / 'tools/meson-vcs-tag.sh',
project_source_root,
meson.project_version(),
version_tag,
])
shared_lib_tag = get_option('shared-lib-tag')
if shared_lib_tag == ''
shared_lib_tag = meson.project_version()
shared_lib_tag = meson.project_version().split('~')[0]
endif
#####################################################################
@ -2557,11 +2557,17 @@ foreach exec : public_programs
args : exec.full_path(),
depends: exec)
version = meson.project_version()
if name == 'udevadm'
# For compatibility reasons we can't use the full version in udevadm.
version = version.split('~')[0]
endif
test('check-version-' + name,
check_version,
suite : 'dist',
args : [exec.full_path(),
meson.project_version()],
version],
depends: exec)
endif
endforeach

1
meson.version Normal file
View file

@ -0,0 +1 @@
256~devel

View file

@ -288,7 +288,7 @@ int version(void) {
if (colors_enabled())
b = systemd_features_with_color();
printf("%ssystemd " STRINGIFY(PROJECT_VERSION) "%s (" GIT_VERSION ")\n%s\n",
printf("%ssystemd " PROJECT_VERSION_FULL "%s (" GIT_VERSION ")\n%s\n",
ansi_highlight(), ansi_normal(),
b ?: systemd_features);
return 0;

View file

@ -67,7 +67,7 @@ if meson.is_cross_build() and get_option('sbat-distro') == 'auto'
warning('Auto detection of SBAT information not supported when cross-building, disabling SBAT.')
elif get_option('sbat-distro') != ''
efi_conf.set_quoted('SBAT_PROJECT', meson.project_name())
efi_conf.set_quoted('PROJECT_VERSION', meson.project_version())
efi_conf.set_quoted('PROJECT_VERSION', meson.project_version().split('~')[0])
efi_conf.set('PROJECT_URL', conf.get('PROJECT_URL'))
if get_option('sbat-distro-generation') < 1
error('SBAT Distro Generation must be a positive integer')
@ -385,7 +385,7 @@ foreach efi_elf_binary : efi_elf_binaries
install_tag : 'systemd-boot',
command : [
elf2efi_py,
'--version-major=' + meson.project_version(),
'--version-major=' + meson.project_version().split('~')[0],
'--version-minor=0',
'--efi-major=1',
'--efi-minor=1',

View file

@ -1366,7 +1366,7 @@ static int verb_monitor(int argc, char **argv, void *userdata) {
static int verb_capture(int argc, char **argv, void *userdata) {
_cleanup_free_ char *osname = NULL;
static const char info[] =
"busctl (systemd) " STRINGIFY(PROJECT_VERSION) " (Git " GIT_VERSION ")";
"busctl (systemd) " PROJECT_VERSION_FULL " (Git " GIT_VERSION ")";
int r;
if (isatty(STDOUT_FILENO))

View file

@ -64,7 +64,7 @@ static void manager_dump_header(Manager *m, FILE *f, const char *prefix) {
* stable between versions. We take the liberty to restructure it entirely between versions and
* add/remove fields at will. */
fprintf(f, "%sManager: systemd " STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")\n", strempty(prefix));
fprintf(f, "%sManager: systemd " PROJECT_VERSION_FULL " (" GIT_VERSION ")\n", strempty(prefix));
fprintf(f, "%sFeatures: %s\n", strempty(prefix), systemd_features);
for (ManagerTimestamp q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) {

View file

@ -18,7 +18,7 @@
/* for libcryptsetup debug purpose */
_public_ const char *cryptsetup_token_version(void) {
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")";
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
}
_public_ int cryptsetup_token_open_pin(

View file

@ -18,7 +18,7 @@
/* for libcryptsetup debug purpose */
_public_ const char *cryptsetup_token_version(void) {
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")";
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
}
_public_ int cryptsetup_token_open_pin(

View file

@ -20,7 +20,7 @@
/* for libcryptsetup debug purpose */
_public_ const char *cryptsetup_token_version(void) {
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")";
return TOKEN_VERSION_MAJOR "." TOKEN_VERSION_MINOR " systemd-v" PROJECT_VERSION_FULL " (" GIT_VERSION ")";
}
static int log_debug_open_error(struct crypt_device *cd, int r) {

View file

@ -27,7 +27,7 @@ from shutil import which
from pathlib import Path
from typing import Optional
__version__ = '{{PROJECT_VERSION}} ({{GIT_VERSION}})'
__version__ = '{{PROJECT_VERSION_FULL}} ({{GIT_VERSION}})'
try:
VERBOSE = int(os.environ['KERNEL_INSTALL_VERBOSE']) > 0

View file

@ -8,7 +8,7 @@
TEST(systemd_installation_has_version) {
int r;
FOREACH_STRING(version, "0", "231", STRINGIFY(PROJECT_VERSION), "999") {
FOREACH_STRING(version, "0", "231", PROJECT_VERSION_FULL, "999") {
r = systemd_installation_has_version(saved_argv[1], version);
assert_se(r >= 0);
log_info("%s has systemd >= %s: %s",

View file

@ -1310,7 +1310,7 @@ static int generic_method_get_info(
return varlink_replyb(link, JSON_BUILD_OBJECT(
JSON_BUILD_PAIR_STRING("vendor", "The systemd Project"),
JSON_BUILD_PAIR_STRING("product", product),
JSON_BUILD_PAIR_STRING("version", STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")"),
JSON_BUILD_PAIR_STRING("version", PROJECT_VERSION_FULL " (" GIT_VERSION ")"),
JSON_BUILD_PAIR_STRING("url", "https://systemd.io/"),
JSON_BUILD_PAIR_STRV("interfaces", interfaces)));
}

View file

@ -50,7 +50,7 @@ from typing import (Any,
import pefile # type: ignore
__version__ = '{{PROJECT_VERSION}} ({{GIT_VERSION}})'
__version__ = '{{PROJECT_VERSION_FULL}} ({{GIT_VERSION}})'
EFI_ARCH_MAP = {
# host_arch glob : [efi_arch, 32_bit_efi_arch if mixed mode is supported]

View file

@ -4,14 +4,15 @@
set -u
set -o pipefail
dir="${1:?}"
fallback="${2:?}"
version_tag="${3:-}"
dir="${1:-.}"
version_tag="${2:-}"
if [ -n "${version_tag}" ]; then
# If -Dversion_tag= was used, just use that without further changes.
echo "${version_tag}"
else
read -r project_version <"${dir}/meson.version"
# Check that we have either .git/ (a normal clone) or a .git file (a work-tree)
# and that we don't get confused if a tarball is extracted in a higher-level
# git repository.
@ -22,15 +23,20 @@ else
c=''
if [ -e "${dir}/.git" ]; then
c="$(git -C "$dir" describe --abbrev=7 --dirty=^ 2>/dev/null)"
if [ -z "$c" ]; then
if [ -n "$c" ]; then
# git describe uses the most recent tag. However, for development versions (e.g. v256~devel), the
# most recent tag will be v255 as there is no tag for development versions. To deal with this, we
# replace the tag with the project version instead.
c="${project_version}-${c#*-}"
else
# This call might still fail with permission issues
suffix="$(git -C "$dir" describe --always --abbrev=7 --dirty=^ 2>/dev/null)"
[ -n "$suffix" ] && c="${fallback}-${suffix}"
[ -n "$suffix" ] && c="${project_version}-${suffix}"
fi
fi
[ -z "$c" ] && c="${fallback}"
[ -z "$c" ] && c="${project_version}"
# Replace any hyphens with carets which are allowed in versions by pacman whereas hyphens are not. Git
# versions with carets will also sort higher than their non-git version counterpart both in pacman
# versioning and in version comparison spec versioning.
# versioning and in version format specification versioning.
echo "$c" | sed 's/^v//; s/-/^/g'
fi