Support for hashed mode to poudriere

This commit is contained in:
2024-06-05 15:24:04 +02:00
parent cdd5fb7b20
commit 734ab5e5e9
11 changed files with 657 additions and 0 deletions

View File

@ -0,0 +1,77 @@
--- src/share/poudriere/common.sh.orig 2024-04-24 15:38:18 UTC
+++ src/share/poudriere/common.sh
@@ -9468,12 +9468,16 @@ build_repo() {
}
build_repo() {
- local origin pkg_repo_list_files
+ local origin pkg_repo_list_files hashcmd
msg "Creating pkg repository"
if [ ${DRY_RUN} -eq 1 ]; then
return 0
fi
+ if [ ${PKG_HASH} != "no" ]; then
+ hashcmd="--hash --symlink"
+ PKG_REPO_FLAGS="${PKG_REPO_FLAGS:+${PKG_REPO_FLAGS} }$hashcmd"
+ fi
bset status "pkgrepo:"
ensure_pkg_installed force_extract || \
err 1 "Unable to extract pkg."
@@ -9493,12 +9497,20 @@ build_repo() {
install -m 0400 "${PKG_REPO_META_FILE}" \
"${MASTERMNT:?}/tmp/pkgmeta"
fi
+
+ # Remount rw
+ # mount_nullfs does not support mount -u
+ umount ${UMOUNT_NONBUSY} ${MASTERMNT}/packages || \
+ umount -f ${MASTERMNT}/packages
+ mount_packages
+
mkdir -p ${MASTERMNT}/tmp/packages
if [ -n "${PKG_REPO_SIGNING_KEY}" ]; then
msg "Signing repository with key: ${PKG_REPO_SIGNING_KEY}"
install -m 0400 "${PKG_REPO_SIGNING_KEY}" \
"${MASTERMNT:?}/tmp/repo.key"
injail ${PKG_BIN:?} repo \
+ ${PKG_REPO_FLAGS} \
${pkg_repo_list_files:+"${pkg_repo_list_files}"} \
-o /tmp/packages \
${PKG_META} \
@@ -9515,6 +9527,7 @@ build_repo() {
# using SSH with DNSSEC as older hosts don't support
# it.
${MASTERMNT:?}${PKG_BIN:?} repo \
+ ${PKG_REPO_FLAGS} \
${pkg_repo_list_files:+"${pkg_repo_list_files}"} \
-o "${MASTERMNT:?}/tmp/packages" ${PKG_META_MASTERMNT} \
"${MASTERMNT:?}/packages" \
@@ -9527,6 +9540,7 @@ build_repo() {
;;
esac
JNETNAME="n" injail ${PKG_BIN:?} repo \
+ ${PKG_REPO_FLAGS} \
${pkg_repo_list_files:+"${pkg_repo_list_files}"} \
-o /tmp/packages ${PKG_META} /packages \
${SIGNING_COMMAND:+signing_command: ${SIGNING_COMMAND}} ||
@@ -9542,6 +9556,11 @@ build_repo() {
sign_pkg pubkey "${PACKAGES:?}/Latest/pkg.${PKG_EXT}"
fi
fi
+
+ # Remount ro
+ umount ${UMOUNT_NONBUSY} ${MASTERMNT}/packages || \
+ umount -f ${MASTERMNT}/packages
+ mount_packages -o ro
}
calculate_size_in_mb() {
@@ -10109,6 +10128,7 @@ esac
: ${FLAVOR_DEFAULT_ALL:=no}
: ${NULLFS_PATHS:="/rescue /usr/share /usr/tests /usr/lib32"}
: ${PACKAGE_FETCH_URL:="pkg+http://pkg.FreeBSD.org/\${ABI}"}
+: ${PKG_HASH:=no}
: ${POUDRIERE_TMPDIR:=$(command mktemp -dt poudriere)}
: ${SHASH_VAR_PATH_DEFAULT:=${POUDRIERE_TMPDIR}}