Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/fports @ 800:1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Autoselect packages: use all non-auto packages and use all packages with a
mapping in package-mapping.conf.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 01 Nov 2024 02:20:56 +0100 |
| parents | 96631c3886d9 |
| children | 8167b2a8b4fe |
comparison
equal
deleted
inserted
replaced
| 799:96631c3886d9 | 800:1c4d729963dc |
|---|---|
| 22 # shellcheck disable=SC2016 # no expansion | 22 # shellcheck disable=SC2016 # no expansion |
| 23 USAGE=' | 23 USAGE=' |
| 24 USAGE: fports -h | 24 USAGE: fports -h |
| 25 fports -V | 25 fports -V |
| 26 fports deptree [-l maxlevel] [-r] [-t] package... | 26 fports deptree [-l maxlevel] [-r] [-t] package... |
| 27 fports detail -A | |
| 28 fports detail -M | |
| 27 fports detail package... | 29 fports detail package... |
| 28 | 30 |
| 29 GLOBAL OPTIONS: | 31 GLOBAL OPTIONS: |
| 30 | 32 |
| 31 -V Print the program name and version number to stdout and exit | 33 -V Print the program name and version number to stdout and exit |
| 65 | 67 |
| 66 #: | 68 #: |
| 67 #: Implementation of the "deptree" command. | 69 #: Implementation of the "deptree" command. |
| 68 #: | 70 #: |
| 69 command_deptree() { | 71 command_deptree() { |
| 70 local opt opt_reversed opt_maxlevel opt_flat | 72 local opt_reversed opt_maxlevel opt_flat |
| 71 # $@ | 73 # $@ |
| 74 | |
| 75 local opt | |
| 72 | 76 |
| 73 opt_maxlevel=0 | 77 opt_maxlevel=0 |
| 74 opt_reversed=no | 78 opt_reversed=no |
| 75 opt_flat=no | 79 opt_flat=no |
| 76 while getopts "l:rt" opt; do | 80 while getopts "l:rt" opt; do |
| 339 | 343 |
| 340 #: | 344 #: |
| 341 #: Implementation of the "detail" command. | 345 #: Implementation of the "detail" command. |
| 342 #: | 346 #: |
| 343 command_detail() { | 347 command_detail() { |
| 348 local opt_noauto opt_mapped | |
| 344 # $@ | 349 # $@ |
| 345 | 350 |
| 346 local package \ | 351 local package \ |
| 347 repositories packagemapping instver instrepo \ | 352 repositories packagemapping instver instrepo \ |
| 348 repo title_printed indexfile _dummy \ | 353 repo title_printed indexfile _dummy opt acookie \ |
| 349 pkglabel pkgdescr pkgversion mapped_package | 354 pkglabel pkgdescr pkgversion mapped_package |
| 355 | |
| 356 opt_noauto=no | |
| 357 opt_mapped=no | |
| 358 while getopts "AM" opt; do | |
| 359 case "${opt}" in | |
| 360 A) | |
| 361 # shellcheck disable=SC2034 # appears unused | |
| 362 opt_noauto=yes;; | |
| 363 M) | |
| 364 # shellcheck disable=SC2034 # appears unused | |
| 365 opt_mapped=yes;; | |
| 366 \?) | |
| 367 exit 2;; | |
| 368 *) | |
| 369 fatal 2 "option handling failed";; | |
| 370 esac | |
| 371 done | |
| 372 shift $((OPTIND-1)) | |
| 373 OPTIND=1 | |
| 374 | |
| 375 if checkyesno opt_noauto || checkyesno opt_mapped; then | |
| 376 [ $# -gt 0 ] && fatal "${EX_USAGE}" "packages are now allowed for options -A or -M" | |
| 377 if checkyesno opt_noauto && checkyesno opt_mapped; then | |
| 378 fatal "${EX_USAGE}" "cannot use -A and -M together" | |
| 379 fi | |
| 380 fi | |
| 350 | 381 |
| 351 repositories='' | 382 repositories='' |
| 352 get_active_repositories repositories | 383 get_active_repositories repositories |
| 353 packagemapping='' | 384 packagemapping='' |
| 354 init_package_mapping packagemapping | 385 init_package_mapping packagemapping |
| 355 indexfile="$(get_local_index_file)" | 386 indexfile="$(get_local_index_file)" |
| 356 | 387 |
| 357 for package in "$@"; do | 388 if checkyesno opt_noauto; then |
| 358 _package_max_detail "${package}" "${packagemapping}" "${repositories}" "${indexfile}" | 389 for package in $(LC_ALL=C.UTF-8 "${PKG}" query -e '%a = 0' '%n'); do |
| 359 done | 390 _package_max_detail "${package}" "${packagemapping}" "${repositories}" "${indexfile}" |
| 391 done | |
| 392 elif checkyesno opt_mapped; then | |
| 393 acookie="$(falist_cookie_first packagemapping)" | |
| 394 while falist_tryget_key_at package "${acookie}"; do | |
| 395 _package_max_detail "${package}" "${packagemapping}" "${repositories}" "${indexfile}" | |
| 396 acookie="$(falist_cookie_next "${acookie}")" | |
| 397 done | |
| 398 else | |
| 399 for package in "$@"; do | |
| 400 _package_max_detail "${package}" "${packagemapping}" "${repositories}" "${indexfile}" | |
| 401 done | |
| 402 fi | |
| 360 | 403 |
| 361 falist_release "${packagemapping}" | 404 falist_release "${packagemapping}" |
| 362 farray_release "${repositories}" | 405 farray_release "${repositories}" |
| 363 } | 406 } |
| 364 | 407 |
