# ================================================
APPNAME=`basename $0`
-MYVERSION=1.1.0+toward_1.2.0_20120726051358
+MYVERSION=1.1.0+toward_1.2.0_20120728230120
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
echo " | ok del globs... | taboo add globs... | taboo del globs..."
echo " | save [dir] | load path"
echo " | show todo | show done | show resolved | show failure | show taboo"
- echo " | show deleted"
+ echo " | show deleted | show requirements glob | show dependents glob"
echo
echo "[DESCRIPTIONS]"
echo " This utility is an alternative to portupgrade(1) and portmaster(8), and"
echo " taboo del glob1 [glob2 ...]: deregister taboo ports"
echo " save [dir] : save the current temporal database as a .tar.gz archive"
echo " load path : load a temporal database archive"
- echo " show [arg] : show the list of ports to be reinstalled"
+ echo " show [args] : show the list of ports to be reinstalled"
echo " todo : ports to be reinstalled (default)"
echo " done : already reinstalled ports"
echo " resolved : manually reinstalled ports"
echo " failure : failed ports"
echo " taboo : taboo ports"
echo " deleted : obsolete ports to be or have been deleted"
+ echo " requirements glob : ports required by a port identified by glob"
+ echo " dependents glob : ports depending on a port identified by glob"
echo
echo "[CONFIGURATION FILE]"
echo " ${CONFFILE}"
done < ${DBDIR}/failed.list
}
+_get_one_port_from_an_argument_as_a_glob ()
+{
+ local target_glog num_matches
+ target_glog=$1
+ [ -n "$target_glog" ] || { echo "ERROR: the argument as port glob is missing" >&2; return 1; }
+ ports_glob "$2" > ${TMPDIR}/_get_one_port_from_an_argument_as_a_glob:ports_glob_argements
+ num_matches=`cat "${TMPDIR}"/_get_one_port_from_an_argument_as_a_glob:ports_glob_argements | wc -l`
+ [ $num_matches -ge 1 ] || { echo "ERROR: no matching port for the glob" >&2; return 1; }
+ [ $num_matches -eq 1 ] || { echo "ERROR: multiple matching ports for the glob" >&2; return 1; }
+ origin_target=`cat "${TMPDIR}"/_get_one_port_from_an_argument_as_a_glob:ports_glob_argements`
+ [ -e "${DBDIR}/requires/$origin_target/pkgtag" ] || { echo "ERROR: the database for $origin_target is not ready" >&2; return 1; }
+ pkg_target=`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`
+}
+
_chk_if_target ()
{
_is_all=y
[ -d "${DBDIR}" ] || { echo "ERROR: Database has not built yet." >&2; exit 1; }
warn_update_ports
_filter_skip_unchanged=
+ _filter_only_target=
pkgnamedb=requires
case ${1:-todo} in
todo)
list=reinst_todo.list
[ -e "${DBDIR}/reinst_todo.list" ] || list=reinst_order.list
_filter_skip_unchanged=necessary_update
+ _filter_only_target=y
;;
done)
echo "The following ports have been successfully reinstalled or newly installed:"
list=success.list
_filter_skip_unchanged=necessary_update_completed
+ _filter_only_target=y
;;
redo)
echo "The following ports themselves have been successfully reinstalled or newly installed,"
echo "but are to be reinstalled again because their dependencies were failed:"
list=success_but_dependencies_failed.list
_filter_skip_unchanged=necessary_update
+ _filter_only_target=y
;;
resolved)
echo "The following ports had problems which have been manually resolved:"
echo "The following ports are to be or have been deleted:"
list=moved_or_lost.actual.list
pkgnamedb=obsolete
+ _filter_only_target=y
+ ;;
+ requirements)
+ _get_one_port_from_an_argument_as_a_glob "$2"
+ pkg_target=`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`
+ echo "The following ports are required by $origin_target ($pkg_target):"
+ list=requires/$origin_target/requires
+ ;;
+ dependents)
+ _get_one_port_from_an_argument_as_a_glob "$2"
+ echo "The following ports depend on $origin_target ($pkg_target):"
+ list=requires/$origin_target/dependents
;;
*)
echo "ERROR: Invalid show argument [$1]" >&2
while read origin
do
[ -e "${DBDIR}/requires/$origin/${_filter_skip_unchanged}" ] || continue
+ if [ -n "${_filter_only_target}" ]
+ then
+ _chk_if_target "$origin"
+ [ -n "${_is_all}${_is_target}${_is_dependent}${_is_required}" ] || continue
+ fi
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
else
while read origin
do
+ if [ -n "${_filter_only_target}" ]
+ then
+ _chk_if_target "$origin"
+ [ -n "${_is_all}${_is_target}${_is_dependent}${_is_required}" ] || continue
+ fi
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
\fBtaboo\fR : taboo ports
\fBdeleted\fR : obsolete ports to be or have been deleted
+
+\fBrequirements\fR \fIglob\fR : ports required by a port identified by \fIglob\fR
+
+\fBdependents\fR \fIglob\fR : ports depending on a port identified by \fIglob\fR
.SH OPTIONS
The following options are available.
They must be given separately with each other.
Dependency relations are inspected for all installed packages as well.
Combination with options \fB\-T\f','\fB\-r\fR and \fB\-R\fR is available..
.TP
-\fB\-r\fR \fIglob
+\fB\-r\fR \fIglob\fR
Reinstall only target ports and their dependents.
This option can be given multiply.
The difference from \fB\-t\fR is that only one port glob can be specified.
Dependency relations are inspected for all installed packages as well.
Combination with options \fB\-t\fR, \fB\-r\fR and \fB\-R\fR is available.
.TP
-\fB\-R\fR \fIglob
+\fB\-R\fR \fIglob\fR
Reinstall only target ports and their requirements.
This option can be given multiply.
The difference from \fB\-T\fR is that only one port glob can be specified.
If you want to register permanently, set to the configuration file.
Combination with options \fB\-X\fR is available.
.TP
-\fB\-X\fR \fIglob
+\fB\-X\fR \fIglob\fR
This option can be given multiply.
The difference from \fB\-x\fR is that only one port glob can be specified.
Thus a package name with commas is available.
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-1.2.0 (26 July 2012)
+1.2.0 (28 July 2012)
[BUG FIX] Termination message is corrected (portsreinstall ok => portsreinstall ok add).
[CHANGE] Functionalities of options \fB\-t\fR and \fB\-T\fR are changed so as to prevent deinstallation of irrelevant packages.
[NEW] Options \fB\-X\fR, \fB\-r\fR and \fB\-R\fR are added so as to compensate a fact that \fB\-x\fR, \fB\-t\fR and \fB\-T\fR cannot specify package names with commas.
[CHANGE] Use of commas as delimiters in \fBok\fR and \fBtaboo\fR commands is abolished.
+
+[CHANGE] The specification of \fBshow\fR command is changed to exclude irrelevant packages/ports when options \fB\-r\fR, \fB\-R\fR, \fB\-t\fR and \fB\-T\fR are enabled.
+
+[NEW] Commands of \fBshow requirements\fR and \fBshow dependents\fR are added.
.TP
1.1.0 (28 April 2012)
[NEW] Command of show deleted is newly added.
\fBtaboo\fR : taboo ports
\fBdeleted\fR : obsolete ports to be or have been deleted
+
+\fBrequirements\fR \fIglob\fR : ports required by a port
+
+\fBdependents\fR \fIglob\fR : ports depending on a port
.SH OPTIONS
The following options are available.
They must be given separately with each other.
.SH HISTORY
\fBportsreinstall\fR has been developed as below.
.TP
-1.2.0 (26 July 2012)
+1.2.0 (28 July 2012)
[BUG FIX] Termination message is corrected (portsreinstall ok => portsreinstall ok add).
-[CHANGE] Functionalities of options -t and -T are changed so as to prevent deinstallation of irrelevant packages.
+[CHANGE] Functionalities of options \fB\-t\fR and \fB\-T\fR are changed so as to prevent deinstallation of irrelevant packages.
-[NEW] Options -X, -r and -R are added so as to compensate a fact that -x, -t and -T cannot specify package names with commas.
+[NEW] Options \fB\-X\fR, \fB\-r\fR and \fB\-R\fR are added so as to compensate a fact that \fB\-x\fR, \fB\-t\fR and \fB\-T\fR cannot specify package names with commas.
[CHANGE] Use of commas as delimiters in \fBok\fR and \fBtaboo\fR commands is abolished.
+
+[CHANGE] The specification of \fBshow\fR command is changed to exclude irrelevant packages/ports when options \fB\-r\fR, \fB\-R\fR, \fB\-t\fR and \fB\-T\fR are enabled.
+
+[NEW] Commands of \fBshow requirements\fR and \fBshow dependents\fR are added.
.TP
1.1.0 (28 April 2012)
[NEW] Command of show deleted is newly added.
# ================================================
APPNAME=`basename $0`
-MYVERSION=1.1.0+toward_1.2.0_20120723065730
+MYVERSION=1.1.0+toward_1.2.0_20120726051358
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
echo " | ok del globs... | taboo add globs... | taboo del globs..."
echo " | save [dir] | load path"
echo " | show todo | show done | show resolved | show failure | show taboo"
- echo " | show deleted"
+ echo " | show deleted | show requirements glob | show dependents glob"
echo
echo "[DESCRIPTIONS]"
echo " This utility is an alternative to portupgrade(1) and portmaster(8), and"
echo " taboo del glob1 [glob2 ...]: deregister taboo ports"
echo " save [dir] : save the current temporal database as a .tar.gz archive"
echo " load path : load a temporal database archive"
- echo " show [arg] : show the list of ports to be reinstalled"
+ echo " show [args] : show the list of ports to be reinstalled"
echo " todo : ports to be reinstalled (default)"
echo " done : already reinstalled ports"
echo " resolved : manually reinstalled ports"
echo " failure : failed ports"
echo " taboo : taboo ports"
echo " deleted : obsolete ports to be or have been deleted"
+ echo " requirements glob : ports required by a port identified by glob"
+ echo " dependents glob : ports depending on a port identified by glob"
echo
echo "[CONFIGURATION FILE]"
echo " ${CONFFILE}"
done < ${DBDIR}/failed.list
}
+_get_one_port_from_an_argument_as_a_glob ()
+{
+ local target_glog num_matches
+ target_glog=$1
+ [ -n "$target_glog" ] || { echo "ERROR: the argument as port glob is missing" >&2; return 1; }
+ ports_glob "$2" > ${TMPDIR}/_get_one_port_from_an_argument_as_a_glob:ports_glob_argements
+ num_matches=`cat "${TMPDIR}"/_get_one_port_from_an_argument_as_a_glob:ports_glob_argements | wc -l`
+ [ $num_matches -ge 1 ] || { echo "ERROR: no matching port for the glob" >&2; return 1; }
+ [ $num_matches -eq 1 ] || { echo "ERROR: multiple matching ports for the glob" >&2; return 1; }
+ origin_target=`cat "${TMPDIR}"/_get_one_port_from_an_argument_as_a_glob:ports_glob_argements`
+ [ -e "${DBDIR}/requires/$origin_target/pkgtag" ] || { echo "ERROR: the database for $origin_target is not ready" >&2; return 1; }
+ pkg_target=`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`
+}
+
_chk_if_target ()
{
_is_all=y
[ -d "${DBDIR}" ] || { echo "ERROR: Database has not built yet." >&2; exit 1; }
warn_update_ports
_filter_skip_unchanged=
+ _filter_only_target=
pkgnamedb=requires
case ${1:-todo} in
todo)
list=reinst_todo.list
[ -e "${DBDIR}/reinst_todo.list" ] || list=reinst_order.list
_filter_skip_unchanged=necessary_update
+ _filter_only_target=y
;;
done)
echo "The following ports have been successfully reinstalled or newly installed:"
list=success.list
_filter_skip_unchanged=necessary_update_completed
+ _filter_only_target=y
;;
redo)
echo "The following ports themselves have been successfully reinstalled or newly installed,"
echo "but are to be reinstalled again because their dependencies were failed:"
list=success_but_dependencies_failed.list
_filter_skip_unchanged=necessary_update
+ _filter_only_target=y
;;
resolved)
echo "The following ports had problems which have been manually resolved:"
echo "The following ports are to be or have been deleted:"
list=moved_or_lost.actual.list
pkgnamedb=obsolete
+ _filter_only_target=y
+ ;;
+ requirements)
+ _get_one_port_from_an_argument_as_a_glob "$2"
+ pkg_target=`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`
+ echo "The following ports are required by $origin_target ($pkg_target):"
+ list=requires/$origin_target/requires
+ ;;
+ dependents)
+ _get_one_port_from_an_argument_as_a_glob "$2"
+ echo "The following ports depend on $origin_target ($pkg_target):"
+ list=requires/$origin_target/dependents
;;
*)
echo "ERROR: Invalid show argument [$1]" >&2
while read origin
do
[ -e "${DBDIR}/requires/$origin/${_filter_skip_unchanged}" ] || continue
+ if [ -n "${_filter_only_target}" ]
+ then
+ _chk_if_target "$origin"
+ [ -n "${_is_all}${_is_target}${_is_dependent}${_is_required}" ] || continue
+ fi
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'
else
while read origin
do
+ if [ -n "${_filter_only_target}" ]
+ then
+ _chk_if_target "$origin"
+ [ -n "${_is_all}${_is_target}${_is_dependent}${_is_required}" ] || continue
+ fi
if [ -e "${DBDIR}/$pkgnamedb/$origin/pkgtag" ]
then
echo $origin '('`cat "${DBDIR}/$pkgnamedb/$origin/pkgtag"`')'