diff --git a/src/bin/poudriere-bulk.8 b/src/bin/poudriere-bulk.8 index 5916c6331f..b4d9dbd463 100644 --- a/src/bin/poudriere-bulk.8 +++ b/src/bin/poudriere-bulk.8 @@ -28,7 +28,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd December 9, 2019 +.Dd April 13, 2020 .Dt POUDRIERE-BULK 8 .Os .Sh NAME @@ -39,7 +39,7 @@ .Cm bulk .Fl a .Fl j Ar name -.Op Fl CcFIikNnRrSTtvw +.Op Fl CcFHIikNnRrSTtvw .Op Fl B Ar name .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs .Op Fl O Ar overlays @@ -49,7 +49,7 @@ .Cm bulk .Fl f Ar file Op Oo Fl f Ar file2 Oc Ar ... .Fl j Ar name -.Op Fl CcFIikNnRrSTtvw +.Op Fl CcFHIikNnRrSTtvw .Op Fl B Ar name .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs .Op Fl O Ar overlays @@ -58,7 +58,7 @@ .Nm poudriere .Cm bulk .Fl j Ar name -.Op Fl CcFIikNnRrSTtvw +.Op Fl CcFHIikNnRrSTtvw .Op Fl B Ar name .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs .Op Fl O Ar overlays @@ -135,6 +135,8 @@ Fetch only from the original Skip .Fx mirrors. +.It Fl H +Create a repository where the package filenames contain the short hash of the contents. .It Fl i Interactive mode. .Pp diff --git a/src/share/poudriere/bulk.sh b/src/share/poudriere/bulk.sh index 0800c05a0e..01e647906b 100755 --- a/src/share/poudriere/bulk.sh +++ b/src/share/poudriere/bulk.sh @@ -42,6 +42,8 @@ Options: -f file. Implies -c for -a. -c -- Clean all the previously built binary packages and logs. -F -- Only fetch from original master_site (skip FreeBSD mirrors) + -H -- Create a repository where the package filenames contain the + short hash of the contents. -I -- Advanced Interactive mode. Leaves jail running with ports installed after test. -i -- Interactive mode. Enter jail for interactive testing and @@ -92,7 +94,7 @@ OVERLAYS="" [ $# -eq 0 ] && usage -while getopts "aB:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do +while getopts "aB:CcFf:HiIj:J:knNO:p:RrSTtvwz:" FLAG; do case "${FLAG}" in a) ALL=1 @@ -116,6 +118,9 @@ while getopts "aB:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do OPTARG="${SAVED_PWD}/${OPTARG}" LISTPKGS="${LISTPKGS} ${OPTARG}" ;; + H) + PKG_REPO_FLAGS="${PKG_REPO_FLAGS} --hash --symlink" + ;; I) INTERACTIVE_MODE=2 ;; diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index e35f8c2728..7839c740d4 100644 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -4862,6 +4862,9 @@ delete_pkg() { [ $# -ne 1 ] && eargs delete_pkg pkg local pkg="$1" + # If ${pkg} is a symlink, delete the target as well + [ -L "${pkg}" ] && unlink $(realpath "${pkg}") + # Delete the package and the depsfile since this package is being deleted, # which will force it to be recreated unlink "${pkg}" @@ -4880,6 +4883,7 @@ delete_pkg_xargs() { # Delete the package and the depsfile since this package is being deleted, # which will force it to be recreated { + [ -L "${pkg}" ] && echo $(realpath "${pkg}") echo "${pkg}" echo "${pkg_cache_dir}" } >> "${listfile}" @@ -7676,11 +7680,18 @@ 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 install -m 0400 ${PKG_REPO_SIGNING_KEY} \ ${MASTERMNT}/tmp/repo.key - injail ${PKG_BIN} repo -o /tmp/packages \ + injail ${PKG_BIN} repo ${PKG_REPO_FLAGS} -o /tmp/packages \ ${PKG_META} \ /packages /tmp/repo.key unlink ${MASTERMNT}/tmp/repo.key @@ -7688,12 +7699,12 @@ build_repo() { # Sometimes building repo from host is needed if # using SSH with DNSSEC as older hosts don't support # it. - ${MASTERMNT}${PKG_BIN} repo \ + ${MASTERMNT}${PKG_BIN} repo ${PKG_REPO_FLAGS} \ -o ${MASTERMNT}/tmp/packages ${PKG_META_MASTERMNT} \ ${MASTERMNT}/packages \ ${SIGNING_COMMAND:+signing_command: ${SIGNING_COMMAND}} else - JNETNAME="n" injail ${PKG_BIN} repo \ + JNETNAME="n" injail ${PKG_BIN} repo ${PKG_REPO_FLAGS} \ -o /tmp/packages ${PKG_META} /packages \ ${SIGNING_COMMAND:+signing_command: ${SIGNING_COMMAND}} fi @@ -7707,6 +7718,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() { diff --git a/src/share/poudriere/pkgclean.sh b/src/share/poudriere/pkgclean.sh old mode 100755 new mode 100644 index add08c6630..5acd417114 --- a/src/share/poudriere/pkgclean.sh +++ b/src/share/poudriere/pkgclean.sh @@ -176,13 +176,16 @@ for file in ${PACKAGES}/All/*; do pkgname="${pkgname%.*}" if ! pkg_get_origin origin "${file}"; then msg_verbose "Found corrupt package: ${file}" + [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} echo "${file}" >> ${BADFILES_LIST} elif shash_remove pkgname-forbidden "${pkgname}" \ forbidden; then msg_verbose "Found forbidden package (${forbidden}): ${file}" + [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} echo "${file}" >> ${BADFILES_LIST} elif ! pkgbase_is_needed "${pkgname}"; then msg_verbose "Found unwanted package: ${file}" + [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} echo "${file}" >> ${BADFILES_LIST} else echo "${file} ${origin}" >> ${FOUND_ORIGINS} @@ -190,6 +193,7 @@ for file in ${PACKAGES}/All/*; do ;; *) msg_verbose "Found incorrect format file: ${file}" + [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} echo "${file}" >> ${BADFILES_LIST} ;; esac @@ -239,6 +243,7 @@ END { for pkg in $packages; do pkgversion="${pkg##*-}" pkgversion="${pkgversion%.*}" + pkgversion="${pkgversion%~*}" if [ -z "${lastpkg}" ]; then lastpkg="${pkg}"