From 734ab5e5e97a2e7608a1dcfe5dfdf107520f84be Mon Sep 17 00:00:00 2001 From: Xavier Beaudouin Date: Wed, 5 Jun 2024 15:24:04 +0200 Subject: [PATCH] Support for hashed mode to poudriere --- ...af7ce853b83eb721906d97b737eb0c86ebf0d.diff | 229 ++++++++++++++++++ ports-mgmt/poudriere-devel/Makefile | 93 +++++++ ports-mgmt/poudriere-devel/distinfo | 3 + .../files/patch-src_etc_poudriere.conf.sample | 19 ++ .../files/patch-src_man_poudriere-bulk.8 | 47 ++++ .../files/patch-src_share_poudriere_bulk.sh | 30 +++ .../files/patch-src_share_poudriere_common.sh | 77 ++++++ .../patch-src_share_poudriere_include_pkg.sh | 22 ++ .../patch-src_share_poudriere_pkgclean.sh | 20 ++ ports-mgmt/poudriere-devel/pkg-descr | 3 + ports-mgmt/poudriere-devel/pkg-plist | 114 +++++++++ 11 files changed, 657 insertions(+) create mode 100644 ports-mgmt/poudriere-devel/094af7ce853b83eb721906d97b737eb0c86ebf0d.diff create mode 100644 ports-mgmt/poudriere-devel/Makefile create mode 100644 ports-mgmt/poudriere-devel/distinfo create mode 100644 ports-mgmt/poudriere-devel/files/patch-src_etc_poudriere.conf.sample create mode 100644 ports-mgmt/poudriere-devel/files/patch-src_man_poudriere-bulk.8 create mode 100644 ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_bulk.sh create mode 100644 ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_common.sh create mode 100644 ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_include_pkg.sh create mode 100644 ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_pkgclean.sh create mode 100644 ports-mgmt/poudriere-devel/pkg-descr create mode 100644 ports-mgmt/poudriere-devel/pkg-plist diff --git a/ports-mgmt/poudriere-devel/094af7ce853b83eb721906d97b737eb0c86ebf0d.diff b/ports-mgmt/poudriere-devel/094af7ce853b83eb721906d97b737eb0c86ebf0d.diff new file mode 100644 index 0000000..8bd2ce4 --- /dev/null +++ b/ports-mgmt/poudriere-devel/094af7ce853b83eb721906d97b737eb0c86ebf0d.diff @@ -0,0 +1,229 @@ +diff --git a/src/etc/poudriere.conf.sample b/src/etc/poudriere.conf.sample +index c0ba896d927ca1700cc78e57cb953deec43b5484..337eb1827904daba5bf5df5790d005f6e7fa3de9 100644 +--- a/src/etc/poudriere.conf.sample ++++ b/src/etc/poudriere.conf.sample +@@ -383,3 +383,16 @@ DISTFILES_CACHE=/usr/ports/distfiles + # be fetched. + # Default: everything + #PACKAGE_FETCH_WHITELIST="gcc* rust llvm*" ++ ++# Have pkg create the repo such that each package is named with the short hash ++# of its file contents in the package filename, with symlinks to the traditional ++# package filenames. The packagesite.yaml file will point to the hashed version ++# of these files. By using hashed pkg filenames, this allows users to lazily ++# cache packages without conflicting with the existing packages, or serving stale ++# packages from a cache. Once the packages are synced the much ++# smaller meta files can then be synced. Allowing a near atomic update of the repo. ++# On caching CDNs this means a need to purge 2-5 files instead of all pkgs that ++# have been updated. ++# The symlinks are only required for the local poudriere for resovling dependencies, ++# they do not need to be uploaded to the CDN. ++#PKG_HASH="no" +diff --git a/src/man/poudriere-bulk.8 b/src/man/poudriere-bulk.8 +index 81cf698eeb6670048628d83e819fd84ad433be93..dac4eb3211a9fd0afe451779449693acade24430 100644 +--- a/src/man/poudriere-bulk.8 ++++ b/src/man/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 July 5, 2022 ++.Dd September 26, 2022 + .Dt POUDRIERE-BULK 8 + .Os + .Sh NAME +@@ -38,7 +38,7 @@ + .Nm + .Fl a + .Fl j Ar name +-.Op Fl CcFIikNnRrSTtvw ++.Op Fl CcFHIikNnRrSTtvw + .Op Fl B Ar name + .Op Fl b Ar branch + .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs +@@ -48,7 +48,7 @@ + .Nm + .Fl f Ar file Op Fl f Ar file2 Ar ... + .Fl j Ar name +-.Op Fl CcFIikNnRrSTtvw ++.Op Fl CcFHIikNnRrSTtvw + .Op Fl B Ar name + .Op Fl b Ar branch + .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs +@@ -57,7 +57,7 @@ + .Op Fl z Ar set + .Nm + .Fl j Ar name +-.Op Fl CcFIikNnRrSTtvw ++.Op Fl CcFHIikNnRrSTtvw + .Op Fl B Ar name + .Op Fl b Ar branch + .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs +@@ -232,6 +232,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 + Advanced interactive mode. + .Pp +diff --git a/src/share/poudriere/bulk.sh b/src/share/poudriere/bulk.sh +index 3507ceb3548910c8aa688148614f1eadf72dd695..865d40677e5184c1bf5274d7cc3ea6f876c15491 100755 +--- a/src/share/poudriere/bulk.sh ++++ b/src/share/poudriere/bulk.sh +@@ -47,6 +47,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 +@@ -97,7 +99,7 @@ if [ $# -eq 0 ]; then + usage + fi + +-while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do ++while getopts "ab:B:CcFf:HiIj:J:knNO:p:RrSTtvwz:" FLAG; do + case "${FLAG}" in + a) + ALL=1 +@@ -126,6 +128,9 @@ while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do + fi + LISTPKGS="${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 a4907362c76000bc81fb8b7dbd61918fb7426538..841e2aefdb7981212fe44af5977f8dd0b07a6369 100755 +--- a/src/share/poudriere/common.sh ++++ b/src/share/poudriere/common.sh +@@ -9468,12 +9468,16 @@ clean_restricted() { + } + + 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}} +diff --git a/src/share/poudriere/include/pkg.sh b/src/share/poudriere/include/pkg.sh +index d4821400cb2ad20a6994a5d9145604f8081a98f6..360518520d6f1067531380ea9040ec2d1d4c1f33 100644 +--- a/src/share/poudriere/include/pkg.sh ++++ b/src/share/poudriere/include/pkg.sh +@@ -400,6 +400,10 @@ delete_pkg() { + local pkg="$1" + + clear_pkg_cache "${pkg}" ++ ++ # 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}" +@@ -417,6 +421,8 @@ delete_pkg_xargs() { + # Delete the package and the depsfile since this package is being deleted, + # which will force it to be recreated + { ++ # If ${pkg} is a symlink, delete the target as well ++ [ -L "${pkg}" ] && echo $(realpath "${pkg}") + echo "${pkg}" + echo "${pkg_cache_dir}" + } >> "${listfile}" +diff --git a/src/share/poudriere/pkgclean.sh b/src/share/poudriere/pkgclean.sh +old mode 100755 +new mode 100644 +index fafc3c0a547335ddee32033bf9d0700ccf556fca..5458d3d04dd2e05727c1c79ce0ba0d73d3946665 +--- a/src/share/poudriere/pkgclean.sh ++++ b/src/share/poudriere/pkgclean.sh +@@ -289,6 +289,8 @@ check_should_delete_pkg() { + *".${PKG_EXT}") + if should_delete "${file}"; then + echo "${file}" >> "${BADFILES_LIST:?}" ++ # If the pkg is a symlink to a hashed package, remove the hashed version as well ++ [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} + fi + ;; + *.txz) +@@ -305,6 +307,8 @@ check_should_delete_pkg() { + *) + msg_verbose "Found incorrect format file: ${file}" + echo "${file}" >> "${BADFILES_LIST:?}" ++ # If the pkg is a symlink to a hashed package, remove the hashed version as well ++ [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} + ;; + esac + } diff --git a/ports-mgmt/poudriere-devel/Makefile b/ports-mgmt/poudriere-devel/Makefile new file mode 100644 index 0000000..86dbb90 --- /dev/null +++ b/ports-mgmt/poudriere-devel/Makefile @@ -0,0 +1,93 @@ +PORTNAME= poudriere +DISTVERSION= 3.4.99.20240424 +PORTREVISION= 1 +CATEGORIES= ports-mgmt +MASTER_SITES= LOCAL/bdrewery/${PORTNAME}/ \ + http://mirror.shatow.net/freebsd/${PORTNAME}/ \ + GH +PKGNAMESUFFIX= -devel + +MAINTAINER= bdrewery@FreeBSD.org +COMMENT= Port build and test system +WWW= https://github.com/freebsd/poudriere/wiki + +LICENSE= BSD2CLAUSE + +CONFLICTS_INSTALL= poudriere + +USE_GITHUB= yes +GH_ACCOUNT= freebsd +GH_TAGNAME= 3.3.0-1748-gd75f4e1dc4 + +GNU_CONFIGURE= yes +ETCDIR= ${PREFIX}/etc/poudriere.d + +OPTIONS_DEFINE= BASH MANIFESTS PORTCONFIG EXAMPLES QEMU ZSH +OPTIONS_DEFAULT=BASH MANIFESTS PORTCONFIG ZSH +OPTIONS_SUB= yes + +MANIFESTS_DESC= Install manifests for jail creation +MANIFESTS_RUN_DEPENDS+= freebsd-release-manifests>0:misc/freebsd-release-manifests + +PORTCONFIG_DESC= Install portconfig for options command +PORTCONFIG_RUN_DEPENDS= portconfig>0:ports-mgmt/portconfig + +QEMU_DESC= Add qemu-user-static for non-x86 architectures +QEMU_RUN_DEPENDS= qemu-user-static>0:emulators/qemu-user-static + + +# gmake is not strictly needed but handles test jobs better +TEST_DEPENDS= gmake>0:devel/gmake +TEST_ENV= MAKE=gmake +.if make(test) +MAKE_CMD= gmake +.endif +TEST_TARGET= check +TEST_ARGS= -s +TEST_ARGS+= ${_MAKE_JOBS} +# ccache passthrough helps for building pkg a few hundred times. +# ccache not added as a dependency because it is only used if setup +# and provided in the env already. +# XXX: Passthrough local PKGREPOSITORY dir for fetch support +ccache_vars= CCACHE_DIR_NON_ROOT_SAFE CCACHE_GROUP \ + CCACHE_GID CCACHE_STATIC_PREFIX CCACHE_TEMPDIR \ + CCACHE_DIR CCACHE_NLEVELS +.for _cv in ${ccache_vars} +. if !empty(${_cv}) +TEST_ENV+= ${_cv}=${${_cv}} +. endif +.endfor + +.include + +# rm -x support came in 10.0. A bundled rm is used if not supported in base. +# While <10 is technically not supported in the Ports Tree, Poudriere +# detects this and it being a package build tool it should still be +# supported as a user may be installing this to build packages for upgrading +# their system to a supported release. +.if ${OSVERSION} < 1000000 +PLIST_SUB+= RM="" +.else +PLIST_SUB+= RM="@comment " +.endif + +post-patch: + ${REINPLACE_CMD} \ + -e "s,^\(POUDRIERE_VERSION\)=.*,\1='${PKGVERSION}'," \ + ${WRKSRC}/src/bin/poudriere.in + +post-install: + ${LN} -fs ${LOCALBASE}/share/freebsd/MANIFESTS \ + ${STAGEDIR}${DATADIR}/MANIFESTS + +post-install-BASH-on: + @${MKDIR} ${STAGEDIR}${PREFIX}/share/bash-completion/completions/ + ${INSTALL_DATA} ${WRKSRC}/completions/bash/poudriere \ + ${STAGEDIR}${PREFIX}/share/bash-completion/completions/ + +post-install-ZSH-on: + @${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions/ + ${INSTALL_DATA} ${WRKSRC}/completions/zsh/_poudriere \ + ${STAGEDIR}${PREFIX}/share/zsh/site-functions/ + +.include diff --git a/ports-mgmt/poudriere-devel/distinfo b/ports-mgmt/poudriere-devel/distinfo new file mode 100644 index 0000000..bab079f --- /dev/null +++ b/ports-mgmt/poudriere-devel/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1713973208 +SHA256 (freebsd-poudriere-3.4.99.20240424-3.3.0-1748-gd75f4e1dc4_GH0.tar.gz) = 9f1b2f32fa4885819085ed623d91215f63754b9cde8b8da297b8ad0db8756280 +SIZE (freebsd-poudriere-3.4.99.20240424-3.3.0-1748-gd75f4e1dc4_GH0.tar.gz) = 5732259 diff --git a/ports-mgmt/poudriere-devel/files/patch-src_etc_poudriere.conf.sample b/ports-mgmt/poudriere-devel/files/patch-src_etc_poudriere.conf.sample new file mode 100644 index 0000000..db0b1d5 --- /dev/null +++ b/ports-mgmt/poudriere-devel/files/patch-src_etc_poudriere.conf.sample @@ -0,0 +1,19 @@ +--- src/etc/poudriere.conf.sample.orig 2024-04-24 15:38:18 UTC ++++ src/etc/poudriere.conf.sample +@@ -383,3 +383,16 @@ DISTFILES_CACHE=/usr/ports/distfiles + # be fetched. + # Default: everything + #PACKAGE_FETCH_WHITELIST="gcc* rust llvm*" ++ ++# Have pkg create the repo such that each package is named with the short hash ++# of its file contents in the package filename, with symlinks to the traditional ++# package filenames. The packagesite.yaml file will point to the hashed version ++# of these files. By using hashed pkg filenames, this allows users to lazily ++# cache packages without conflicting with the existing packages, or serving stale ++# packages from a cache. Once the packages are synced the much ++# smaller meta files can then be synced. Allowing a near atomic update of the repo. ++# On caching CDNs this means a need to purge 2-5 files instead of all pkgs that ++# have been updated. ++# The symlinks are only required for the local poudriere for resovling dependencies, ++# they do not need to be uploaded to the CDN. ++#PKG_HASH="no" diff --git a/ports-mgmt/poudriere-devel/files/patch-src_man_poudriere-bulk.8 b/ports-mgmt/poudriere-devel/files/patch-src_man_poudriere-bulk.8 new file mode 100644 index 0000000..bcf4dff --- /dev/null +++ b/ports-mgmt/poudriere-devel/files/patch-src_man_poudriere-bulk.8 @@ -0,0 +1,47 @@ +--- src/man/poudriere-bulk.8.orig 2024-04-24 15:38:18 UTC ++++ src/man/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 July 5, 2022 ++.Dd September 26, 2022 + .Dt POUDRIERE-BULK 8 + .Os + .Sh NAME +@@ -38,7 +38,7 @@ + .Nm + .Fl a + .Fl j Ar name +-.Op Fl CcFIikNnRrSTtvw ++.Op Fl CcFHIikNnRrSTtvw + .Op Fl B Ar name + .Op Fl b Ar branch + .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs +@@ -48,7 +48,7 @@ + .Nm + .Fl f Ar file Op Fl f Ar file2 Ar ... + .Fl j Ar name +-.Op Fl CcFIikNnRrSTtvw ++.Op Fl CcFHIikNnRrSTtvw + .Op Fl B Ar name + .Op Fl b Ar branch + .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs +@@ -57,7 +57,7 @@ + .Op Fl z Ar set + .Nm + .Fl j Ar name +-.Op Fl CcFIikNnRrSTtvw ++.Op Fl CcFHIikNnRrSTtvw + .Op Fl B Ar name + .Op Fl b Ar branch + .Op Fl J Ar maxjobs Ns Op Cm \&: Ns Ar prebuildmaxjobs +@@ -232,6 +232,8 @@ mirrors. + Skip + .Fx + mirrors. ++.It Fl H ++Create a repository where the package filenames contain the short hash of the contents. + .It Fl I + Advanced interactive mode. + .Pp diff --git a/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_bulk.sh b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_bulk.sh new file mode 100644 index 0000000..5cdb69c --- /dev/null +++ b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_bulk.sh @@ -0,0 +1,30 @@ +--- src/share/poudriere/bulk.sh.orig 2024-04-24 15:38:18 UTC ++++ src/share/poudriere/bulk.sh +@@ -47,6 +47,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 +@@ -97,7 +99,7 @@ fi + usage + fi + +-while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do ++while getopts "ab:B:CcFf:HiIj:J:knNO:p:RrSTtvwz:" FLAG; do + case "${FLAG}" in + a) + ALL=1 +@@ -125,6 +127,9 @@ while getopts "ab:B:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; + OPTARG="${SAVED_PWD}/${OPTARG}" + fi + LISTPKGS="${LISTPKGS:+${LISTPKGS} }${OPTARG}" ++ ;; ++ H) ++ PKG_REPO_FLAGS="${PKG_REPO_FLAGS} --hash --symlink" + ;; + I) + INTERACTIVE_MODE=2 diff --git a/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_common.sh b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_common.sh new file mode 100644 index 0000000..a3857d0 --- /dev/null +++ b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_common.sh @@ -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}} diff --git a/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_include_pkg.sh b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_include_pkg.sh new file mode 100644 index 0000000..46e709a --- /dev/null +++ b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_include_pkg.sh @@ -0,0 +1,22 @@ +--- src/share/poudriere/include/pkg.sh.orig 2024-04-24 15:38:18 UTC ++++ src/share/poudriere/include/pkg.sh +@@ -400,6 +400,10 @@ delete_pkg() { + local pkg="$1" + + clear_pkg_cache "${pkg}" ++ ++ # 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}" +@@ -417,6 +421,8 @@ delete_pkg_xargs() { + # Delete the package and the depsfile since this package is being deleted, + # which will force it to be recreated + { ++ # If ${pkg} is a symlink, delete the target as well ++ [ -L "${pkg}" ] && echo $(realpath "${pkg}") + echo "${pkg}" + echo "${pkg_cache_dir}" + } >> "${listfile}" diff --git a/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_pkgclean.sh b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_pkgclean.sh new file mode 100644 index 0000000..450b2f1 --- /dev/null +++ b/ports-mgmt/poudriere-devel/files/patch-src_share_poudriere_pkgclean.sh @@ -0,0 +1,20 @@ +--- src/share/poudriere/pkgclean.sh.orig 2024-04-24 15:38:18 UTC ++++ src/share/poudriere/pkgclean.sh +@@ -289,6 +289,8 @@ check_should_delete_pkg() { + *".${PKG_EXT}") + if should_delete "${file}"; then + echo "${file}" >> "${BADFILES_LIST:?}" ++ # If the pkg is a symlink to a hashed package, remove the hashed version as well ++ [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} + fi + ;; + *.txz) +@@ -305,6 +307,8 @@ check_should_delete_pkg() { + *) + msg_verbose "Found incorrect format file: ${file}" + echo "${file}" >> "${BADFILES_LIST:?}" ++ # If the pkg is a symlink to a hashed package, remove the hashed version as well ++ [ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST} + ;; + esac + } diff --git a/ports-mgmt/poudriere-devel/pkg-descr b/ports-mgmt/poudriere-devel/pkg-descr new file mode 100644 index 0000000..d09b0df --- /dev/null +++ b/ports-mgmt/poudriere-devel/pkg-descr @@ -0,0 +1,3 @@ +poudriere is a tool primarily designed to test package production on +FreeBSD. However, most people will find it useful to bulk build ports +for FreeBSD. diff --git a/ports-mgmt/poudriere-devel/pkg-plist b/ports-mgmt/poudriere-devel/pkg-plist new file mode 100644 index 0000000..daae02d --- /dev/null +++ b/ports-mgmt/poudriere-devel/pkg-plist @@ -0,0 +1,114 @@ +bin/poudriere +@sample etc/poudriere.conf.sample +%%ETCDIR%%/hooks/bulk.sh.sample +%%ETCDIR%%/hooks/pkgbuild.sh.sample +@sample(0,0,0) etc/poudriered.conf.sample +etc/rc.d/poudriered +@comment libexec/poudriere/cachec +libexec/poudriere/clock +libexec/poudriere/cpdup +libexec/poudriere/dirempty +libexec/poudriere/dirwatch +libexec/poudriere/locked_mkdir +libexec/poudriere/nc +libexec/poudriere/poudriered +libexec/poudriere/ptsort +libexec/poudriere/pwait +libexec/poudriere/rename +%%RM%%libexec/poudriere/rm +libexec/poudriere/setsid +libexec/poudriere/sh +libexec/poudriere/timeout +libexec/poudriere/timestamp +%%BASH%%share/bash-completion/completions/poudriere +share/man/man8/poudriere-bulk.8.gz +share/man/man8/poudriere-distclean.8.gz +share/man/man8/poudriere-image.8.gz +share/man/man8/poudriere-jail.8.gz +share/man/man8/poudriere-logclean.8.gz +share/man/man8/poudriere-options.8.gz +share/man/man8/poudriere-pkgclean.8.gz +share/man/man8/poudriere-ports.8.gz +share/man/man8/poudriere-queue.8.gz +share/man/man8/poudriere-status.8.gz +share/man/man8/poudriere-testport.8.gz +share/man/man8/poudriere-version.8.gz +share/man/man8/poudriere.8.gz +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/Caddyfile.sample +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/httpd.conf.sample +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/nginx.conf.sample +%%DATADIR%%/MANIFESTS +%%DATADIR%%/api.sh +%%DATADIR%%/awk/dependency_loop.awk +%%DATADIR%%/awk/humanize.awk +%%DATADIR%%/awk/json.awk +%%DATADIR%%/awk/json_jail.awk +%%DATADIR%%/awk/json_top.awk +%%DATADIR%%/awk/parse_MOVED.awk +%%DATADIR%%/awk/processonelog.awk +%%DATADIR%%/awk/processonelog2.awk +%%DATADIR%%/awk/siginfo_buildtime.awk +%%DATADIR%%/awk/unique_pkgnames_from_flavored_origins.awk +%%DATADIR%%/bulk.sh +%%DATADIR%%/common.sh +%%DATADIR%%/daemon.sh +%%DATADIR%%/distclean.sh +%%DATADIR%%/foreachport.sh +%%DATADIR%%/html/assets/DataTables-1.13.8/css/dataTables.bootstrap5.min.css +%%DATADIR%%/html/assets/DataTables-1.13.8/images/sort_asc.png +%%DATADIR%%/html/assets/DataTables-1.13.8/images/sort_asc_disabled.png +%%DATADIR%%/html/assets/DataTables-1.13.8/images/sort_both.png +%%DATADIR%%/html/assets/DataTables-1.13.8/images/sort_desc.png +%%DATADIR%%/html/assets/DataTables-1.13.8/images/sort_desc_disabled.png +%%DATADIR%%/html/assets/DataTables-1.13.8/js/dataTables.bootstrap5.min.js +%%DATADIR%%/html/assets/DataTables-1.13.8/js/jquery.dataTables.min.js +%%DATADIR%%/html/assets/bootstrap-5.3.2/css/bootstrap.min.css +%%DATADIR%%/html/assets/bootstrap-5.3.2/js/bootstrap.bundle.min.js +%%DATADIR%%/html/assets/favicon.png +%%DATADIR%%/html/assets/jquery-3.7.1/jquery-3.7.1.js +%%DATADIR%%/html/assets/jquery-3.7.1/jquery-3.7.1.min.js +%%DATADIR%%/html/assets/jquery-3.7.1/jquery-3.7.1.min.map +%%DATADIR%%/html/assets/jquery.dataTables.rowGrouping-1.2.9.js +%%DATADIR%%/html/assets/logo-dark.png +%%DATADIR%%/html/assets/logo-light.png +%%DATADIR%%/html/assets/poudriere.js +%%DATADIR%%/html/build.html +%%DATADIR%%/html/index.html +%%DATADIR%%/html/jail.html +%%DATADIR%%/html/robots.txt +%%DATADIR%%/image.sh +%%DATADIR%%/image_dump.sh +%%DATADIR%%/image_firmware.sh +%%DATADIR%%/image_hybridiso.sh +%%DATADIR%%/image_iso.sh +%%DATADIR%%/image_mfs.sh +%%DATADIR%%/image_rawdisk.sh +%%DATADIR%%/image_tar.sh +%%DATADIR%%/image_usb.sh +%%DATADIR%%/image_zfs.sh +%%DATADIR%%/image_zsnapshot.sh +%%DATADIR%%/include/asserts.sh +%%DATADIR%%/include/cache.sh +%%DATADIR%%/include/colors.pre.sh +%%DATADIR%%/include/colors.sh +%%DATADIR%%/include/common.sh.dragonfly +%%DATADIR%%/include/common.sh.freebsd +%%DATADIR%%/include/display.sh +%%DATADIR%%/include/fs.sh +%%DATADIR%%/include/hash.sh +%%DATADIR%%/include/html.sh +%%DATADIR%%/include/parallel.sh +%%DATADIR%%/include/pkg.sh +%%DATADIR%%/include/pkgqueue.sh +%%DATADIR%%/include/shared_hash.sh +%%DATADIR%%/include/util.sh +%%DATADIR%%/jail.sh +%%DATADIR%%/logclean.sh +%%DATADIR%%/options.sh +%%DATADIR%%/pkgclean.sh +%%DATADIR%%/ports.sh +%%DATADIR%%/processonelog.sh +%%DATADIR%%/queue.sh +%%DATADIR%%/status.sh +%%DATADIR%%/testport.sh +%%ZSH%%share/zsh/site-functions/_poudriere