mirror of
https://github.com/rustfs/rustfs.git
synced 2026-10-04 12:31:36 +00:00
ee6de7d786
* ci(package): build gnu and musl DEB/RPM variants with distinct file names
The Build and Release workflow produces four Linux binaries
(x86_64-gnu, aarch64-gnu, x86_64-musl, aarch64-musl), but packaging
only consumed the two gnu artifacts. Add matrix entries for the two
musl artifacts so every release ships all four DEB/RPM variants.
The libc variant is now part of the package file names, which would
otherwise collide between gnu and musl builds of the same version:
- deb: rustfs_<version>_<libc>_<arch>.deb
- rpm: rustfs-<libc>-<version>-<release>.<arch>.rpm
The dpkg Package and rpm Name stay plain "rustfs", so gnu and musl
remain mutually exclusive upgrades of one package rather than
co-installable packages fighting over /usr/bin/rustfs.
Dependency declarations now follow the linkage: gnu binaries
dynamically link glibc and keep Depends: libc6 (>= 2.31) /
glibc >= 2.31; musl binaries are statically linked and declare no
libc dependency. The libc variant is also visible in the package
description.
scripts/release/package_versions.sh gains a LIBC argument and its
contract tests cover both variants plus the invalid-libc cases.
* ci(package): align deb/rpm file names with the zip artifact naming
Rename the package file names so every release asset of one build
shares the same stem as its binary artifact, differing only by
extension:
- before: rustfs_<deb_version>_<libc>_<deb_arch>.deb
rustfs-<libc>-<rpm_version>-<rpm_release>.<rpm_arch>.rpm
- after: rustfs-linux-<arch>-<libc>-v<version>.deb / .rpm
e.g. rustfs-linux-x86_64-gnu-v1.0.0.zip,
rustfs-linux-x86_64-gnu-v1.0.0.deb,
rustfs-linux-x86_64-gnu-v1.0.0.rpm.
Non-development builds embed the raw release tag (with 'v'), like the
zips; development builds embed dev-<full sha>. The dpkg/rpm versions
(including the '~' prerelease ordering) are unchanged - they live in
the package metadata, and a side effect is that release asset names no
longer contain '~' (which GitHub normalizes to '.').
package_versions.sh now takes the target arch (x86_64|aarch64) instead
of the deb/rpm arch pair; the deb Architecture (amd64/arm64) in the
control metadata still comes from the workflow matrix. The two test
workflows that assemble deb download URLs from a release tag
(rustfs-table-test, rustfs-upgrade-test) are updated to the new name,
which also removes their '~'-to-'.' asset name workaround.
124 lines
4.6 KiB
Bash
Executable File
124 lines
4.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright 2024 RustFS Team
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
set -euo pipefail
|
|
|
|
fail() {
|
|
printf 'package_versions: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
if [[ $# -ne 5 ]]; then
|
|
fail "expected BUILD_TYPE SOURCE_VERSION DEV_SEQUENCE ARCH LIBC"
|
|
fi
|
|
|
|
build_type=$1
|
|
source_version=$2
|
|
dev_sequence=$3
|
|
arch=$4
|
|
libc=$5
|
|
|
|
case "$arch" in
|
|
x86_64 | aarch64) ;;
|
|
*) fail "unsupported architecture (expected x86_64 or aarch64)" ;;
|
|
esac
|
|
|
|
# The libc variant of the binary being packaged. It only distinguishes the
|
|
# package FILE names (gnu and musl builds of the same version would otherwise
|
|
# collide on the release); the dpkg/rpm package identity stays plain "rustfs"
|
|
# so the two variants remain mutually exclusive upgrades, not co-installable
|
|
# packages.
|
|
case "$libc" in
|
|
gnu | musl) ;;
|
|
*) fail "unsupported libc variant (expected gnu or musl)" ;;
|
|
esac
|
|
|
|
semver_core='(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)'
|
|
prerelease_id='(alpha|beta|rc)\.(0|[1-9][0-9]*)'
|
|
# Every SemVer pre-release separator becomes '~' in both package formats.
|
|
# dpkg and rpm (>= 4.10) both treat '~' as "sorts before anything, even the
|
|
# empty string", so 1.0.0~rc.5 < 1.0.0 and 1.0.0~rc.5~preview.2 < 1.0.0~rc.5.
|
|
# Neither '_' (an ordinary rpm segment separator, which makes 1.0.0_rc.5 sort
|
|
# above 1.0.0) nor a second '-' (which dpkg reads as the start of the Debian
|
|
# revision, so 1.0.0~rc.5-preview.2 sorts above 1.0.0~rc.5) preserves the
|
|
# SemVer ordering. GitHub stores '~' in asset names as '.'; package.yml
|
|
# accounts for that when it writes the release checksums.
|
|
tilde='~'
|
|
|
|
case "$build_type" in
|
|
development)
|
|
[[ -n "$dev_sequence" && "$dev_sequence" =~ ^[1-9][0-9]*$ ]] ||
|
|
fail "development sequence must be a positive decimal integer"
|
|
[[ "$source_version" =~ ^dev-([0-9a-f]{40})$ ]] ||
|
|
fail "development source version must be dev- followed by a 40-character lowercase SHA"
|
|
|
|
source_sha=${BASH_REMATCH[1]}
|
|
deb_version="0~dev.${dev_sequence}.${source_sha}"
|
|
rpm_version=0
|
|
rpm_release="0.dev.${dev_sequence}.${source_sha}"
|
|
;;
|
|
release)
|
|
[[ -z "$dev_sequence" ]] || fail "release must not have a development sequence"
|
|
[[ "$source_version" =~ ^${semver_core}$ ]] ||
|
|
fail "release version must be strict MAJOR.MINOR.PATCH"
|
|
|
|
deb_version=$source_version
|
|
rpm_version=$source_version
|
|
rpm_release=1
|
|
;;
|
|
prerelease)
|
|
[[ -z "$dev_sequence" ]] || fail "prerelease must not have a development sequence"
|
|
[[ "$source_version" =~ ^${semver_core}-${prerelease_id}$ ]] ||
|
|
fail "prerelease version must be strict alpha, beta, or rc SemVer"
|
|
|
|
deb_version=${source_version//-/$tilde}
|
|
rpm_version=${source_version//-/$tilde}
|
|
rpm_release=1
|
|
;;
|
|
preview)
|
|
[[ -z "$dev_sequence" ]] || fail "preview must not have a development sequence"
|
|
[[ "$source_version" =~ ^${semver_core}-${prerelease_id}-preview\.(0|[1-9][0-9]*)$ ]] ||
|
|
fail "preview version must be strict prerelease-preview SemVer"
|
|
|
|
deb_version=${source_version//-/$tilde}
|
|
rpm_version=${source_version//-/$tilde}
|
|
rpm_release=1
|
|
;;
|
|
*) fail "unsupported build type" ;;
|
|
esac
|
|
|
|
# Package file names mirror the binary artifact names, whose zips are named
|
|
# rustfs-linux-<arch>-<libc>-<version>.zip: all release assets of one build
|
|
# share the same stem and differ only by extension. Non-development builds
|
|
# embed the raw release tag after the 'v' marker exactly like the zips;
|
|
# development builds embed dev-<sha> (zips use the short SHA, packages the
|
|
# full one). The dpkg/rpm versions with their '~' prerelease ordering live
|
|
# in the package metadata above and are independent of the file name.
|
|
case "$build_type" in
|
|
development)
|
|
package_stem="rustfs-linux-${arch}-${libc}-dev-${source_sha}"
|
|
;;
|
|
*)
|
|
package_stem="rustfs-linux-${arch}-${libc}-v${source_version}"
|
|
;;
|
|
esac
|
|
deb_file="${package_stem}.deb"
|
|
rpm_file="${package_stem}.rpm"
|
|
|
|
# Emit only after every input and derived value has been validated. Consumers
|
|
# may append this fixed five-line protocol directly to GITHUB_OUTPUT.
|
|
printf 'deb_version=%s\nrpm_version=%s\nrpm_release=%s\ndeb_file=%s\nrpm_file=%s\n' \
|
|
"$deb_version" "$rpm_version" "$rpm_release" "$deb_file" "$rpm_file"
|