summaryrefslogtreecommitdiff
path: root/ports-mgmt/portmaster
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2007-02-22 19:05:08 +0000
committerDoug Barton <dougb@FreeBSD.org>2007-02-22 19:05:08 +0000
commitb11c6afcb98ddbddd7ecdb5160243ab9f67c89cb (patch)
treee6920173c0b6b8d0bd5e60080bf12e3e20e3f956 /ports-mgmt/portmaster
parent- Update to 0.9.13 (diff)
New Feature
=========== --clean-distfiles[-all] options to check /usr/ports/distfiles for stale stuff, and either offer to delete them or delete them all without prompting. Bug Fix ======= Fix brain-o that broke the -o option. Usability Improvements ====================== 1. If a port skeleton is missing, but the pkg db has an +IGNOREME file, skip the update check, but issue a warning for it. 2. If there is no +IGNOREME file, and no version information is present, fail with a helpful error message. 3. Clean up any trailing / character on directory names input at the command line. 4. Allow user to specify just category/portname on the command line without -p. 5. Work around a missing +REQUIRED_BY file for a -r port. Minor cleanup ============= Make case consistent for all usage() items
Notes
Notes: svn path=/head/; revision=185704
Diffstat (limited to 'ports-mgmt/portmaster')
-rw-r--r--ports-mgmt/portmaster/files/portmaster.sh.in87
1 files changed, 78 insertions, 9 deletions
diff --git a/ports-mgmt/portmaster/files/portmaster.sh.in b/ports-mgmt/portmaster/files/portmaster.sh.in
index a1d6eea99ac2..a71d1a2e32a3 100644
--- a/ports-mgmt/portmaster/files/portmaster.sh.in
+++ b/ports-mgmt/portmaster/files/portmaster.sh.in
@@ -1,6 +1,6 @@
#!/bin/sh
-# Local version: 1.147
+# Local version: 1.151
# $FreeBSD$
# Copyright (c) 2005-2007 Douglas Barton, All rights reserved
@@ -50,6 +50,9 @@ usage () {
echo "${0##*/} [-b D|d] -e <full name of port directory in $pdb>"
echo "${0##*/} [-b D|d] -s"
echo ''
+ echo "${0##*/} --clean-distfiles"
+ echo "${0##*/} --clean-distfiles-all"
+ echo ''
echo "${0##*/} -h"
echo ''
echo "-C prevents 'make clean' being run in port directory"
@@ -67,7 +70,7 @@ usage () {
echo '-d always clean distfiles'
echo "-m <arguments for the 'make' command line>"
echo ''
- echo '-o Replace the installed port with a port from a different origin'
+ echo '-o replace the installed port with a port from a different origin'
echo '-r rebuild port, and all ports that depend on it'
echo '-a check all ports, update as necessary'
echo ''
@@ -77,6 +80,9 @@ usage () {
echo '-e expunge a port via pkg_delete, and removing its distfiles'
echo '-s clean out stale ports that used to be depended on'
echo ''
+ echo '--clean-distfiles offer to delete stale distfiles'
+ echo '--clean-distfiles-all delete stale distfiles without prompting'
+ echo ''
echo '-h display this help file'
echo ''
exit ${1:-1}
@@ -373,10 +379,19 @@ check_for_updates () {
fi
if [ -d "$pd/$upd_port" ]; then
- cd $pd/$upd_port ||
- fail "Cannot cd to port directory: $pd/$upd_port"
+ if ! cd $pd/$upd_port; then
+ if [ -e "$pdb/$1/+IGNOREME" ]; then
+ echo "===>>> Warning: Unable to cd to $pd/$upd_port"
+ echo "===>>> Continuing due to $pdb/$1/+IGNOREME"
+ return 0
+ else
+ fail "Cannot cd to port directory: $pd/$upd_port"
+ fi
+ fi
port_ver=`make $MAKE_ARGS -V PKGNAME`
+ [ -z "$port_ver" ] && fail "Is $pd/$upd_port/Makefile missing?"
+
if [ "$1" = "$port_ver" ]; then
if [ -z "$LIST" -a -z "$LIST_PLUS" ]; then
# Keep list both ways to increase performance
@@ -799,6 +814,50 @@ fi
: ${pd:=/usr/ports}
: ${pdb:=/var/db/pkg}
+case "$1" in
+--clean-distfiles) CLEAN_DISTFILES=yes ;;
+--clean-distfiles-all) CLEAN_DISTFILES=yes ; ALL=yes ;;
+esac
+
+if [ -n "$CLEAN_DISTFILES" ]; then
+ echo "===>>> Gathering distinfo list for installed ports"
+ for pkg in ${pdb}/*; do
+ [ -d $pkg ] || continue
+ origin=`origin_from_pdb $pkg`
+
+ if [ ! -d "$pd/$origin" ]; then
+ find_moved_port $origin || continue
+ origin=$newportdir
+ fi
+
+ cd $pd/$origin || continue
+ distinfo=`make $MAKE_ARGS -V MD5_FILE`
+ if [ -s "$distinfo" ]; then
+ distinfos="$distinfos $distinfo"
+ fi
+ done
+
+ echo "===>>> Checking for stale distfiles"
+ for df in `find $pd/distfiles -type f`; do
+ f=${df#$pd/distfiles/}
+ if ! grep -q \(${f}\) $distinfos; then
+ if [ -n "$ALL" ]; then
+ echo "===>>> Deleting $f"
+ rm $df
+ else
+ echo -n "===>>> Delete stale file: ${f}? [y] "
+ read DEL_OR_NOT
+ case "$DEL_OR_NOT" in
+ [nN]*) continue ;;
+ *) rm $df ;;
+ esac
+ fi
+ fi
+ done
+
+ exit 0
+fi
+
# Save switches for potential child processes
while getopts 'BCDGLabde:fghilm:nop:r:stuv' COMMAND_LINE_ARGUMENT ; do
case "${COMMAND_LINE_ARGUMENT}" in
@@ -825,7 +884,7 @@ while getopts 'BCDGLabde:fghilm:nop:r:stuv' COMMAND_LINE_ARGUMENT ; do
;;
n) NO_ACTION=yes; ARGS="-n $ARGS" ;;
o) REPLACE_ORIGIN=yes ;;
- p) portdir="${OPTARG#$pd/}" ;;
+ p) portdir="${OPTARG#$pd/}" ; portdir=${portdir%/} ;;
r) UPDATE_REQ_BYS=yes; upg_port=$OPTARG ;;
s) CLEAN_STALE=yes ;;
t) RECURSE_THOROUGH=yes; ARGS="-t $ARGS" ;;
@@ -1017,7 +1076,7 @@ if [ "$$" -eq "$PARENT_PID" ]; then
export CONFIG_SEEN_LIST CONFIG_ONLY
fi
- if [ $# -gt 1 ]; then
+ if [ $# -gt 1 -a -z "$REPLACE_ORIGIN" ]; then
if [ -z "$NO_RECURSIVE_CONFIG" ]; then
for port in $@; do
($0 $ARGS $port) ||
@@ -1110,6 +1169,7 @@ fi
if [ -n "$REPLACE_ORIGIN" ]; then
portdir="${1#$pd/}"
+ portdir="${portdir%/}"
newportdir=$portdir
if [ -d "$pdb/$2" ]; then
@@ -1136,8 +1196,15 @@ case "$portdir" in
${pd}/*) portdir="${1#$pd/}" ;;
/*) upg_port="${1##*/}" ;;
\.) portdir="${PWD##*/ports/}" ;;
- *) upg_port=$1 ;;
+ *) if [ -d "${pd}/${1}" ]; then
+ portdir=$1
+ else
+ upg_port=$1
+ fi
+ ;;
esac
+ portdir=${portdir%/}
+ upg_port=${upg_port%/}
esac
case "$upg_port" in
@@ -1262,10 +1329,12 @@ dofetch () {
if [ -n "$UPDATE_REQ_BYS" ]; then
MASTER_RB_LIST=`mktemp -t master_rb_list-${PARENT_PID}`
export MASTER_RB_LIST
+ if [ -s "$pdb/$upg_port/+REQUIRED_BY" ]; then
+ old_rb=$pdb/$upg_port/+REQUIRED_BY
+ fi
upg_origin=`origin_from_pdb $pdb/$upg_port`
grep -l DEPORIGIN:$upg_origin$ $pdb/*/+CONTENTS |
- cut -f 5 -d '/' | sort -u - \
- $pdb/$upg_port/+REQUIRED_BY > $MASTER_RB_LIST
+ cut -f 5 -d '/' | sort -u - $old_rb > $MASTER_RB_LIST
fi
fi