Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/share
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2022-06-06 19:26:52 +0300
committerBryan Drewery <bryan@shatow.net>2022-06-06 20:27:45 +0300
commit322f808abebc2aa439d5012ce3037cc2cd1f94ef (patch)
tree39a90757dc0be9b4667f0d8921897e670bc2c7b8 /src/share
parent9428b985a4cf279df4136e424dde40f70c1f8ab1 (diff)
pkgclean -C: Need to delete by origin not pkgname.
This handles deleting older packages that the port no longer produces. Issue #310
Diffstat (limited to 'src/share')
-rwxr-xr-xsrc/share/poudriere/common.sh20
-rwxr-xr-xsrc/share/poudriere/pkgclean.sh28
2 files changed, 36 insertions, 12 deletions
diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh
index 892d3acd..d39f4207 100755
--- a/src/share/poudriere/common.sh
+++ b/src/share/poudriere/common.sh
@@ -7692,6 +7692,26 @@ originspec_is_needed_and_not_ignored() {
}' "${MASTER_DATADIR}/all_pkgs"
}
+# Port was listed to be built
+originspec_is_listed() {
+ [ $# -eq 1 ] || eargs originspec_is_listed originspec
+ local originspec="$1"
+
+ if [ "${ALL}" -eq 1 ]; then
+ return 0
+ fi
+
+ awk -voriginspec="${originspec}" '
+ $3 == "listed" && $2 == originspec {
+ found=1
+ exit 0
+ }
+ END {
+ if (found != 1)
+ exit 1
+ }' "${MASTER_DATADIR}/all_pkgs"
+}
+
get_porttesting() {
[ $# -eq 1 ] || eargs get_porttesting pkgname
local pkgname="$1"
diff --git a/src/share/poudriere/pkgclean.sh b/src/share/poudriere/pkgclean.sh
index 5cf25382..22ef6377 100755
--- a/src/share/poudriere/pkgclean.sh
+++ b/src/share/poudriere/pkgclean.sh
@@ -201,22 +201,26 @@ for file in ${PACKAGES}/All/*; do
if ! pkg_get_origin origin "${file}"; then
msg_verbose "Found corrupt package: ${file}"
echo "${file}" >> ${BADFILES_LIST}
- elif shash_remove pkgname-forbidden "${pkgname}" \
- forbidden; then
- msg_verbose "Found forbidden package (${forbidden}): ${file}"
- echo "${file}" >> ${BADFILES_LIST}
- elif [ "${CLEAN_LISTED}" -eq 0 ] &&
- ! pkgbase_is_needed "${pkgname}"; then
- msg_verbose "Found unwanted package: ${file}"
- echo "${file}" >> ${BADFILES_LIST}
+ continue
+ fi
+ if [ "${CLEAN_LISTED}" -eq 0 ]; then
+ if shash_remove pkgname-forbidden "${pkgname}" \
+ forbidden; then
+ msg_verbose "Found forbidden package (${forbidden}): ${file}"
+ echo "${file}" >> ${BADFILES_LIST}
+ continue
+ elif ! pkgbase_is_needed "${pkgname}"; then
+ msg_verbose "Found unwanted package: ${file}"
+ echo "${file}" >> ${BADFILES_LIST}
+ continue
+ fi
elif [ "${CLEAN_LISTED}" -eq 1 ] &&
- pkgbase_is_needed "${pkgname}" &&
- pkgname_is_listed "${pkgname}"; then
+ originspec_is_listed "${origin}"; then
msg_verbose "Found unwanted package: ${file}"
echo "${file}" >> ${BADFILES_LIST}
- else
- echo "${file} ${origin}" >> ${FOUND_ORIGINS}
+ continue
fi
+ echo "${file} ${origin}" >> ${FOUND_ORIGINS}
;;
*.txz)
if [ -L "${file}" ]; then