diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2020-11-05 00:46:47 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2021-05-07 02:26:43 +0300 |
commit | 68b3911f8b4cd5d3dd79335b61e4a94c1f40f1db (patch) | |
tree | 5b11b74319a9af209875bea82f82e06289810271 | |
parent | ee0300b8c35658e768adb4821a672405a52f5f65 (diff) |
bulk: implement small_repothin-repositories
Unlike thin repo the small repos also includes the runtime dependencies
and the pkg itself.
-rwxr-xr-x | src/share/poudriere/bulk.sh | 14 | ||||
-rw-r--r-- | src/share/poudriere/common.sh | 33 |
2 files changed, 42 insertions, 5 deletions
diff --git a/src/share/poudriere/bulk.sh b/src/share/poudriere/bulk.sh index 3ae357e6..7a0b6397 100755 --- a/src/share/poudriere/bulk.sh +++ b/src/share/poudriere/bulk.sh @@ -57,6 +57,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. @@ -91,6 +93,7 @@ CLEAN_LISTED=0 DRY_RUN=0 ALL=0 THIN_REPO=0 +SMALL_REPO=0 BUILD_REPO=1 INTERACTIVE_MODE=0 OVERLAYS="" @@ -98,7 +101,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 @@ -143,6 +146,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 ;; @@ -199,8 +206,11 @@ while getopts "ab:B:CcFf:iIj:J:kmnNO:p:RrSTtvwz:" FLAG; do esac done +if [ ${ALL} -eq 1 -a ${SMALL_REPO} -eq 1 ]; then + err 1 "incompatible options: both -a and -M are provided" +fi if [ ${ALL} -eq 1 -a ${THIN_REPO} -eq 1 ]; then - err 1 "incompatible options: bith -a and -m are provided" + 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 21079314..b0969b65 100644 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -2647,7 +2647,12 @@ jail_start() { # do_portbuild_mounts depends on PACKAGES being set. # 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 do_portbuild_mounts ${tomnt} ${name} ${ptname} ${setname} @@ -7810,16 +7815,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 @@ -7834,7 +7861,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" @@ -7845,6 +7871,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 |