svn commit: r200663 - user/dougb/portmaster
Doug Barton
dougb at FreeBSD.org
Fri Dec 18 08:03:31 UTC 2009
Author: dougb
Date: Fri Dec 18 08:03:31 2009
New Revision: 200663
URL: http://svn.freebsd.org/changeset/base/200663
Log:
1. Instead of having a pca() to describe the post-config action
collect the stuff that always runs after config is done into a
function, and use the pca() logic to determine what to print. This
also restores the whitespace to consistency between the modes
(one port, multiport, -a).
2. 9-CURRENT has its own package repo now, hurray!
3. Instead of fetching the directory listing for each port category
(devel, ports-mgmt, etc.) every time we need to check a port, fetch
it once and save it to a temporary file. This lets us do several
cool things:
a. Save a lot of time not having to re-fetch each iteration
b. Run the sed code to fix %2c -> , up front
c. Add a sed pattern to fix %2b -> +
d. Run a variety of different patterns to try and find the
latest_pv
4. Not finding a package (or even a package repo) should only fail()
if we are using -PP, not if we're just using -P.
5. Move the error message for "no package in -PP mode" to a variable
for both reuse and code readability.
6. We only want to run the logic tree on whether $latest_pv is up to
date or not if that variable has a value, so add appropriate tests.
Modified:
user/dougb/portmaster/portmaster
Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster Fri Dec 18 06:09:43 2009 (r200662)
+++ user/dougb/portmaster/portmaster Fri Dec 18 08:03:31 2009 (r200663)
@@ -1865,14 +1865,21 @@ create_master_rb_list () {
[ -n "$MASTER_RB_LIST" ] && export MASTER_RB_LIST=" $MASTER_RB_LIST"
}
-pca () {
+post_config () {
+ local action
+
+ unset CONFIG_SEEN_LIST CONFIG_ONLY
+
+ action=build
if [ "$PM_PACKAGES" = only ]; then
- echo install
+ action=install
elif [ -n "$PM_PACKAGES" ]; then
- echo 'build and/or install'
- else
- echo build
+ action='build and/or install'
fi
+
+ echo ''
+ echo "===>>> Starting $action for $* <<<==="
+ echo ''
}
multiport () {
@@ -1937,11 +1944,9 @@ multiport () {
($0 $ARGS $port) || fail "Update for $port failed"
. $IPC_SAVE
done
+
check_fetch_only
- unset CONFIG_SEEN_LIST CONFIG_ONLY
- echo ''
- echo "===>>> Starting `pca` for multiple ports <<<==="
- echo ''
+ post_config multiple ports
if [ -n "$PM_BUILD_ONLY_LIST" ]; then
unset run_dl_g
@@ -2109,10 +2114,7 @@ all_config () {
safe_exit
fi
- unset CONFIG_SEEN_LIST CONFIG_ONLY
- echo ''
- echo "===>>> Starting `pca` for ports that need updating <<<==="
- echo ''
+ post_config for ports that need updating
if [ -n "$PM_BUILD_ONLY_LIST" ]; then
clean_build_only_list
@@ -2417,9 +2419,7 @@ if [ -n "$CONFIG_ONLY" ]; then
fi
check_fetch_only
- unset CONFIG_SEEN_LIST CONFIG_ONLY
- echo "===>>> Starting `pca` for $portdir <<<==="
- echo ''
+ post_config $portdir
if [ -n "$PM_BUILD_ONLY_LIST" ]; then
unset run_dl_g
@@ -2521,7 +2521,7 @@ fetch_package () {
release=packages-${release%%\.*}-stable ;;
[678]\.[0-9]-RELEASE*)
release=packages-${release%-RELEASE*}-release ;;
- 9\.0-CURRENT) release=packages-8-stable ;; # XXX
+ 9\.0-CURRENT) release=packages-9-current ;;
*RC[0-9]*) release=${release%-RC[0-9]}
release=packages-${release}-release ;;
*BETA[0-9]*) release=${release%-BETA[0-9]}
@@ -2553,13 +2553,21 @@ fetch_package () {
fi
if [ -z "$latest_pv" ]; then
- case "$new_port" in
- *\.*) s=${new_port%%\.*} ;;
- *) s=`pm_make -V LATEST_LINK` ;;
- esac
- latest_pv=`fetch -q -o - ${sitepath} 2>/dev/null | grep "href=\"${s}"`
+ dirlist=`echo ${TMPDIR}/f-${PM_PARENT_PID}-dl-${portdir%/*}*`
+ if [ ! -r "$dirlist" ]; then
+ pm_unlink $dirlist # JIC
+ dirlist=`pm_mktemp dl-${portdir%/*}`
+ fetch -q -o - ${sitepath} 2>/dev/null |
+ sed -e "s#%2[cC]#,#g" -e "s#%2[bB]#+#g" > \
+ $dirlist
+ fi
+
+ for s in ${new_port%\.*} ${new_port%%\.*} ${new_port%-*}; do
+ latest_pv=`grep "href=\"${s}" $dirlist`
+ [ -n "$latest_pv" ] && break
+ done
fi
- unset s
+ unset dirlist s
if [ -z "$latest_pv" ]; then
fetch_package $new_port try
@@ -2568,19 +2576,18 @@ fetch_package () {
fi
fi
+ ponly_err="Try --packages-if-newer, or do not use -PP/--packages-only"
+
if [ -z "$latest_pv" ]; then
echo "===>>> Package and/or archive not found at:"
echo "${sitepath}"
echo ''
echo " Check the pkg_add(1) man page for information"
echo " on setting the PACKAGESITE environment variable"
- fail 'No package archive found'
+ [ "$PM_PACKAGES" = only ] && fail $ponly_err
else
latest_pv=${latest_pv#*href=\"}
latest_pv=${latest_pv%%\.tbz*}
- case "$latest_pv" in
- *%2[cC]*) latest_pv=`echo $latest_pv | sed s#%2[cC]#,#` ;;
- esac
fi
notnewer () {
@@ -2595,7 +2602,7 @@ notnewer () {
use_package=up_equal
[ -n "$PM_VERBOSE" ] &&
echo "===>>> Available package ($latest_pv) matches the ports tree"
- elif [ -n "$PM_PACKAGES_NEWER" ]; then
+ elif [ -n "$latest_pv" -a -n "$PM_PACKAGES_NEWER" ]; then
if [ -n "$upg_port" ]; then
case `pkg_version -t $upg_port $latest_pv` in
\<) use_package=up_newer
@@ -2614,7 +2621,7 @@ notnewer () {
[ -n "$PM_VERBOSE" ] &&
echo "===>>> There is a package available ($latest_pv)"
fi
- else
+ elif [ -n "$latest_pv" ]; then
case `pkg_version -t $new_port $latest_pv` in
\<) # Could happen if ports tree is out of date
use_package=up_old_tree
@@ -2636,7 +2643,7 @@ notnewer () {
use_package=up_force2
echo "===>>> Installing anyway due to -f"
else
- fail "Try --packages-if-newer, or do not use -PP/--packages-only"
+ fail $ponly_err
fi
fi
fi ;;
More information about the svn-src-user
mailing list