Skip to content

Commit

Permalink
Add support for hashed mode to Poudriere
Browse files Browse the repository at this point in the history
Requires the related patches to pkg and the ports tree
  • Loading branch information
allanjude committed Apr 14, 2020
1 parent b19ef33 commit 668a61f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/bin/poudriere-bulk.8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/share/poudriere/bulk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -116,6 +118,9 @@ while getopts "aB:CcFf:iIj:J:knNO:p:RrSTtvwz:" FLAG; do
OPTARG="${SAVED_PWD}/${OPTARG}"
LISTPKGS="${LISTPKGS} ${OPTARG}"
;;
H)
PKGENV="${PKGENV} PKG_CREATE_HASH=yes PKG_CREATE_SYMLINK=yes"
;;
I)
INTERACTIVE_MODE=2
;;
Expand Down
4 changes: 4 additions & 0 deletions src/share/poudriere/common.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4957,6 +4957,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}"
Expand All @@ -4975,6 +4978,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}"
Expand Down
5 changes: 5 additions & 0 deletions src/share/poudriere/pkgclean.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,24 @@ 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}
fi
;;
*)
msg_verbose "Found incorrect format file: ${file}"
[ -L "${file}" ] && echo "$(realpath ${file})" >> ${BADFILES_LIST}
echo "${file}" >> ${BADFILES_LIST}
;;
esac
Expand Down Expand Up @@ -239,6 +243,7 @@ END {
for pkg in $packages; do
pkgversion="${pkg##*-}"
pkgversion="${pkgversion%.*}"
pkgversion="${pkgversion%~*}"

if [ -z "${lastpkg}" ]; then
lastpkg="${pkg}"
Expand Down

0 comments on commit 668a61f

Please sign in to comment.