Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jun 2010 11:10:38 +0100 (BST)
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/147808: [new port] ports-mgmt/wanted-ports
Message-ID:  <201006121010.o5CAAcgK012486@lucid-nonsense.infracaninophile.co.uk>
Resent-Message-ID: <201006121020.o5CAK1GU076416@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         147808
>Category:       ports
>Synopsis:       [new port] ports-mgmt/wanted-ports
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 12 10:20:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Matthew Seaman
>Release:        FreeBSD 8.1-PRERELEASE amd64
>Organization:
Infracaninophile
>Environment:
System: FreeBSD lucid-nonsense.infracaninophile.co.uk 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #4: Fri May 28 11:09:30 BST 2010 root@lucid-nonsense.infracaninophile.co.uk:/usr/obj/usr/src/sys/LUCID-NONSENSE amd64


	
>Description:

A small port that exists solely to have dependencies on a user
modifiable list of other ports.  Use this port to mark what you
actually want to have installed, thus permitting you at a later date
to distinguish easily between the ports you want installed, and those
ports that are installed as dependencies.

>How-To-Repeat:
	
>Fix:

	

--- wanted-ports.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	wanted-ports
#	wanted-ports/files
#	wanted-ports/files/wanted-ports.in
#	wanted-ports/files/wanted-ports.pod
#	wanted-ports/files/wanted-ports.1.in
#	wanted-ports/Makefile
#	wanted-ports/pkg-descr
#
echo c - wanted-ports
mkdir -p wanted-ports > /dev/null 2>&1
echo c - wanted-ports/files
mkdir -p wanted-ports/files > /dev/null 2>&1
echo x - wanted-ports/files/wanted-ports.in
sed 's/^X//' >wanted-ports/files/wanted-ports.in << '29738bebff289eac2eae58d35e5e1b73'
X#!/bin/sh
X#
X# $FreeBSD$
X
X# Copyright 2010 Matthew Seaman. All rights reserved.
X# 
X# Redistribution and use in source and binary forms, with or without
X# modification, are permitted provided that the following conditions
X# are met:
X# 
X#    1. Redistributions of source code must retain the above copyright
X#    notice, this list of conditions and the following disclaimer.
X#
X#    2. Redistributions in binary form must reproduce the above
X#    copyright notice, this list of conditions and the following
X#    disclaimer in the documentation and/or other materials provided
X#    with the distribution.
X# 
X# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
X# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
X# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
X# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
X# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
X# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
X# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
X# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
X# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
X# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X
X# Programatically edit the dependencies of %%PKGNAME%% to mark
X# depended on ports as wanted and help prevent accidental
X# removal. Wanted dependencies are read from a makefile snippet
X# containing PORTREVISION and RUN_DEPENDS variable settings:
X# PORTREVISION is incremented when any changes are made via this
X# script, which will cause this port to be reinstalled the next time
X# the ports are updated, hence forcing installation of the required
X# dependencies.  Removing a depended-on port from the list does not
X# cause it to be removed automatically.
X
Xumask 022
XIFS=' 	
X'
XPATH=/bin:/sbin:/usr/bin:/usr/sbin:%%PREFIX%%/bin:%%PREFIX%%/sbin
Xexport IFS PATH
X
X
X# Dissect the PKGVERSION string, extracting the revision number.
X# Increment it or set it to 1 if unset and return the incremented
X# number.
Xincrement_revision () {
X    local revision
X
X    revision=$( echo $1 | sed -ne 's:^[^_]*_\([^,]*\).*$:\1:p' )
X    if [ ! -z $revision ]; then
X	revision=$(( $revision + 1 ))
X    else
X	revision=1
X    fi
X    echo $revision
X}
X
X# Update the $wanted_ports_conf file carefully. 
Xupdate_wanted_ports_conf() {
X    local conf_file revision run_deps tmp_conf
X
X    conf_file=$1
X    revision=$2
X    run_deps=$3
X    
X
X    tmp_conf=$(mktemp "${conf_file%/*}/.${conf_file##*/}.XXXXXX")
X    if [ $? -ne 0 ]; then
X	echo "${ME}: FATAL -- Can't create temporary file in ${conf_file%/*}."
X	exit 1
X    fi
X
X    generate_conf $revision "$run_deps" > $tmp_conf
X
X    cp ${conf_file} ${conf_file}.old && \
X	cp $tmp_conf ${conf_file}    && \
X	rm -f $tmp_conf
X}
X
X# Generate a new config file
Xgenerate_conf() {
X    local revision run_deps firstline
X
X    revision=$1
X    run_deps=$2
X
X    cat <<EOF
X# -*- makefile -*-
X#
X# Last updated by ${USER} using ${ME} on ${DATE}
X#
X# Config file for %%PKGNAME%%.  Maintain it using %%PORTNAME%%
X
XPORTREVISION=	${revision}
X
XEOF
X
X    printf 'RUN_DEPENDS=\t'
X
X    firstline=
X    for rd in $run_deps ; do
X	[ -z $firstline ] || printf ' \\\n\t\t'
X	echo -n $rd
X	firstline=no
X    done
X    echo
X    echo
X}
X
X# Given a pkgname or port directory, construct a RUN_DEPENDS entry for
X# it.  Since we have no way of knowing what files are significant from
X# among whatever the port installs (and the port may not even be
X# installed yet) use the form
X# "pkgname>=n.nn:${PORTSDIR}/category/portname" where n.nn is the
X# currently available version of the port.  Requires the INDEX to have
X# been installed.  This can return any number of dependency lines,
X# including none.
X#
X# Note: Don't allow %%PORTNAME%% to add a dependency on itself...
Xrun_dep_from_index() {
X    local pkgpat
X
X    pkgpat=$1
X
X    # pkgpat should be a single word -- but it could be empty
X    for pp in $pkgpat ; do
X        # Has your head exploded yet?
X	awk -F '|' -v x=$pp                                     \
X	    '$1 ~ x || $2 ~ x { printf "%s:%s\n", $1, $2 }'     \
X	    < ${PORTSDIR}/${INDEXFILE} | grep -v %%PORTNAME%% | \
X            sed -e 's/-\([^-]*\):/>=\1:/' -e "s,${PORTSDIR},\${PORTSDIR},"
X    done
X}
X
X# Get the existing value of RUN_DEPENDS from the config file, and update it
X# against the current INDEX file.
Xupdate_run_deps() {
X    local conf_file run_deps
X
X    conf_file=$1
X    run_deps=$( PORTSDIR=${PORTSDIR} make -f $conf_file -V RUN_DEPENDS )
X
X    for rd in $run_deps ; do
X	rd=$( echo $rd | sed -e "s,^.*${PORTSDIR},," -e 's, *$,$,' )
X	run_dep_from_index $rd
X    done | sort -u
X}
X
X# Return 0 or 1 according to user input "Y|y|yes" or "N|n|no"
Xcheck_yesno() {
X    local answer junk rc
X
X    rc=
X    while [ -z $rc ]; do 
X	read answer junk
X	case $answer in
X	    [Yy]|[Yy][Ee][Ss])
X		rc=0
X		;;
X	    [Nn]|[Nn][Oo])
X		rc=1
X		;;
X	    *)
X		echo -n "${ME}: Errr... what?" 
X		;;
X	esac
X    done
X
X    return $rc
X}
X
X
X# Usage message
Xusage() {
X    echo >&2 <<EOF
X${ME}: Usage
X	${ME} [-n] [-f cfgfile] [-a portname|-d portname]...
X
X    Options:
X
X        -n           dry-run: don't commit changes to $CONF_FILE
X        -f cfgfile   alternative config file (default: $CONF_FILE)
X        -a portname  add portname to the list of wanted files
X        -d portname  remove portname from the list of wanted files
X
X        -a and -d options are processed in the order given on the command
X        line: later items may undo the effect of earlier ones.
X
X        portnames are matched against both the pkgname and the path within
X        the ports tree.  One portname can result in adding or removing
X        dependencies on a number of different ports.
X
X        Trying to add %%PORTNAME%% as a dependency of itself is an error.
X
X        Without arguments, ${ME} will update the config file to reference
X        the current versions of any run-depends listed in the ports INDEX.
X
XEOF
X}
X
Xadd_dependency() {
X    local portname run_deps to_add
X
X    portname=$1
X    run_deps=$2
X
X    to_add=$( run_dep_from_index "$portname" )
X
X    # Check on exiting dependencies
X    {
X	for ta in $to_add ; do
X	    if echo "$run_deps" | grep -q -F $ta ; then
X		echo "${ME}: Dependency \"$ta\" already registered" >&2
X	    else
X		echo -n "${ME}: Register new dependency \"$ta\"?  " >&2
X		if check_yesno >&2 ; then
X		    echo $ta
X		fi
X	    fi
X	done
X	echo "$run_deps" 
X    } | sort -u
X}
X
Xdelete_dependency() {
X    local portname run_deps to_delete
X
X    portname=$1
X    run_deps=$2
X
X    to_delete=$( run_dep_from_index "$portname" )
X
X    for rd in $run_deps ; do
X	if echo "$to_delete" | grep -q -F $rd ; then
X	    echo -n "${ME}: Delete dependency \"$rd\"?  " >&2
X	    if ! check_yesno >&2 ; then
X		echo $rd
X	    fi
X	else
X	    echo $rd
X	fi
X    done | sort -u
X}
X
X# Program name
XME=${0##*/}
X
X# User running this scipt
XUSER=${USER:-${LOGNAME:-"an unknown user"}}
X
X# Date now
XDATE=$( date )
X
X# Where the ports tree is installed
XPORTSDIR=${PORTSDIR:-/usr/ports}
X
X# We need the ports tree to be installed
Xif ! [ -d ${PORTSDIR} -a -f ${PORTSDIR}/Makefile ] ; then
X    echo "${ME}: FATAL -- do you have the ports tree installed?" >&2
X    exit 1
Xfi
X
X# The ports INDEX file
XINDEXFILE=${INDEXFILE:-$( make -f ${PORTSDIR}/Makefile -V INDEXFILE )}
X
Xif ! [ -f ${PORTSDIR}/${INDEXFILE} ] ; then
X    echo "${ME}: FATAL -- can\'t access ${PORTSDIR}/${INDEXFILE}" >&2
X    exit 1
Xfi
X
X# Makefile snippet containing PORTREVISION and RUN_DEPENDS data
X# Set WANTEDPORTSCFG in the environment to override, or use the -f
X# command line option
XCONF_FILE=${WANTEDPORTSCFG:-/var/db/%%PORTNAME%%.conf}
X
X# The currently installed version of %%PKGNAME%% -- accounting for any
X# dynamic updates to PORTREVISION
XINSTALLED_PKG=$( pkg_info -Ex %%PKGNAME%% )
X
Xif [ -z $INSTALLED_PKG ] ; then
X    echo "${ME}: FATAL -- the package providing this script seems " \
X	"not to be installed" >&2
X    exit 1
Xfi
X
X#
X# Handle Options -- Main Code Loop
X#
X
Xdry_run=
Xaction=
Xwhile getopts nf:a:d: opt ; do
X    case $opt in
X	n)
X	    dry_run=yes
X	    ;;
X	f)
X	    CONF_FILE="$OPTARG"
X	    ;;
X	a)
X	    action="${action} A:${OPTARG}"
X	    ;;
X	d)
X	    action="${action} D:${OPTARG}"
X	    ;;
X	*)
X	    usage
X	    exit 1
X    esac
Xdone
X
X#
X# Create the config file if it doesn't exist
X#
X
Xif ! [ -f ${CONF_FILE} ] ; then
X    if [ -z $dry_run ] ; then
X	echo "${ME}: WARNING -- no config file found, " \
X	    "creating initial ${CONF_FILE}" >&2
X	generate_conf 1 '' > ${CONF_FILE}
X    else
X	echo "${ME}: WARNING -- no config file found, " \
X	    "dry run: this is what would have been generated" >&2
X	generate_conf 1 '' >&2
X	exit 0
X    fi
Xfi
X
X#
X# Update and modify the list of run-depends
X#
X
XRUN_DEPS=$( update_run_deps ${CONF_FILE} )
X
Xfor a in $action ; do
X    case ${a%%:*} in
X	A)
X	    # Add a port or ports
X	    RUN_DEPS=$( add_dependency "${a#*:}" "$RUN_DEPS" ) >&1
X	    ;;
X	D)
X	    # Remove a port or ports
X	    RUN_DEPS=$( delete_dependency "${a#*:}" "$RUN_DEPS" ) >&1
X	    ;;
X    esac
Xdone
X
X#
X# Maybe write out the result to the config file, bumping the
X# PORTREVISION from the installed version of %%PORTNAME%%
X#
X
Xrevision=$( increment_revision $INSTALLED_PKG )
X
Xif [ -z $dry_run ] ; then
X    # Do it 
X    update_wanted_ports_conf $CONF_FILE $revision "$RUN_DEPS"
Xelse
X    echo "Dry run -- this is what would have been generated:"
X    generate_conf $revision "$RUN_DEPS"
Xfi
X
X#
X# That's All Folks!
X#
29738bebff289eac2eae58d35e5e1b73
echo x - wanted-ports/files/wanted-ports.pod
sed 's/^X//' >wanted-ports/files/wanted-ports.pod << 'c2ae8b7d6360d756e25fed5d7053ce3d'
X=head1 NAME
X
X%%PORTNAME%% -- depend on the ports that you want installed
X
X=head1 SYNOPSIS
X
XB<%%PORTNAME%%> [B<-n>] [B<-f> F<config>] [B<-a|-d> F<portname>]]
X
X=head1 DESCRIPTION
X
XB<%%PORTNAME%%> is a small port that simply has a user modifiable list
Xof run-time dependencies.  The idea is that by marking a port as
Xwanted, it adds a double check helping to prevent accidental deletion
Xof the ports you really want to have installed.  L<pkg_delete(1)> will
Xrefuse to delete a port when that port is a dependency required by
Xsome other installed port, unless you give the B<-f> option to force
Xthe action.
X
XB<%%PORTNAME%%> can also be used as a means to automate installing the
Xrequired software load on a server.
X
X=head2 Using B<%%PORTNAME%%>
X
XThe first time you run the B<%%PORTNAME%%> script, it will generate a
Xskeleton configuration file.  Run B<%%PORTNAME%%> to modify the list
Xof ports that you want to have marked.  This will automatically
Xincrement the C<PORTREVISION> of B<%%PORTNAME%%>, marking the
XF<ports-mgmt/%%PORTNAME%%> port to be updated, eg. the next time that
XL<portmaster(8)> or L<portupgrade(1)> is run.
X
XUpdating or reinstalling the port will cause the ports system to force
Xall of the marked ports to be installed, using the standard dependency
Xresolution mechanisms of the ports.
X
X=head1 OPTIONS
X
X=over 8
X
X=item B<-n>
X
XDry-run.  Causes B<%%PORTNAME%%> not to update the configuration file,
Xbut instead to display what the final result would have been.
X
X=item B<-f> F<config>
X
XRead and modify an alternate configuration file.  F<config> should be
Xthe full path to the alternate file.  I<Note:> when updating the
XF<ports-management/%%PORTNAME%%> port, set C<CFGFILE> or
XC<WANTEDPORTSCFG> in the L<make(1)> environment to achieve the same
Xeffect.
X
X=item B<-a> F<portname>
X
XAdd dependencies.  Find all matching package names or port paths from
Xthe F<INDEX> file, and prompt the user whether to add any that are not
Xalready listed as dependencies in the configuration file.
X
X=item B<-d> F<portname>
X
XDelete dependencies. Find all matching package names or port paths
Xfrom the F<INDEX> file, and prompt the user whether to delete any that
Xare currently listed as dependencies in the configuration file.
X
X=back
X
XThe add B<-a> and delete B<-d> options are processed in the order
Xgiven on the command line, so a later option can override an earlier
Xone.  The F<portname> argument will match any substring of the port or
Xpackage name: care should be taken that you don't accidentally match
Xunintended items.  You can anchor searches to start or end of item
Xusing C<^> or C<$>.
X
X=head1 FILES
X
X=over 16
X
X=item F</var/db/%%PORTNAME%%.conf>
X
XThe default configuration file used by B<%%PORTNAME%%>.  This is a
XF<makefile> snippet, that will be included by
XF<ports-mgmt/%%PORTNAME%%/Makefile>.  A skeleton version will be
Xcreated by B<%%PORTNAME%%> if it doesn't exist.  The B<%%PORTNAME%%>
Xscript exists to add or remove C<RUN_DEPENDS> entries and update the
XC<PORTREVISION> setting.
X
X=back
X
X=head1 ENVIRONMENT
X
XThe following environment variables affect the operation of
XB<%%PORTNAME%%>.  C<PORTSDIR>, C<INDEXFILE> and C<WANTEDPORTSCFG>
Xoverride the system default settings: normally they will not need to
Xbe set.  C<USER> and C<LOGNAME> are standard settings, from
XL<login(1)>.
X
X=over 16
X
X=item C<PORTSDIR>
X
XAs in L<ports(7)>, the location where the ports tree is installed.
XDefault F</usr/ports>
X
X=item C<INDEXFILE>
X
XAs in L<ports(7)>, overrides the automatic logic to determine the name
Xof the index file.  Default F<INDEX-I<N>> where I<N> is the OS major
Xversion number.
X
X=item C<USER>
X
X=item C<LOGNAME>
X
XThe name of the user running the script.  If neither are set, uses
XC<an unknown user>.
X
X=item C<WANTEDPORTSCFG>
X
XOverride the default location of the configuration file.  Using the
XB<-f config> command line option superceeds this setting.  Default
XF</var/db/%%PORTNAME%%.conf>
X
X=back
X
X=head1 SEE ALSO
X
XL<ports(7)>, L<pkg_delete(1)>, L<pkg_cutleaves(1)>, L<portmaster(8)>,
XL<portupgrade(1)>
X
X=cut
c2ae8b7d6360d756e25fed5d7053ce3d
echo x - wanted-ports/files/wanted-ports.1.in
sed 's/^X//' >wanted-ports/files/wanted-ports.1.in << 'ea9e87e226b4a29c5831ca725b442e8e'
X.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
X.\"
X.\" Standard preamble:
X.\" ========================================================================
X.de Sp \" Vertical space (when we can't use .PP)
X.if t .sp .5v
X.if n .sp
X..
X.de Vb \" Begin verbatim text
X.ft CW
X.nf
X.ne \\$1
X..
X.de Ve \" End verbatim text
X.ft R
X.fi
X..
X.\" Set up some character translations and predefined strings.  \*(-- will
X.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
X.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
X.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
X.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
X.\" nothing in troff, for use with C<>.
X.tr \(*W-
X.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
X.ie n \{\
X.    ds -- \(*W-
X.    ds PI pi
X.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
X.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
X.    ds L" ""
X.    ds R" ""
X.    ds C` ""
X.    ds C' ""
X'br\}
X.el\{\
X.    ds -- \|\(em\|
X.    ds PI \(*p
X.    ds L" ``
X.    ds R" ''
X'br\}
X.\"
X.\" Escape single quotes in literal strings from groff's Unicode transform.
X.ie \n(.g .ds Aq \(aq
X.el       .ds Aq '
X.\"
X.\" If the F register is turned on, we'll generate index entries on stderr for
X.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
X.\" entries marked with X<> in POD.  Of course, you'll have to process the
X.\" output yourself in some meaningful fashion.
X.ie \nF \{\
X.    de IX
X.    tm Index:\\$1\t\\n%\t"\\$2"
X..
X.    nr % 0
X.    rr F
X.\}
X.el \{\
X.    de IX
X..
X.\}
X.\"
X.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
X.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
X.    \" fudge factors for nroff and troff
X.if n \{\
X.    ds #H 0
X.    ds #V .8m
X.    ds #F .3m
X.    ds #[ \f1
X.    ds #] \fP
X.\}
X.if t \{\
X.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
X.    ds #V .6m
X.    ds #F 0
X.    ds #[ \&
X.    ds #] \&
X.\}
X.    \" simple accents for nroff and troff
X.if n \{\
X.    ds ' \&
X.    ds ` \&
X.    ds ^ \&
X.    ds , \&
X.    ds ~ ~
X.    ds /
X.\}
X.if t \{\
X.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
X.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
X.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
X.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
X.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
X.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
X.\}
X.    \" troff and (daisy-wheel) nroff accents
X.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
X.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
X.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
X.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
X.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
X.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
X.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
X.ds ae a\h'-(\w'a'u*4/10)'e
X.ds Ae A\h'-(\w'A'u*4/10)'E
X.    \" corrections for vroff
X.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
X.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
X.    \" for low resolution devices (crt and lpr)
X.if \n(.H>23 .if \n(.V>19 \
X\{\
X.    ds : e
X.    ds 8 ss
X.    ds o a
X.    ds d- d\h'-1'\(ga
X.    ds D- D\h'-1'\(hy
X.    ds th \o'bp'
X.    ds Th \o'LP'
X.    ds ae ae
X.    ds Ae AE
X.\}
X.rm #[ #] #H #V #F C
X.\" ========================================================================
X.\"
X.IX Title "WANTED-PORTS 1"
X.TH WANTED-PORTS 1 "2010-06-12" "perl v5.10.1" "User Contributed Perl Documentation"
X.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
X.\" way too many mistakes in technical documents.
X.if n .ad l
X.nh
X.SH "NAME"
X%%PORTNAME%% \-\- depend on the ports that you want installed
X.SH "SYNOPSIS"
X.IX Header "SYNOPSIS"
X\&\fB%%PORTNAME%%\fR [\fB\-n\fR] [\fB\-f\fR \fIconfig\fR] [\fB\-a|\-d\fR \fIportname\fR]]
X.SH "DESCRIPTION"
X.IX Header "DESCRIPTION"
X\&\fB%%PORTNAME%%\fR is a small port that simply has a user modifiable list
Xof run-time dependencies.  The idea is that by marking a port as
Xwanted, it adds a double check helping to prevent accidental deletion
Xof the ports you really want to have installed.  \fIpkg_delete\fR\|(1) will
Xrefuse to delete a port when that port is a dependency required by
Xsome other installed port, unless you give the \fB\-f\fR option to force
Xthe action.
X.PP
X\&\fB%%PORTNAME%%\fR can also be used as a means to automate installing the
Xrequired software load on a server.
X.SS "Using \fB%%PORTNAME%%\fP"
X.IX Subsection "Using %%PORTNAME%%"
XThe first time you run the \fB%%PORTNAME%%\fR script, it will generate a
Xskeleton configuration file.  Run \fB%%PORTNAME%%\fR to modify the list
Xof ports that you want to have marked.  This will automatically
Xincrement the \f(CW\*(C`PORTREVISION\*(C'\fR of \fB%%PORTNAME%%\fR, marking the
X\&\fIports\-mgmt/%%PORTNAME%%\fR port to be updated, eg. the next time that
X\&\fIportmaster\fR\|(8) or \fIportupgrade\fR\|(1) is run.
X.PP
XUpdating or reinstalling the port will cause the ports system to force
Xall of the marked ports to be installed, using the standard dependency
Xresolution mechanisms of the ports.
X.SH "OPTIONS"
X.IX Header "OPTIONS"
X.IP "\fB\-n\fR" 8
X.IX Item "-n"
XDry-run.  Causes \fB%%PORTNAME%%\fR not to update the configuration file,
Xbut instead to display what the final result would have been.
X.IP "\fB\-f\fR \fIconfig\fR" 8
X.IX Item "-f config"
XRead and modify an alternate configuration file.  \fIconfig\fR should be
Xthe full path to the alternate file.  \fINote:\fR when updating the
X\&\fIports\-management/%%PORTNAME%%\fR port, set \f(CW\*(C`CFGFILE\*(C'\fR or
X\&\f(CW\*(C`WANTEDPORTSCFG\*(C'\fR in the \fImake\fR\|(1) environment to achieve the same
Xeffect.
X.IP "\fB\-a\fR \fIportname\fR" 8
X.IX Item "-a portname"
XAdd dependencies.  Find all matching package names or port paths from
Xthe \fI\s-1INDEX\s0\fR file, and prompt the user whether to add any that are not
Xalready listed as dependencies in the configuration file.
X.IP "\fB\-d\fR \fIportname\fR" 8
X.IX Item "-d portname"
XDelete dependencies. Find all matching package names or port paths
Xfrom the \fI\s-1INDEX\s0\fR file, and prompt the user whether to delete any that
Xare currently listed as dependencies in the configuration file.
X.PP
XThe add \fB\-a\fR and delete \fB\-d\fR options are processed in the order
Xgiven on the command line, so a later option can override an earlier
Xone.  The \fIportname\fR argument will match any substring of the port or
Xpackage name: care should be taken that you don't accidentally match
Xunintended items.  You can anchor searches to start or end of item
Xusing \f(CW\*(C`^\*(C'\fR or \f(CW\*(C`$\*(C'\fR.
X.SH "FILES"
X.IX Header "FILES"
X.IP "\fI/var/db/%%PORTNAME%%.conf\fR" 16
X.IX Item "/var/db/%%PORTNAME%%.conf"
XThe default configuration file used by \fB%%PORTNAME%%\fR.  This is a
X\&\fImakefile\fR snippet, that will be included by
X\&\fIports\-mgmt/%%PORTNAME%%/Makefile\fR.  A skeleton version will be
Xcreated by \fB%%PORTNAME%%\fR if it doesn't exist.  The \fB%%PORTNAME%%\fR
Xscript exists to add or remove \f(CW\*(C`RUN_DEPENDS\*(C'\fR entries and update the
X\&\f(CW\*(C`PORTREVISION\*(C'\fR setting.
X.SH "ENVIRONMENT"
X.IX Header "ENVIRONMENT"
XThe following environment variables affect the operation of
X\&\fB%%PORTNAME%%\fR.  \f(CW\*(C`PORTSDIR\*(C'\fR, \f(CW\*(C`INDEXFILE\*(C'\fR and \f(CW\*(C`WANTEDPORTSCFG\*(C'\fR
Xoverride the system default settings: normally they will not need to
Xbe set.  \f(CW\*(C`USER\*(C'\fR and \f(CW\*(C`LOGNAME\*(C'\fR are standard settings, from
X\&\fIlogin\fR\|(1).
X.ie n .IP """PORTSDIR""" 16
X.el .IP "\f(CWPORTSDIR\fR" 16
X.IX Item "PORTSDIR"
XAs in \fIports\fR\|(7), the location where the ports tree is installed.
XDefault \fI/usr/ports\fR
X.ie n .IP """INDEXFILE""" 16
X.el .IP "\f(CWINDEXFILE\fR" 16
X.IX Item "INDEXFILE"
XAs in \fIports\fR\|(7), overrides the automatic logic to determine the name
Xof the index file.  Default \fI\s-1INDEX\-\s0\fIN\fI\fR where \fIN\fR is the \s-1OS\s0 major
Xversion number.
X.ie n .IP """USER""" 16
X.el .IP "\f(CWUSER\fR" 16
X.IX Item "USER"
X.PD 0
X.ie n .IP """LOGNAME""" 16
X.el .IP "\f(CWLOGNAME\fR" 16
X.IX Item "LOGNAME"
X.PD
XThe name of the user running the script.  If neither are set, uses
X\&\f(CW\*(C`an unknown user\*(C'\fR.
X.ie n .IP """WANTEDPORTSCFG""" 16
X.el .IP "\f(CWWANTEDPORTSCFG\fR" 16
X.IX Item "WANTEDPORTSCFG"
XOverride the default location of the configuration file.  Using the
X\&\fB\-f config\fR command line option superceeds this setting.  Default
X\&\fI/var/db/%%PORTNAME%%.conf\fR
X.SH "SEE ALSO"
X.IX Header "SEE ALSO"
X\&\fIports\fR\|(7), \fIpkg_delete\fR\|(1), \fIpkg_cutleaves\fR\|(1), \fIportmaster\fR\|(8),
X\&\fIportupgrade\fR\|(1)
ea9e87e226b4a29c5831ca725b442e8e
echo x - wanted-ports/Makefile
sed 's/^X//' >wanted-ports/Makefile << 'd41fac3a8eb8afbe9c8662c1d4f24e93'
X# New ports collection makefile for:  wanted-ports
X# Date created:    7 June 2010
X# Whom:            Matthew Seaman <m.seaman@infracaninophile.co.uk>
X#
X# $FreeBSD$
X#
X# port is self-contained in the files directory.
X
XPORTNAME=	wanted-ports
XPORTVERSION=	0.1
X#PORTREVISION is set from ${CFGFILE}
XCATEGORIES=	ports-mgmt
XMASTER_SITES=	# none
XDISTFILES=	# none
X
XMAINTAINER=	m.seaman@infracaninphile.co.uk
XCOMMENT=	Just depend on a configurable, arbitrary set of other ports
X
XLICENSE=	BSD
X
XNO_BUILD=	yes
XSUB_FILES=	${PORTNAME}   \
X		${PORTNAME}.1
XSUB_LIST=	PORTNAME=${PORTNAME} \
X		PKGNAME=${PKGNAME}
XPLIST_SUB=	PORTNAME=${PORTNAME}
XPLIST_FILES=	bin/${PORTNAME}
X
XMAN1=		${PORTNAME}.1
X
X.if defined(WANTEDPORTSCFG)
XCFGFILE=	${WANTEDPORTSCFG}
X.else
XCFGFILE?=	/var/db/${PORTNAME}.conf
X.endif
X
X.if exists(${CFGFILE})
X.include "${CFGFILE}"
X.endif
X
Xdo-install:
X	${INSTALL_SCRIPT} ${WRKDIR}/${PORTNAME} ${PREFIX}/bin/${PORTNAME}
X.if !defined(NOPORTDOCS)
X	${INSTALL_MAN} ${WRKDIR}/${PORTNAME}.1 ${MANPREFIX}/man/man1/
X.endif
X
X.include <bsd.port.mk>
d41fac3a8eb8afbe9c8662c1d4f24e93
echo x - wanted-ports/pkg-descr
sed 's/^X//' >wanted-ports/pkg-descr << '5aa05ff35487ec39c75d243baba4a061'
XA special meta-port to do nothing but register dependencies on those
Xports you specifically want to have installed.  The normal dependency
Xchecking in programs like pkg_delete(1) will prevent easy deletion of
Xports that other ports depend on.  Keeps egg off face.  Protects feet
Xfrom being shot.
5aa05ff35487ec39c75d243baba4a061
exit
--- wanted-ports.shar ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006121010.o5CAAcgK012486>