--- src/share/poudriere/common.sh.orig 2024-08-11 06:43:13 UTC +++ src/share/poudriere/common.sh @@ -6626,6 +6626,10 @@ _delete_old_pkg() { if [ -L "${pkg}" ]; then is_sym=1 fi + if [ -d "${pkg}" ] && [ "${pkgfile}" = "Hashed" ]; then + msg_debug "Ignoring directory" + return 0; + fi if [ "${is_sym}" -eq 1 ] && [ ! -e "${pkg}" ]; then msg "Deleting ${COLOR_PORT}${pkgfile}${COLOR_RESET}: dead symlink" delete_pkg "${pkg}" @@ -9835,12 +9839,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." @@ -9860,12 +9868,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} \ @@ -9882,6 +9898,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" \ @@ -9894,6 +9911,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}} || @@ -9909,6 +9927,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() { @@ -10477,6 +10500,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}}