:
}
+# ============= Show installed ports which have been neither upgraded or reinstalled from the initial state =============
+database_query_show_list_fossil ()
+{
+ local srclist origin pkg
+ srclist=`ls "${DBDIR}"/fossil_pkgs/fossil_since_* | head -n 1`
+ [ -e "$srclist" ] || return 0
+ while read origin
+ do
+ pkg=`pkgsys_get_init_pkg_from_orig "$origin"`
+ pkg_info_e "$pkg" || continue
+ printf '%s\t%s\n' "$origin" "$pkg"
+ done < $srclist
+}
+
# ============= Insert initial flavored origins to a list of flavored origins =============
database_query_add_initial_origins ()
{
fi
}
+# ============= Get a configured value of a port =============
+database_query_get_config_val ()
+{
+ local origin variable dbdir cache value
+ origin=$1
+ variable=$2
+ dbfile=${DBDIR}/conf/each_port/$origin/$variable.conf
+ cat "$dbfile" 2> /dev/null || :
+}
+
# ============= Check whether configurations for a port is default =============
database_query_is_default_conf ()
{
level=$5
shift 5
message_echo "[$grandtitle]"
- message_dependency_scope
+ message_dependency_scope "$deptag" "$level"
message_echo
isfirst=y
for origin_target in `pkgsys_eval_ports_glob "$@"`
# ============= Output of "show" command for port lists =============
database_query_show_port_lists ()
{
- local grandtitle title list listdb pkgnamedb isfirst origin_target pkg_target table_target list_target
+ local grandtitle title list listdb pkgnamedb deptag level isfirst origin_target pkg_target table_target list_target
grandtitle=$1
title=$2
list=$3
listdb=$4
pkgnamedb=$5
- shift 5
+ deptag=$6
+ level=$7
+ shift 7
message_echo "[$grandtitle]"
- message_dependency_scope
+ message_dependency_scope "$deptag" "$level"
message_echo
isfirst=y
for origin_target in `pkgsys_eval_ports_glob "$@"`
:
}
+# ============= Output of "show" command for log files =============
+database_query_show_log ()
+{
+ local grandtitle title list listdb pkgnamedb isfirst origin_target pkg_target table_target list_target
+ grandtitle=$1
+ title=$2
+ list=$3
+ listdb=$4
+ pkgnamedb=$5
+ shift 5
+ message_echo "[$grandtitle]"
+ message_echo
+ isfirst=y
+ for origin_target in `pkgsys_eval_ports_glob "$@"`
+ do
+ pkg_target=
+ for table_target in $pkgnamedb
+ do
+ pkg_target=`cat "${DBDIR}/$table_target/$origin_target/pkgtag" 2> /dev/null` || :
+ [ -n "$pkg_target" ] && break
+ done
+ [ -n "$pkg_target" ] || continue
+ [ "$isfirst" = y ] || message_echo
+ isfirst=n
+ [ $opt_batch_mode = no ] && printf "$title\n" "$origin_target ($pkg_target)"
+ list_target=
+ for table_target in $listdb
+ do
+ list_target=${DBDIR}/$table_target/$origin_target/$list
+ [ -e "$list_target" ] && break
+ done
+ [ -e "$list_target" ] || continue
+ cat < $list_target
+ echo
+ done
+ if [ "$isfirst" = y ]
+ then
+ message_echo "ERROR: No inspected port matches the glob(s)." >&2
+ exit 1
+ fi
+ :
+}
+
# ============= Output of "show" command for two column lists =============
database_query_show_two_column_lists ()
{
# ============= Output of "show" command for a single list =============
database_query_show_single_list ()
{
- local list pkgnamedb flag_filter_skip_unchanged flag_filter_only_target tmpflag_exists put_blankline
+ local list pkgnamedb flag_filter_skip_unchanged flag_filter_only_target flag_negative_listdb tmpflag_exists put_blankline origin matches flag pkg table
+ local currentorigin_is_alll currentorigin_is_target currentorigin_is_requires_requirements
+ local currentorigin_is_initial_requirements currentorigin_is_requires_dependents
+ local currentorigin_is_initial_dependents currentorigin_is_requires_requirements_complement currentorigin_is_relevant
list=$1
pkgnamedb=$2
flag_filter_skip_unchanged=$3
flag_filter_only_target=$4
+ flag_negative_listdb=$5
tmpflag_exists=${TMPDIR}/database_query_show_single_list::exists_item
if [ `cat "${DBDIR}/$list" 2> /dev/null | wc -l` -eq 0 ]
then
[ -n "$put_blankline" ] && message_echo
while read origin
do
- [ -n "$flag_filter_skip_unchanged" -a $opt_skip_unchanged = yes \
- -a ! -e "${DBDIR}/requires/$origin/$flag_filter_skip_unchanged" ] \
- && continue
+ [ -n "$flag_negative_listdb" ] && grep -Fx "$origin" "${DBDIR}/$flag_negative_listdb" 2> /dev/null && continue
+ if [ -n "$flag_filter_skip_unchanged" -a $opt_skip_unchanged = yes ]
+ then
+ matches=no
+ for flag in $flag_filter_skip_unchanged
+ do
+ if [ -e "${DBDIR}/requires/$origin/$flag" ]
+ then
+ matches=yes
+ break
+ fi
+ done
+ [ $matches = no ] && continue
+ fi
if [ -n "$flag_filter_only_target" ]
then
database_query_get_target_attributes currentorigin "$origin"
fileedit_exists_old_lines "$tmpfile_old" "$tmpfile_new"
}
+# ============= Show moved or replaced ports to alternatives =============
+database_query_show_list_moved ()
+{
+ cat "${DBDIR}/moved_ports" 2> /dev/null | while read origin
+ do
+ lastorigin=$origin
+ while [ -n "$lastorigin" -a -e "${DBDIR}/replace/$lastorigin/origin" ]
+ do
+ lastorigin=`cat "${DBDIR}/replace/$lastorigin/origin"`
+ done
+ [ -n "$lastorigin" ] || continue
+ pkg=
+ for table in $pkgnamedb
+ do
+ pkg=`cat "${DBDIR}/$table/$origin/pkgtag" 2> /dev/null` || :
+ [ -n "$pkg" ] && break
+ done
+ [ -n "$pkg" ] || pkg='not installed'
+ lastpkg=
+ for table in moved_from obsolete initial
+ do
+ lastpkg=`cat "${DBDIR}/$table/$lastorigin/pkgtag" 2> /dev/null` || :
+ [ -n "$lastpkg" ] && break
+ done
+ [ -n "$lastpkg" ] || lastpkg='not installed'
+ if [ $opt_batch_mode = no ]
+ then
+ echo "$origin ($pkg) => $lastorigin ($lastpkg)"
+ else
+ printf '%s\t%s\t%s\t%s\n' "$origin" "$pkg" "$lastorigin" "$lastpkg"
+ fi
+ done
+}
+
# ============= Actual operations of "show" command for a single list =============
database_query_show_single_list_exec ()
{
- local subject deptag level dbsuffix flag_filter_skip_unchanged flag_filter_only_target pkgnamedb
+ local subject deptag level dbsuffix flag_filter_skip_unchanged flag_filter_only_target flag_negative_listdb pkgnamedb
subject=$1
deptag=$2
level=$3
dbsuffix=$deptag.$level
flag_filter_skip_unchanged=
flag_filter_only_target=
- pkgnamedb='requires obsolete initial'
+ flag_negative_listdb=
+ pkgnamedb='moved_from obsolete initial'
case $subject in
todo )
message_echo "The following ports remain in the (re)installation queue for the current do/redo process:"
message_echo "It is noted that ports to be skipped can be included here."
- message_dependency_scope
+ message_dependency_scope "$deptag" "$level"
message_echo
list=stage.loop_list/reinst_todo.remain
[ ${DBDIR}/reinst_order.list -nt ${DBDIR}/$list ] && list=reinst_order.list
;;
done )
message_echo "The following ports have been successfully (re)installed or newly installed:"
- message_dependency_scope
+ message_dependency_scope "$deptag" "$level"
message_echo
list=success.$dbsuffix.list
flag_filter_skip_unchanged=necessary_upgrade_completed.$dbsuffix
flag_filter_only_target=y
;;
redo )
- message_echo "The following ports need (re)installation but are to be skipped until any of their failed requirements succeeds:"
- message_dependency_scope
+ message_echo "The following ports need (re)installation after success of the all requirements:"
+ message_dependency_scope "$deptag" "$level"
message_echo
list=todo_after_requirements_succeed.$dbsuffix.list
- flag_filter_skip_unchanged=necessary_upgrade.$dbsuffix
+ flag_filter_skip_unchanged="necessary_upgrade.$dbsuffix necessary_upgrade_completed.$dbsuffix"
flag_filter_only_target=y
+ flag_negative_listdb=leaf_ports_to_delete.unselected
;;
resolved )
message_echo "The following ports had problems which have been manually resolved:"
message_echo
list=manually_done.list
;;
+ inst_by_pkg )
+ message_echo "The following ports are configured default and installed by prebuilt packages"
+ message_echo
+ list=installation_complete_by_pkg.list
+ ;;
+ inst_built_default )
+ message_echo "The following ports are configured default and installed by ports"
+ message_echo
+ list=inst_by_port_with_default_conf.list
+ ;;
+ inst_built_custom )
+ message_echo "The following ports are configured non-default and installed by ports"
+ message_echo
+ list=inst_by_port_with_custom_conf.list
+ ;;
failure )
message_echo "The following ports experienced failures and kept to be old or uninstalled:"
message_echo
database_query_show_list_failure
return
;;
+ fossil )
+ message_echo "The following ports are neither upgraded or reinstalled from the initial state:"
+ message_echo
+ database_query_show_list_fossil
+ return
+ ;;
conflict )
message_echo "The following ports are temporarily deleted due to conflict:"
message_echo
database_query_show_list_failed_conflicts_restoration
return
;;
+ moved )
+ message_echo "The following ports are moved/replaced to new alternatives:"
+ message_echo
+ database_query_show_list_moved
+ return
+ ;;
taboo )
message_echo "The following ports are registered as taboo:"
message_echo
message_echo "The following leaf, obsolete or unneeded ports had been once deleted but are to be or have been restored:"
message_echo
list=stage.loop_list/ports_to_restore
- pkgnamedb='obsolete initial'
+ pkgnamedb='moved_from obsolete initial'
flag_filter_only_target=y
;;
deleted )
message_echo "The following leaf, obsolete or unneeded ports are to be or have been deleted:"
message_echo
list=stage.loop_list/ports_to_delete
- pkgnamedb='obsolete initial'
+ pkgnamedb='moved_from obsolete initial'
+ flag_filter_only_target=y
+ ;;
+ leaves )
+ if [ -z "$deptag" ]
+ then
+ message_echo "The following ports are all detected leaf ports:"
+ list=leaf_ports
+ else
+ message_echo "The following ports are all $deptag leaf ports:"
+ list=leaf_ports_to_delete.$deptag
+ fi
+ message_echo
+ pkgnamedb='moved_from obsolete initial'
+ flag_filter_only_target=y
+ ;;
+ obsolete )
+ if [ -z "$deptag" ]
+ then
+ message_echo "The following ports are all detected obsolete ports:"
+ list=obsolete_ports.can_be_deleted
+ else
+ message_echo "The following ports are all $deptag obsolete ports:"
+ list=obsolete_ports_to_delete.$deptag
+ fi
+ message_echo
+ pkgnamedb='moved_from obsolete initial'
flag_filter_only_target=y
;;
esac
database_query_show_single_list "$list" "$pkgnamedb" \
- "$flag_filter_skip_unchanged" "$flag_filter_only_target"
+ "$flag_filter_skip_unchanged" "$flag_filter_only_target" "$flag_negative_listdb"
}
# ============= Check whether a port is registered in a list =============
resolved )
list=manually_done.list
;;
+ inst_by_pkg )
+ list=installation_complete_by_pkg.list
+ ;;
+ inst_built_default )
+ list=inst_by_port_with_default_conf.list
+ ;;
+ inst_built_custom )
+ list=inst_by_port_with_custom_conf.list
+ ;;
failure )
list=failed.list
;;
+ fossil )
+ list=`ls "${DBDIR}"/fossil_pkgs/fossil_since_* | head -n 1`
+ ;;
conflict )
grep -v -E -f "${DBDIR}/ports_to_delete.grep_pattern_col1" "${DBDIR}/deleted_conflicts" 2> /dev/null \
| grep -q -E "^${origin_esc}[[:space:]]"
{
[ `cat "${DBDIR}/new_success_in_current_run" 2> /dev/null | wc -l` -gt 0 ]
}
+
+# ============= Get the all initial origins, separated by line feed =============
+database_query_initial_orgins ()
+{
+ local origin origin_init
+ origin=$1
+ if [ -e "${DBDIR}/moved_from/$origin/old_origs" ]
+ then
+ for origin_init in `cat "${DBDIR}/moved_from/$origin/old_origs"`
+ do
+ [ -e "${DBDIR}/initial/$origin_init/installed_version" ] && echo "$origin_init"
+ done
+ else
+ [ -e "${DBDIR}/initial/$origin/installed_version" ] && echo "$origin"
+ fi
+ :
+}