Skip to content

Commit

Permalink
Bootstrap hybrid ABI pkg when starting a jail
Browse files Browse the repository at this point in the history
The hybrid ABI package manager should be bootstrapped when a jail is
started to provide it to both poudriere bulk and poudriere jail -s
operations.

Having it available for poudriere jail -s, we can manually build
CheriABI packages using hybrid ABI utilities to debug building issues.
  • Loading branch information
kwitaszczyk committed Sep 5, 2023
1 parent 3d222b1 commit e88ac9d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/share/poudriere/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,7 @@ jail_start() {

if [ "${os}" = "CheriBSD" ]; then
download_toolchain_from_repo
download_hybridset_pkg_from_repo
fi

msg "Starting jail ${MASTERNAME}"
Expand Down Expand Up @@ -3769,6 +3770,31 @@ download_toolchain_from_repo() {
hybridset_pkgcmd "${MASTERMNT}" "/toolchain" clean -aq
}

download_hybridset_pkg_from_repo() {
local arch host_abi pkgabi pkgcmd

msg "Bootstrapping hybrid ABI pkg."

hybridset_pkgcmd "${MASTERMNT}" "/" install -q pkg
hybridset_pkgcmd "${MASTERMNT}" "/" update -q

get_host_abi host_abi
if [ "${host_abi}" = "purecap" ]; then
pkgcmd="pkg64"
else
pkgcmd="pkg"
fi

pkgabi=$(${pkgcmd} config ABI)

This comment has been minimized.

Copy link
@jrtc27

jrtc27 Nov 15, 2023

Member

This gets the ABI of the host system not the jail, so you get the wrong package set in the jail if the two are different (e.g. building 22.12 packages on a dev host)

This comment has been minimized.

Copy link
@jrtc27

jrtc27 Nov 15, 2023

Member

This is particularly noticeable because the pkg that gets bootstrapped will be linked against the wrong libssl version

This comment has been minimized.

Copy link
@jrtc27

jrtc27 Nov 15, 2023

Member

Maybe this is trying to deal with some weird special qemu-user native case, but that needs to be opt-in behaviour, not the default, because native jails need to work correctly when the ABI version doesn't match.

This comment has been minimized.

Copy link
@kwitaszczyk

kwitaszczyk Dec 11, 2023

Author Member

Yes, that was to handle the case we install replacement ("hybrid ABI") packages on FreeBSD. Thanks for noticing and handling it in #3 . I haven't tested 23.11 jails on a 22.12 host and I should remember to do that in the future.

if [ -z "${pkgabi}" ]; then
err 1 "Failure looking up host pkg ABI"
fi

# Update pkg.conf to use the host ABI for hybrid ABI packages.
sed -i '' "s/^#ABI = .*$/ABI=${pkgabi}/" \
"${MASTERMNT}/usr/local64/etc/pkg.conf"
}

download_hybridset_from_repo() {
local oldpkgname pkgname

Expand Down

0 comments on commit e88ac9d

Please sign in to comment.