Skip to content

Commit

Permalink
Fix package distribution. Specify OS explicitly (#4434) (#4435)
Browse files Browse the repository at this point in the history
* Pass OS information explicitly to package-distribution

* libssl3 variants for ubuntu24.04

* detail flag for time64
  • Loading branch information
ami-GS authored Aug 7, 2024
1 parent d0a3330 commit 343c8bf
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions .azure/obtemplates/build-linux-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
inputs:
pwsh: false
filePath: scripts/package-distribution.ps1
arguments: -OS $(os)
- script: | # prepare 2 sets of packages for signing with different keys (gen = general purpose, cbl = cbl-mariner)
mkdir $(Build.SourcesDirectory)/artifacts/dist/gen
find $(Build.SourcesDirectory)/artifacts/dist -type f -exec mv -t $(Build.SourcesDirectory)/artifacts/dist/gen/ {} +
Expand Down
29 changes: 21 additions & 8 deletions scripts/make-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ CONFIG=Release
NAME=libmsquic
TLS=openssl
TLSVERSION=1.1
UBUNTU=
TIME64DISTRO="False"
XDP="False"
CONFLICTS=
DESCRIPTION="Microsoft implementation of the IETF QUIC protocol"
VENDOR="Microsoft"
Expand Down Expand Up @@ -86,9 +87,13 @@ while :; do
shift
OUTPUT=$1
;;
-u|-ubuntu|--ubuntu)
-x|-xdp|--xdp)
shift
UBUNTU=$1
XDP=$1
;;
-time64|--time64)
shift
TIME64DISTRO=$1
;;
-t|-tls|--tls)
shift
Expand Down Expand Up @@ -134,8 +139,9 @@ echo "ARCH=$ARCH PKGARCH=$PKGARCH ARTIFACTS=$ARTIFACTS"
mkdir -p ${OUTPUT}

if [ "$OS" == "linux" ]; then
# Ubuntu 24.04 dependencies are not fully validated on redhat/centos etc.
if [ "$UBUNTU" != '2404' ]; then
# XDP is only validated on Ubuntu 24.04 and x64
if [ "$XDP" == "False" ] || [[ "$ARCH" == arm* ]]; then
echo "Building rpm package"
# RedHat/CentOS
FILES="${ARTIFACTS}/libmsquic.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}=/usr/${LIBDIR}/libmsquic.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}"
FILES="${FILES} ${ARTIFACTS}/libmsquic.${LIBEXT}.${VER_MAJOR}=/usr/${LIBDIR}/libmsquic.${LIBEXT}.${VER_MAJOR}"
Expand Down Expand Up @@ -183,7 +189,13 @@ if [ "$OS" == "linux" ]; then
FILES="${FILES} ${ARTIFACTS}/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}=/usr/${LIBDIR}/libmsquic.lttng.${LIBEXT}.${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}"
fi

if [ "$UBUNTU" == '2404' ]; then
BITS=''
if [ "$TIME64DISTRO" == "True" ]; then
BITS='t64'
fi

if [ "$XDP" == "True" ] && [[ "$ARCH" == x* ]]; then
echo "Building deb package (XDP)"
fpm \
--force \
--input-type dir \
Expand All @@ -192,7 +204,7 @@ if [ "$OS" == "linux" ]; then
--name ${NAME} \
--provides ${NAME} \
--conflicts ${CONFLICTS} \
--depends "libssl${TLSVERSION}" \
--depends "libssl${TLSVERSION}${BITS}" \
--depends "libnuma1" \
--depends "libxdp1" \
--depends "libnl-route-3-200" \
Expand All @@ -206,6 +218,7 @@ if [ "$OS" == "linux" ]; then
--log error \
${FILES} ${ARTIFACTS}/datapath_raw_xdp_kern.o=/usr/${LIBDIR}/datapath_raw_xdp_kern.o
else
echo "Building deb package"
fpm \
--force \
--input-type dir \
Expand All @@ -214,7 +227,7 @@ if [ "$OS" == "linux" ]; then
--name ${NAME} \
--provides ${NAME} \
--conflicts ${CONFLICTS} \
--depends "libssl${TLSVERSION}" \
--depends "libssl${TLSVERSION}${BITS}" \
--depends "libnuma1" \
--version ${VER_MAJOR}.${VER_MINOR}.${VER_PATCH} \
--description "${DESCRIPTION}" \
Expand Down
25 changes: 17 additions & 8 deletions scripts/package-distribution.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
#>

param (
[Parameter(Mandatory = $false)]
[ValidateSet("ubuntu_2404", "ubuntu_2204", "ubuntu_2004", "")]
[string]$OS = ""
)

$UseXdp = $false
$Time64Distro = $false
if ($OS -eq "ubuntu_2404") {
$UseXdp = $true
$Time64Distro = $true
}

Set-StrictMode -Version 'Latest'
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'

Expand Down Expand Up @@ -167,17 +180,13 @@ foreach ($Build in $AllBuilds) {
if ($BuildBaseName -like "*openssl3*") {
$Tls = "openssl3"
}
$UbuntuVersion = "none"
$match = [regex]::Match($BuildBaseName, "ubuntu_(\d{4})")
if ($match.Success) {
$UbuntuVersion = $match.Groups[1].Value
}

if ($BuildBaseName -like "*arm64_*") {
& $RootDir/scripts/make-packages.sh --output $DistDir --arch arm64 --tls $Tls --ubuntu $UbuntuVersion
& $RootDir/scripts/make-packages.sh --output $DistDir --arch arm64 --tls $Tls --xdp $UseXdp --time64 $Time64Distro
} elseif ($BuildBaseName -like "*arm_*") {
& $RootDir/scripts/make-packages.sh --output $DistDir --arch arm --tls $Tls --ubuntu $UbuntuVersion
& $RootDir/scripts/make-packages.sh --output $DistDir --arch arm --tls $Tls --xdp $UseXdp --time64 $Time64Distro
} else {
& $RootDir/scripts/make-packages.sh --output $DistDir --tls $Tls --ubuntu $UbuntuVersion # x64
& $RootDir/scripts/make-packages.sh --output $DistDir --tls $Tls --xdp $UseXdp --time64 $Time64Distro # x64
}
Set-Location $OldLoc
}
Expand Down

0 comments on commit 343c8bf

Please sign in to comment.