# HG changeset patch # User Franz Glasner # Date 1730800626 -3600 # Node ID b59054f11029ff96029e196dcc3b62dc773e37c6 # Parent e18cc5fe828c18ca12230e4781d4d8e736fda5a6 fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo. While there change option handling to allow a combination of selection flags: merge all selected packages and sort if needed. diff -r e18cc5fe828c -r b59054f11029 docs/man/man8/fports.rst --- a/docs/man/man8/fports.rst Mon Nov 04 22:45:00 2024 +0100 +++ b/docs/man/man8/fports.rst Tue Nov 05 10:57:06 2024 +0100 @@ -15,6 +15,8 @@ **fports deptree** [**-l** `maxlevel`\|\ **--maxlevel**\=\ `maxlevel`] [**-r**\|\ **--reverse**] [**-t**\|\ **--list**\|\ **--transitive**] `package` ... +**fports detail** **-b**\|\ **--nofreebsd**\|\ **--no-freebsd** + **fports detail** **-n**\|\ **--noauto**\|\ **--no-auto** **fports detail** **-m**\|\ **--mapped** @@ -75,6 +77,8 @@ that depend on a given `package`. +**fports detail** **-b**\|\ **--nofreebsd**\|\ **--no-freebsd** + **fports detail** **-n**\|\ **--noauto**\|\ **--no-auto** **fports detail** **-m**\|\ **--mapped** @@ -92,6 +96,11 @@ .. program:: fports deptree + .. options:: -b, --nofreebsd, --no-freebsd + + Automatically select all packages that are *not* installed from the + standard FreeBSD repository. + .. option:: -n, --noauto, --no-auto Automatically select all packages that are *not* installed automatically. diff -r e18cc5fe828c -r b59054f11029 sbin/fports --- a/sbin/fports Mon Nov 04 22:45:00 2024 +0100 +++ b/sbin/fports Tue Nov 05 10:57:06 2024 +0100 @@ -24,6 +24,7 @@ USAGE: fports -h|--help fports -V|--version fports deptree [-l maxlevel|--maxlevel=maxlevel] [-r|--reverse] [-t|--list|--transitive] package... + fports detail -b|--nofreebsd|--no-freebsd fports detail -n|--noauto|--no-auto fports detail -m|--mapped fports detail package... @@ -350,21 +351,33 @@ # $@ local package \ + packages do_sort idx prev_package \ repositories packagemapping instver instrepo \ repo title_printed indexfile _dummy opt acookie \ pkglabel pkgdescr pkgversion mapped_package + do_sort=no + opt_nofreebsd=no opt_noauto=no opt_mapped=no - while getopts "nm-:" opt; do - postprocess_getopts_for_long "nm-:" opt "noauto" "no-auto" "mapped" "" + while getopts "bnm-:" opt; do + postprocess_getopts_for_long "nm-:" opt "nofreebsd" "no-freebsd" "noauto" "no-auto" "mapped" "" case "${opt}" in + b|nofreebsd|no-freebsd) + # shellcheck disable=SC2034 # appears unused + opt_nofreebsd=yes + do_sort=yes + ;; n|noauto|no-auto) # shellcheck disable=SC2034 # appears unused - opt_noauto=yes;; + opt_noauto=yes + do_sort=yes + ;; m|mapped) # shellcheck disable=SC2034 # appears unused - opt_mapped=yes;; + opt_mapped=yes + do_sort=yes + ;; \?) exit 2;; *) @@ -374,37 +387,51 @@ shift $((OPTIND-1)) OPTIND=1 - if checkyesno opt_noauto || checkyesno opt_mapped; then - [ $# -gt 0 ] && fatal "${EX_USAGE}" "packages are not allowed for options -n or -m" - if checkyesno opt_noauto && checkyesno opt_mapped; then - fatal "${EX_USAGE}" "cannot use -n and -m together" - fi - fi - + packages='' + farray_create packages repositories='' get_active_repositories repositories packagemapping='' init_package_mapping packagemapping indexfile="$(get_local_index_file)" + if checkyesno opt_nofreebsd; then + while IFS='|' read -r package repo; do + [ "${repo}" != 'FreeBSD' ] && farray_append packages "${package}" + done <