diff --git a/src/share/poudriere/bulk.sh b/src/share/poudriere/bulk.sh index 915ae6dfeb..871b93589b 100755 --- a/src/share/poudriere/bulk.sh +++ b/src/share/poudriere/bulk.sh @@ -56,6 +56,8 @@ Options: fatal; don't skip dependent ports on findings. -m -- minimal repository, only create a repository with the listed packages, incompatible with -a. + -M -- medium repository, only create a repository with the listed + packages and their runtime dependencies, incompatible with -a. -N -- Do not build package repository when build completed -n -- Dry-run. Show what will be done, but do not build any packages. @@ -90,6 +92,7 @@ CLEAN_LISTED=0 DRY_RUN=0 ALL=0 THIN_REPO=0 +SMALL_REPO=0 BUILD_REPO=1 INTERACTIVE_MODE=0 OVERLAYS="" @@ -97,7 +100,7 @@ OVERLAYS="" [ $# -eq 0 ] && usage -while getopts "ab:B:CcFf:iIj:J:kmnNO:p:RrSTtvwz:" FLAG; do +while getopts "ab:B:CcFf:iIj:J:kmnMNO:p:RrSTtvwz:" FLAG; do case "${FLAG}" in a) ALL=1 @@ -146,6 +149,10 @@ while getopts "ab:B:CcFf:iIj:J:kmnNO:p:RrSTtvwz:" FLAG; do k) PORTTESTING_FATAL=no ;; + M) + SMALL_REPO=1 + THIN_REPO=1 + ;; m) THIN_REPO=1 ;; @@ -202,8 +209,11 @@ while getopts "ab:B:CcFf:iIj:J:kmnNO:p:RrSTtvwz:" FLAG; do esac done -if [ ${ALL} -eq 1 -a ${THIN_REPO} -eq 1 ]; then - err 1 "incompatible options: bith -a and -m are provided" +if [ ${ALL} -eq 1 -a ${THIN_REPO} -eq 1 -a ${SMALL_REPO} -eq 0 ]; then + err 1 "incompatible options: both -a and -m are provided" +fi +if [ ${ALL} -eq 1 -a ${THIN_REPO} -eq 1 -a ${SMALL_REPO} -eq 1 ]; then + err 1 "incompatible options: both -a and -M are provided" fi if [ ${ALL} -eq 1 -a ${CLEAN_LISTED} -eq 1 ]; then CLEAN=1 diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index 582ef6f90b..6f11feb0de 100644 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -2595,7 +2595,12 @@ jail_start() { # May already be set for pkgclean : ${PACKAGES:=${POUDRIERE_DATA}/packages/${MASTERNAME}} - : ${THIN_PACKAGES:=${POUDRIERE_DATA}/packages/${MASTERNAME}-thin} + if [ ${SMALL_REPO} -eq 1 ]; then + THIN_EXT=-small + else + THIN_EXT=-thin + fi + : ${THIN_PACKAGES:=${POUDRIERE_DATA}/packages/${MASTERNAME}${THIN_EXT}} mkdir -p ${PACKAGES}/ was_a_bulk_run && stash_packages @@ -7702,16 +7707,38 @@ sign_pkg() { fi } +add_pkg_to_repo() { + local pkgname=$1 + local target=$2 + [ -f ${target}/${pkgname}.${PKG_EXT} ] && return + if [ ${SMALL_REPO} -eq 1 ]; then + for dep in $(injail ${PKG_BIN} info -qd -F /packages/All/${pkgname}.${PKG_EXT}); do + add_pkg_to_repo ${dep} ${target} + done + fi + cp ${PACKAGES}/All/${pkgname}.${PKG_EXT} ${target}/ +} + build_thin_repo() { # Try to be as atomic as possible in recreating the new thin repo mkdir -p ${THIN_PACKAGES}/All.new while mapfile_read_loop "all_pkgs" \ _pkgname _originspec _rdep _ignore; do if [ "${_rdep}" = "listed" ] ; then - cp ${PACKAGES}/All/${_pkgname}.${PKG_EXT} \ + add_pkg_to_repo ${_pkgname} \ ${THIN_PACKAGES}/All.new fi done + if [ ${SMALL_REPO} -eq 1 ]; then + cp ${PACKAGES}/All/pkg-*.txz ${THIN_PACKAGES}/All.new + fi + if [ -d "${THIN_PACKAGES}/Latest" ]; then + rm -rf "${THIN_PACKAGES}/Latest" + if [ ${SMALL_REPO} -eq 1 ]; then + mkdir ${THIN_PACKAGES}/Latest + cp -RP ${PACKAGES}/Latest/pkg.${PKG_EXT} ${THIN_PACKAGES}/Latest + fi + fi if [ -d "${THIN_PACKAGES}/All" ]; then mv ${THIN_PACKAGES}/All ${THIN_PACKAGES}/All.old fi @@ -7726,7 +7753,6 @@ build_repo() { if [ ${THIN_REPO} -eq 1 ]; then msg "Creating thin pkg repository" - build_thin_repo packages=${THIN_PACKAGES} else msg "Creating pkg repository" @@ -7737,6 +7763,7 @@ build_repo() { ensure_pkg_installed force_extract || \ err 1 "Unable to extract pkg." if [ ${THIN_REPO} -eq 1 ]; then + build_thin_repo # only overwrite the packages repo with the thin one # after having extracted pkg because pkg might not # be on the thin repo