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
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2022-06-06 19:42:46 +0300
committerBryan Drewery <bryan@shatow.net>2022-06-06 20:27:45 +0300
commit44493ca89ff41639e2e63c8e92f842b8bd50ec41 (patch)
tree828e0e9b4ccfd352fb1efe31d951e3d0ad7d2f81 /src
parent322f808abebc2aa439d5012ce3037cc2cd1f94ef (diff)
pkgclean -C: Delete rdeps of listed with -r
Issue #310
Diffstat (limited to 'src')
-rw-r--r--src/man/poudriere-pkgclean.88
-rwxr-xr-xsrc/share/poudriere/pkgclean.sh41
2 files changed, 41 insertions, 8 deletions
diff --git a/src/man/poudriere-pkgclean.8 b/src/man/poudriere-pkgclean.8
index 658e1c8e..2bcb2bfd 100644
--- a/src/man/poudriere-pkgclean.8
+++ b/src/man/poudriere-pkgclean.8
@@ -79,6 +79,8 @@ arguments may be specified at once.
Delete the listed packages rather than keep them.
This can be used to delete specific packages that need to be rebuilt
while keeping them in the port list file.
+.Fl r
+can be specified to delete reverse dependencies as well.
.It Fl J Ar number
This argument specifies how many
.Ar number
@@ -102,6 +104,12 @@ Specifies which ports
.Ar tree
to use.
.Pq Default: Dq Li default
+.It Fl r
+When
+.Fl C
+is specified then all reverse dependencies will be deleted as well.
+This can be used to later force rebuild anything depending on the listed
+packages.
.It Fl R
Also clean restricted packages.
.It Fl v
diff --git a/src/share/poudriere/pkgclean.sh b/src/share/poudriere/pkgclean.sh
index 22ef6377..b5be267f 100755
--- a/src/share/poudriere/pkgclean.sh
+++ b/src/share/poudriere/pkgclean.sh
@@ -46,6 +46,7 @@ Options:
-N -- Do not build the package repository when clean completed
-O overlays -- Specify extra ports trees to overlay
-p tree -- Which ports tree to use for packages
+ -r -- With -C delete reverse dependencies too
-R -- Clean RESTRICTED packages after building
-v -- Be verbose; show more information. Use twice to enable
debug output
@@ -62,10 +63,11 @@ DO_ALL=0
BUILD_REPO=1
OVERLAYS=""
CLEAN_LISTED=0
+CLEAN_RDEPS=0
[ $# -eq 0 ] && usage
-while getopts "AaCj:J:f:nNO:p:Rvyz:" FLAG; do
+while getopts "AaCj:J:f:nNO:p:rRvyz:" FLAG; do
case "${FLAG}" in
A)
DO_ALL=1
@@ -106,6 +108,9 @@ while getopts "AaCj:J:f:nNO:p:Rvyz:" FLAG; do
err 2 "No such ports tree: ${OPTARG}"
PTNAME=${OPTARG}
;;
+ r)
+ CLEAN_RDEPS=1
+ ;;
R)
NO_RESTRICTED=1
;;
@@ -135,6 +140,9 @@ post_getopts
if [ "${CLEAN_LISTED}" -eq 1 -a -n "${LISTPKGS}" ]; then
err ${EX_USAGE} "-C and -f should not be used together"
fi
+if [ "${CLEAN_LISTED}" -eq 0 -a "${CLEAN_RDEPS}" -eq 1 ]; then
+ err ${EX_USAGE} "-r only works with -C"
+fi
MASTERNAME=${JAILNAME}-${PTNAME}${SETNAME:+-${SETNAME}}
_mastermnt MASTERMNT
@@ -206,19 +214,36 @@ for file in ${PACKAGES}/All/*; do
if [ "${CLEAN_LISTED}" -eq 0 ]; then
if shash_remove pkgname-forbidden "${pkgname}" \
forbidden; then
- msg_verbose "Found forbidden package (${forbidden}): ${file}"
+ msg_verbose "Found forbidden package (${COLOR_PORT}${origin}${COLOR_RESET}) (${forbidden}): ${file}"
echo "${file}" >> ${BADFILES_LIST}
continue
elif ! pkgbase_is_needed "${pkgname}"; then
- msg_verbose "Found unwanted package: ${file}"
+ msg_verbose "Found unwanted package (${COLOR_PORT}${origin}${COLOR_RESET}): ${file}"
echo "${file}" >> ${BADFILES_LIST}
continue
fi
- elif [ "${CLEAN_LISTED}" -eq 1 ] &&
- originspec_is_listed "${origin}"; then
- msg_verbose "Found unwanted package: ${file}"
- echo "${file}" >> ${BADFILES_LIST}
- continue
+ elif [ "${CLEAN_LISTED}" -eq 1 ]; then
+ if originspec_is_listed "${origin}"; then
+ msg_verbose "Found specified package (${COLOR_PORT}${origin}${COLOR_RESET}): ${file}"
+ echo "${file}" >> ${BADFILES_LIST}
+ continue
+ elif ! pkg_get_dep_origin_pkgnames \
+ compiled_deps '' "${file}"; then
+ msg_verbose "Found corrupt package (${COLOR_PORT}${origin}${COLOR_RESET}) (deps): ${file}"
+ echo "${file}" >> ${BADFILES_LIST}
+ continue
+ fi
+ if [ "${CLEAN_RDEPS}" -eq 1 ]; then
+ for dep_origin in ${compiled_deps}; do
+ if originspec_is_listed \
+ "${dep_origin}"; then
+ msg_verbose "Found specified package (${COLOR_PORT}${dep_origin}${COLOR_RESET}) rdep: ${file}"
+ echo "${file}" \
+ >> ${BADFILES_LIST}
+ continue 2
+ fi
+ done
+ fi
fi
echo "${file} ${origin}" >> ${FOUND_ORIGINS}
;;