Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate sbin/fports @ 822:791bedbd10fb v0.29.2
+++++ v0.29.2
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 19 Jan 2025 16:07:34 +0100 |
| parents | e2f262ec2bf4 |
| children |
| rev | line source |
|---|---|
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 #!/bin/sh |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 # -*- indent-tabs-mode: nil; -*- |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 #: Check the version status of installed ports and compare them to |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 #: version in remote repositories and the local ports index. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 #: :Author: Franz Glasner |
|
815
e2f262ec2bf4
Extend copyright year to 2025.
Franz Glasner <fzglas.hg@dom66.de>
parents:
814
diff
changeset
|
8 #: :Copyright: (c) 2017-2025 Franz Glasner. |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 #: All rights reserved. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 #: :License: BSD 3-Clause "New" or "Revised" License. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 #: See LICENSE for details. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 #: If you cannot find LICENSE see |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 #: <https://opensource.org/licenses/BSD-3-Clause> |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 #: :ID: @(#)@@SIMPLEVERSIONTAG@@ |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 : # separator for shellcheck: no module-level directives below |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 # shellcheck disable=SC2034 # VERSION appears unused |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 VERSION='@@VERSION@@' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 # shellcheck disable=SC2016 # no expansion |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 USAGE=' |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
24 USAGE: fports -h|--help |
|
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
25 fports -V|--version |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
26 fports [GLOBAL-OPTIONS] deptree [-l maxlevel|--maxlevel=maxlevel] [-r|--reverse] [-t|--list|--transitive] package... |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
27 fports [GLOBAL-OPTIONS] detail [-A] [-b|--nofreebsd|--no-freebsd] [-f|--filter-unused] [-n|--noauto|--no-auto] [-m|--mapped] [package...] |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
28 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
29 GLOBAL OPTIONS: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
30 |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
31 -V, --version Print the program name and version number to stdout and exit. |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
33 -h, --help Print this help message to stdout and exit. |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
35 -j JAIL, --jail=JAIL |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
36 Execute in given jail JAIL. |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
37 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 ' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 _p_datadir='@@DATADIR@@' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 [ "${_p_datadir#@@DATADIR}" = '@@' ] && _p_datadir="$(dirname "$0")"/../share/local-bsdtools |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
43 . "${_p_datadir}/common.subr" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 . "${_p_datadir}/farray.sh" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
45 . "${_p_datadir}/ports.subr" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
47 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
48 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
49 #: Configuration directory. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
50 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 : "${CONFIGDIR:=@@ETCDIR@@}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
52 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
54 #: Mapping configuration: installed package name -> original package name. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
55 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
56 #: Note: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
57 #: This is independent of any repo |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
58 # |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
59 : "${PACKAGE_MAPPING:=${CONFIGDIR}/package-mapping.conf}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
60 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
61 # shellcheck disable=SC1091 # does not exist -- cannot read |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
62 [ -r "${CONFIGDIR}/pkgtools.conf" ] && . "${CONFIGDIR}/pkgtools.conf" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
63 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
64 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
65 # no unset variables |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
66 set -u |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
67 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
68 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
69 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
70 #: Implementation of the "deptree" command. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
71 #: |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
72 #: Args: |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
73 #: $1 (str, null): The jail to attach to |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
74 #: $2...: the command's options and arguments |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
75 #: |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
76 command_deptree() { |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
77 local opt_jail opt_reversed opt_maxlevel opt_flat |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
78 # $@ |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
79 |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
80 local opt |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
81 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
82 opt_jail="${1}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
83 shift |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
84 opt_maxlevel=0 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
85 opt_reversed=no |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
86 opt_flat=no |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
87 while getopts "l:rt-:" opt; do |
|
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
88 postprocess_getopts_for_long "l:rt-:" opt "maxlevel=" "reverse" "list" "transitive" "" |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
89 case "${opt}" in |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
90 l|maxlevel) |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
91 opt_maxlevel=$(($OPTARG + 0));; |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
92 r|reverse) |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
93 # shellcheck disable=SC2034 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
94 opt_reversed=yes;; |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
95 t|list|transitive) |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
96 opt_flat=yes;; |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
97 \?) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
98 exit 2;; |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
99 *) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
100 fatal 2 "option handling failed";; |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
101 esac |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
102 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
103 shift $((OPTIND-1)) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
104 OPTIND=1 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
105 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
106 if [ -n "${opt_jail}" ]; then |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
107 can_call_command "${opt_jail}" || fatal "${EX_UNAVAILABLE}" "jail \`${opt_jail}' does not exist or attaching denied" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
108 fi |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
109 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
110 if checkyesno opt_reversed; then |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
111 _command_deptree_reversed "${opt_jail}" "${opt_maxlevel}" "${opt_flat}" "$@" |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
112 else |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
113 _command_deptree_normal "${opt_jail}" "${opt_maxlevel}" "${opt_flat}" "$@" |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
114 fi |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
115 } |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
116 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
117 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
118 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
119 #: Implementation of printing a "normal" dependency tree |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
120 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
121 _command_deptree_normal() { |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
122 local jail maxlevel flat # $@ |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
123 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
124 local pkgdeps pkgqueue curdeps pkg n v flatdeps |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
125 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
126 jail="${1}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
127 maxlevel="${2}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
128 flat="${3}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
129 shift 3 |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
130 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
131 # shellcheck disable=SC2034 # pkgqueue seems unused |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
132 pkgqueue='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
133 farray_create pkgqueue # queue (array) of packages that are queued for |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
134 # resolution |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
135 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
136 for pkg in "$@"; do |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
137 if ! call_pkg "${opt_jail}" query '%n' "${pkg}" 1>/dev/null 2>/dev/null ; then |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
138 farray_release pkgqueue |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
139 fatal "${EX_DATAERR}" "Package not found: ${pkg}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
140 fi |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
141 farray_append pkgqueue "${pkg}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
142 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
143 pkgdeps='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
144 falist_create pkgdeps # alist of packagges with its direct dependencies |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
145 while farray_pop pkg pkgqueue 1; do |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
146 if ! falist_contains pkgdeps "${pkg}"; then |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
147 curdeps='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
148 farray_create curdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
149 while IFS=$' \t\n' read -r n v; do |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
150 [ -z "${n}" ] || [ -z "${v}" ] && continue |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
151 farray_append curdeps "${n}=${v}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
152 farray_append pkgqueue "${n}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
153 done <<EOF_01a8cebe-8659-4e32-87a4-bbce117e386b |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
154 $(call_pkg "${opt_jail}" query '%dn %dv' "${pkg}") |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
155 EOF_01a8cebe-8659-4e32-87a4-bbce117e386b |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
156 falist_set pkgdeps "${pkg}" "${curdeps}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
157 farray_release curdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
158 curdeps='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
159 fi |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
160 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
161 farray_release pkgqueue |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
162 # falist_debug pkgdeps |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
163 if checkyesno flat; then |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
164 for pkg in "$@"; do |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
165 _flatten_pkgdeps flatdeps "${pkgdeps}" "${pkg}" |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
166 _print_flatdeps '-->' "${pkg}" "$(call_pkg "${opt_jail}" query '%v' "${pkg}")" "${flatdeps}" |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
167 falist_release "${flatdeps}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
168 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
169 else |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
170 for pkg in "$@"; do |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
171 _print_dependency_tree 0 "${maxlevel}" '-->' "${pkg}" "$(call_pkg "${opt_jail}" query '%v' "${pkg}")" "${pkgdeps}" |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
172 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
173 fi |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
174 falist_release pkgdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
175 } |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
176 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
177 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
178 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
179 #: Implementation of printing a reversed dependency tree |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
180 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
181 _command_deptree_reversed() { |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
182 local jail maxlevel flat # $@ |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
183 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
184 local pkgdeps pkgqueue curdeps pkg n v flatdeps |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
185 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
186 jail="${1}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
187 maxlevel="${2}" |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
188 # shellcheck disable=SC2034 # appears unused |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
189 flat="${3}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
190 shift 3 |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
191 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
192 # shellcheck disable=SC2034 # pkgqueue seems unused |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
193 pkgqueue='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
194 farray_create pkgqueue # queue (array) of packages that are queued for |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
195 # resolution |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
196 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
197 for pkg in "$@"; do |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
198 if ! call_pkg "${opt_jail}" query '%n' "${pkg}" 1>/dev/null 2>/dev/null ; then |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
199 farray_release pkgqueue |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
200 fatal "${EX_DATAERR}" "Package not found: ${pkg}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
201 fi |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
202 farray_append pkgqueue "${pkg}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
203 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
204 pkgdeps='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
205 falist_create pkgdeps # alist of packagges with its direct dependencies |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
206 while farray_pop pkg pkgqueue 1; do |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
207 if ! falist_contains pkgdeps "${pkg}"; then |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
208 curdeps='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
209 farray_create curdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
210 while IFS=$' \t\n' read -r n v; do |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
211 [ -z "${n}" ] || [ -z "${v}" ] && continue |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
212 farray_append curdeps "${n}=${v}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
213 farray_append pkgqueue "${n}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
214 done <<EOF_5079e996-c6d2-4e6d-825d-53183a64ab06 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
215 $(call_pkg "${opt_jail}" query '%rn %rv' "${pkg}") |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
216 EOF_5079e996-c6d2-4e6d-825d-53183a64ab06 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
217 falist_set pkgdeps "${pkg}" "${curdeps}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
218 farray_release curdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
219 curdeps='' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
220 fi |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
221 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
222 farray_release pkgqueue |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
223 # falist_debug pkgdeps |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
224 if checkyesno flat; then |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
225 for pkg in "$@"; do |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
226 _flatten_pkgdeps flatdeps "${pkgdeps}" "${pkg}" |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
227 _print_flatdeps '<--' "${pkg}" "$(call_pkg "${opt_jail}" query '%v' "${pkg}")" "${flatdeps}" |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
228 falist_release "${flatdeps}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
229 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
230 else |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
231 for pkg in "$@"; do |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
232 _print_dependency_tree 0 "${maxlevel}" '<--' "${pkg}" "$(call_pkg "${opt_jail}" query '%v' "${pkg}")" "${pkgdeps}" |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
233 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
234 fi |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
235 falist_release pkgdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
236 } |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
237 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
238 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
239 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
240 #: Internal helper to print an indented dependency list for a package. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
241 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
242 #: Args: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
243 #: $1 (int): The (indentation) level where a level of `0` is the root level |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
244 #: $2 (int): The maximum level (`$1`) to print to |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
245 #: $3 (str): The package tag to use to for non-root-levels |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
246 #: $4 (str): The package name |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
247 #: $5 (str): The package version |
|
785
43cebff4ea0d
fports: Fix typo in docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
770
diff
changeset
|
248 #: $6 (alist): The alist of resolved packages and their dependencies |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
249 #: |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
250 _print_dependency_tree() { |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
251 # $1 $2 $3 $4 $5 $6 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
252 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
253 local i pkg ver curdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
254 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
255 if [ "${2}" -ge 1 ]; then |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
256 [ "${1}" -gt "${2}" ] && return 0 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
257 fi |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
258 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
259 i="${1}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
260 while [ "${i}" -gt 1 ]; do |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
261 printf '%s' ' ' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
262 i=$((i - 1)) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
263 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
264 [ "${1}" -ne 0 ] && printf '%s ' "${3}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
265 printf '%s v%s\n' "${4}" "${5}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
266 falist_get curdeps "${6}" "${pkg}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
267 i=1 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
268 while farray_tryget pkg "${curdeps}" "${i}"; do |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
269 ver="${pkg#*=}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
270 pkg="${pkg%%=*}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
271 _print_dependency_tree $(($1 + 1)) "${2}" "${3}" "${pkg}" "${ver}" "${6}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
272 i=$((i + 1)) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
273 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
274 farray_release curdeps |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
275 } |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
276 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
277 |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
278 #: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
279 #: Args: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
280 #: $1 (str): The package tag to use |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
281 #: $2 (str): The root package name |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
282 #: $3 (str): The package version of the root package in `$3` |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
283 #: $4 (alist): The alist of the flattened dependencies |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
284 #: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
285 _print_flatdeps() { |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
286 # $1 $2 $3 $4 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
287 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
288 local pkgnames i n v |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
289 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
290 printf '%s v%s\n' "${2}" "${3}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
291 |
|
787
004c676c3415
fports: Improve script help "-h" somewhat
Franz Glasner <fzglas.hg@dom66.de>
parents:
786
diff
changeset
|
292 # shellcheck disable=SC2034 # appears unused |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
293 pkgnames='' |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
294 farray_create pkgnames |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
295 falist_keys pkgnames "$4" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
296 farray_sort pkgnames |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
297 i=1 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
298 while farray_tryget n pkgnames "${i}"; do |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
299 falist_get v "${4}" "${n}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
300 printf '%s %s v%s\n' "${1}" "${n}" "${v}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
301 i=$((i + 1)) |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
302 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
303 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
304 farray_release pkgnames |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
305 } |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
306 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
307 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
308 #: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
309 #: Flatten a package dependency alist. |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
310 #: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
311 #: Args: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
312 #: $1 (str): The variable name where to store the flattened dependencies |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
313 #: into. This object (alist) must be released by the caller. |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
314 #: $2 (str): The alist with all packages and its dependencies |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
315 #: $3 (str): The package for which to flatten its dependencies |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
316 #: |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
317 _flatten_pkgdeps() { |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
318 local pkgdeps rootpkg # and $1 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
319 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
320 local alldeps queue pkg curdeps i depname depver |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
321 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
322 pkgdeps="${2}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
323 rootpkg="${3}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
324 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
325 falist_contains pkgdeps "${rootpkg}" || fatal "${EX_SOFTWARE}" "given package \`${rootpkg}' not in the given package dependency map" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
326 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
327 queue='' |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
328 farray_create queue # array with package names to be flattened |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
329 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
330 farray_append queue "${rootpkg}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
331 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
332 alldeps='' |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
333 falist_create alldeps # alist with pkgname -> version |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
334 while farray_pop pkg queue 1; do |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
335 if ! falist_contains alldeps "${pkg}"; then |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
336 curdeps='' |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
337 falist_get curdeps pkgdeps "${pkg}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
338 i=1 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
339 while farray_tryget depname curdeps "${i}"; do |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
340 depver="${depname#*=}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
341 depname="${depname%%=*}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
342 if ! falist_contains alldeps "${depname}"; then |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
343 falist_set alldeps "${depname}" "${depver}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
344 fi |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
345 farray_append queue "${depname}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
346 i=$((i + 1)) |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
347 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
348 farray_release curdeps |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
349 fi |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
350 done |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
351 |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
352 farray_release "${queue}" |
|
786
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
353 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
354 setvar "${1}" "${alldeps}" |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
355 } |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
356 |
|
b78815b47d5e
fports: deptree has now an option to print a flattened tree.
Franz Glasner <fzglas.hg@dom66.de>
parents:
785
diff
changeset
|
357 |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
358 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
359 #: Implementation of the "detail" command. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
360 #: |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
361 #: Args: |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
362 #: $1 (str, null): The jail to attach to |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
363 #: $2...: The command's options and arguments |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
364 #: |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
365 command_detail() { |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
366 local opt_jail opt_nofreebsd opt_filterunused opt_noauto \ |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
367 opt_mapped opt_nofreebsd |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
368 # $@ |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
369 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
370 local package \ |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
371 packages do_sort idx prev_package \ |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
372 repositories packagemapping instver instrepo \ |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
373 repo title_printed indexfile _dummy opt acookie \ |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
374 pkglabel pkgdescr pkgversion mapped_package |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
375 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
376 opt_jail="${1}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
377 shift |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
378 do_sort=no |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
379 opt_filterunused=no |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
380 opt_nofreebsd=no |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
381 opt_noauto=no |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
382 opt_mapped=no |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
383 while getopts "Abfnm-:" opt; do |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
384 postprocess_getopts_for_long "Abfnm-:" opt "nofreebsd" "no-freebsd" "filter-unused" "noauto" "no-auto" "mapped" "" |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
385 case "${opt}" in |
|
808
ab21dd56f99e
fports: Implement "fports detail -A" as a shortcut to "-b -n -m".
Franz Glasner <fzglas.hg@dom66.de>
parents:
807
diff
changeset
|
386 A) |
|
ab21dd56f99e
fports: Implement "fports detail -A" as a shortcut to "-b -n -m".
Franz Glasner <fzglas.hg@dom66.de>
parents:
807
diff
changeset
|
387 opt_nofreebsd=yes |
|
ab21dd56f99e
fports: Implement "fports detail -A" as a shortcut to "-b -n -m".
Franz Glasner <fzglas.hg@dom66.de>
parents:
807
diff
changeset
|
388 opt_noauto=yes |
|
ab21dd56f99e
fports: Implement "fports detail -A" as a shortcut to "-b -n -m".
Franz Glasner <fzglas.hg@dom66.de>
parents:
807
diff
changeset
|
389 opt_mapped=yes |
|
ab21dd56f99e
fports: Implement "fports detail -A" as a shortcut to "-b -n -m".
Franz Glasner <fzglas.hg@dom66.de>
parents:
807
diff
changeset
|
390 do_sort=yes |
|
ab21dd56f99e
fports: Implement "fports detail -A" as a shortcut to "-b -n -m".
Franz Glasner <fzglas.hg@dom66.de>
parents:
807
diff
changeset
|
391 ;; |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
392 b|nofreebsd|no-freebsd) |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
393 # shellcheck disable=SC2034 # appears unused |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
394 opt_nofreebsd=yes |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
395 do_sort=yes |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
396 ;; |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
397 f|filter-unused) |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
398 opt_filterunused=yes |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
399 ;; |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
400 n|noauto|no-auto) |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
401 # shellcheck disable=SC2034 # appears unused |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
402 opt_noauto=yes |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
403 do_sort=yes |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
404 ;; |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
405 m|mapped) |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
406 # shellcheck disable=SC2034 # appears unused |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
407 opt_mapped=yes |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
408 do_sort=yes |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
409 ;; |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
410 \?) |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
411 exit 2;; |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
412 *) |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
413 fatal 2 "option handling failed";; |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
414 esac |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
415 done |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
416 shift $((OPTIND-1)) |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
417 OPTIND=1 |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
418 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
419 if [ -n "${opt_jail}" ]; then |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
420 can_call_command "${opt_jail}" || fatal "${EX_UNAVAILABLE}" "jail \`${opt_jail}' does not exist or attaching denied" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
421 fi |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
422 |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
423 packages='' |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
424 farray_create packages |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
425 repositories='' |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
426 get_active_repositories repositories "${opt_jail}" |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
427 packagemapping='' |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
428 init_package_mapping packagemapping "${opt_jail}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
429 indexfile="$(get_local_index_file "${opt_jail}")" |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
430 |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
431 if checkyesno opt_nofreebsd; then |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
432 while IFS='|' read -r package repo; do |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
433 [ "${repo}" != 'FreeBSD' ] && farray_append packages "${package}" |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
434 done <<EOF_1fa6f326-49e6-4b01-a7ea-52372d00df1e |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
435 $(call_pkg "${opt_jail}" query '%n|%R') |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
436 EOF_1fa6f326-49e6-4b01-a7ea-52372d00df1e |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
437 fi |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
438 if checkyesno opt_noauto; then |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
439 for package in $(call_pkg "${opt_jail}" query -e '%a = 0' '%n'); do |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
440 farray_append packages "${package}" |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
441 done |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
442 fi |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
443 if checkyesno opt_mapped; then |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
444 acookie="$(falist_cookie_first packagemapping)" |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
445 while falist_tryget_key_at package "${acookie}"; do |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
446 farray_append packages "${package}" |
|
800
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
447 acookie="$(falist_cookie_next "${acookie}")" |
|
1c4d729963dc
fports: Implement "fports detail -A" and "fports detail -M".
Franz Glasner <fzglas.hg@dom66.de>
parents:
799
diff
changeset
|
448 done |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
449 fi |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
450 for package in "$@"; do |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
451 farray_append packages "${package}" |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
452 done |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
453 checkyesnovalue "${do_sort}" && farray_sort packages |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
454 |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
455 idx=1 |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
456 prev_package='' # to skip duplicate packages |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
457 while farray_tryget package packages "${idx}"; do |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
458 if [ "${prev_package}" != "${package}" ]; then |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
459 _package_max_detail "${package}" "${packagemapping}" "${repositories}" "${indexfile}" "${opt_filterunused}" "${opt_jail}" |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
460 prev_package="${package}" |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
461 fi |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
462 idx=$((idx + 1)) |
|
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
463 done |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
464 |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
465 falist_release "${packagemapping}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
466 farray_release "${repositories}" |
|
806
b59054f11029
fports: Implement "fports detail -b" to print details about all packages that are not installed from the blessed FreeBSD repo.
Franz Glasner <fzglas.hg@dom66.de>
parents:
804
diff
changeset
|
467 farray_release "${packages}" |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
468 } |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
469 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
470 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
471 #: |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
472 #: Implementation of printing the most details possible for a package. |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
473 #: |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
474 #: Implements all the repeating stuff for a package for e.g. `command_detail`. |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
475 #: |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
476 #: Args: |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
477 #: $1 (str): The name of the package |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
478 #: $2 (alist): The |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
479 #: $3 (array): The array with all the configured/active repositories |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
480 #: $4 (str, null): The local index file if it exists |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
481 #: $5 (bool): Flag whether to suppress details for repositories that do |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
482 #: not contain the package `$1` |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
483 #: $6 (str, null): The jail where the packages live |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
484 #: |
|
799
96631c3886d9
fports: Rename _package_detail() to _package_max_detail()
Franz Glasner <fzglas.hg@dom66.de>
parents:
798
diff
changeset
|
485 _package_max_detail() { |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
486 local package packagemapping repositories indexfile \ |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
487 opt_filterunused opt_jail |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
488 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
489 local instver instrepo repo title_printed _dummy \ |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
490 pkglabel pkgdescr pkgversion mapped_package |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
491 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
492 package="${1}" |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
493 packagemapping="${2}" |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
494 repositories="${3}" |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
495 indexfile="${4}" |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
496 opt_filterunused="${5}" |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
497 opt_jail="${6}" |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
498 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
499 # shellcheck disable=SC2034 # appears unused |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
500 title_printed=no |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
501 IFS='|' read -r instver instrepo <<EOF_e9bd7819-b4c5-4a86-b984-f5226db58cb1 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
502 $(call_pkg "${opt_jail}" query '%v|%R' "${package}") |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
503 EOF_e9bd7819-b4c5-4a86-b984-f5226db58cb1 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
504 print_title title_printed "${package}" "${instver}" "${instrepo}" |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
505 if [ -n "${indexfile}" ]; then |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
506 read -r _dummy pkglabel pkgdescr <<EOF_b1f225bd-d234-4a23-8a2a-40c2e5b7ff3c |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
507 $(call_pkg "${opt_jail}" version -U -I -n "${package}" -v "${indexfile}") |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
508 EOF_b1f225bd-d234-4a23-8a2a-40c2e5b7ff3c |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
509 pkgversion="$(parse_index_file_for_package_version "${indexfile}" "${package}" "${opt_jail}")" |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
510 _shall_print_package_detail_item "${pkglabel}" "${opt_filterunused}" && print_detail_item "INDEX" "${pkgversion}" "${pkglabel}" "${pkgdescr}" |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
511 fi |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
512 farray_for_each repositories _package_repository_detail "${package}" "${opt_filterunused}" "${opt_jail}" 0 |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
513 mapped_package="$(get_package_mapping "${packagemapping}" "${package}")" |
|
798
e48b38cf7bb1
fports: FIX: Remove debug setting with regard to mapped packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
797
diff
changeset
|
514 if [ -n "${mapped_package}" ]; then |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
515 printf '%18s %s\n' "--------------->" "${mapped_package}" |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
516 if [ -n "${indexfile}" ]; then |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
517 pkgversion="$(parse_index_file_for_package_version "${indexfile}" "${mapped_package}" "${opt_jail}")" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
518 pkglabel="$(call_pkg "${opt_jail}" version --test-version "${instver}" "${pkgversion}")" |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
519 print_detail_item "INDEX" "${pkgversion}" "${pkglabel}" '' 19 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
520 fi |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
521 farray_for_each repositories _mapped_package_repository_detail "${mapped_package}" "{instver}" "${opt_filterunused}" "${opt_jail}" 19 |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
522 fi |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
523 } |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
524 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
525 |
|
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
526 #: |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
527 #: Args: |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
528 #: $1 (str): The repositorie's package label string |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
529 #: $2 (bool): The flag whether to filter package detail data |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
530 #: |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
531 #: Returns: |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
532 #: int: 0 (truthy) if the detail should be printed |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
533 #: 1 (falsy) if printing should be suppressed |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
534 #: |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
535 _shall_print_package_detail_item() { |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
536 # $1 $2 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
537 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
538 # If filtering is disabled then print |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
539 checkyesnovalue "$2" || return 0 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
540 if [ -z "$1" ] || [ "$1" = '?' ]; then |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
541 return 1 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
542 fi |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
543 return 0 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
544 } |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
545 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
546 |
|
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
547 #: |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
548 #: Array callback to print package details with regard to a repository. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
549 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
550 #: Args: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
551 #: $1 (str): The repositories array |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
552 #: $2 (int): The current index |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
553 #: $3: The element value (i.e. repository name) |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
554 #: $4 (str): The (master) package name |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
555 #: $5 (flag): The global flat whether to filter repository printing |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
556 #: $6 (str, null): The jail in which the package data live |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
557 #: $7 (int, optional): The extra indent value to forward to called functions |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
558 #: |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
559 _package_repository_detail() { |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
560 local repositories idx reponame package extraindent opt_filterunused \ |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
561 opt_jail |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
562 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
563 local _dummy \ |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
564 pkglabel pkgdescr pkgversion |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
565 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
566 repositories="${1}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
567 # shellcheck disable=SC2034 # appears unused (yes, accept it) |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
568 idx="${2}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
569 reponame="${3}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
570 package="${4}" |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
571 opt_filterunused="${5}" |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
572 opt_jail="${6}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
573 extraindent="${7:-0}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
574 |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
575 read -r _dummy pkglabel pkgdescr <<EOF_19cf2d80-4eb9-4cda-bd4d-96b04e769206 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
576 $(call_pkg "${opt_jail}" version -U -R -r "${reponame}" -n "${package}" -v) |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
577 EOF_19cf2d80-4eb9-4cda-bd4d-96b04e769206 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
578 pkgversion="$(call_pkg "${opt_jail}" rquery -U -r "${reponame}" '%v' "${package}")" |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
579 _shall_print_package_detail_item "${pkglabel}" "${opt_filterunused}" && print_detail_item "${reponame}" "${pkgversion}" "${pkglabel}" "${pkgdescr}" "${extraindent}" |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
580 } |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
581 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
582 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
583 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
584 #: Array callback to print package details for a mapped package with regard |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
585 #: to a repository. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
586 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
587 #: Args: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
588 #: $1 (str): The repositories array |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
589 #: $2 (int): The current index |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
590 #: $3: The element value (i.e. repository name) |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
591 #: $4 (str): The mapped package name |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
592 #: $5 (str): The parent package version |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
593 #: $6 (flag): The global flat whether to filter repository printing |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
594 #: $7 (str, null): The jail where the package data live |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
595 #: $8 (int, optional): The extra indent value to forward to called functions |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
596 #: |
|
797
7f64b4420703
fports: Refactor: split up command_detail(): make a function that is called for each package
Franz Glasner <fzglas.hg@dom66.de>
parents:
796
diff
changeset
|
597 _mapped_package_repository_detail() { |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
598 local repositories idx reponame package parent_pkgversion \ |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
599 opt_filterunused extraindent opt_jail |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
600 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
601 local _dummy \ |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
602 pkglabel pkgversion |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
603 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
604 repositories="${1}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
605 # shellcheck disable=SC2034 # appears unused (yes, accept it) |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
606 idx="${2}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
607 reponame="${3}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
608 package="${4}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
609 parent_pkgversion="${5}" |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
610 opt_filterunused="${6}" |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
611 opt_jail="${7}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
612 extraindent="${8:-0}" |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
613 |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
614 pkgversion="$(call_pkg "${opt_jail}" rquery -U -r "${reponame}" '%v' "${package}")" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
615 pkglabel="$(call_pkg "${opt_jail}" version --test-version "${parent_pkgversion}" "${pkgversion}")" |
|
810
a59cc4bea000
fports: Add option "-f" to "fports detail": do not print the status with regard to repositories that do not have the package available
Franz Glasner <fzglas.hg@dom66.de>
parents:
808
diff
changeset
|
616 _shall_print_package_detail_item "${pkglabel}" "${opt_filterunused}" && print_detail_item "${reponame}" "${pkgversion}" "${pkglabel}" '' "${extraindent}" |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
617 } |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
618 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
619 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
620 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
621 #: Print the output title line for a package. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
622 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
623 #: Args: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
624 #: $1 (str): The name of the variable where to get or store the flag |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
625 #: whether the title for the package in `$2` has already been |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
626 #: printed. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
627 #: $2 (str): The package name |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
628 #: $3 (str): The package version |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
629 #: $4 (str): The repository name from which the package has been installed |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
630 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
631 #: Output (stdout): |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
632 #: The formatted title line |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
633 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
634 print_title() { |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
635 local varname_title_printed package version repo |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
636 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
637 varname_title_printed="${1}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
638 package="${2}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
639 version="${3}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
640 repo="${4}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
641 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
642 if ! checkyes "${varname_title_printed}"; then |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
643 if [ -n "${version}" ]; then |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
644 # The package is installed |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
645 printf '%-36s %-17s (%s)\n' "${package}" "${version}" "${repo}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
646 else |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
647 # The package is not installed |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
648 printf '%-36s NOT INSTALLED\n' "${package}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
649 fi |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
650 setvar "${varname_title_printed}" 'yes' |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
651 fi |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
652 } |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
653 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
654 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
655 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
656 #: Print a detail item to stdout. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
657 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
658 #: The description `_descr` will not be printed if the label `_label` |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
659 #: is ``?``. |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
660 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
661 #: Args: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
662 #: $1 (str): The repository name |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
663 #: $2 (str): The version number to print to |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
664 #: $3 (str): The label (aka comparison character) to print to |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
665 #: $4 (str): The description to print to |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
666 #: $5 (int, optional): The extra indentation to use. (Default 0) |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
667 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
668 #: Output (stdout): |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
669 #: The formatted detail line |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
670 #: |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
671 print_detail_item() { |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
672 local repo version label descr indent |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
673 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
674 local real_descr |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
675 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
676 repo="${1}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
677 version="${2}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
678 label="${3}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
679 descr="${4}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
680 indent="${5:-0}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
681 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
682 if [ "${label}" = '?' ]; then |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
683 real_descr='' |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
684 else |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
685 real_descr="${descr}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
686 fi |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
687 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
688 printf '%-*s %-15s: %-17s %s %s\n' $((indent)) '' "${repo}" "${version}" "${label}" "${real_descr}" |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
689 } |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
690 |
|
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
691 |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
692 # |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
693 # Global option handling |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
694 # |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
695 |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
696 opt_jail='' |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
697 while getopts "Vhj:-:" _opt ; do |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
698 postprocess_getopts_for_long "Vhj-:" _opt "version" "help" "jail=" "" |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
699 case "${_opt}" in |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
700 V|version) |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
701 printf 'fports %s\n' '@@SIMPLEVERSIONSTR@@' |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
702 exit 0 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
703 ;; |
|
804
f406b3b76b62
fports: Implemented also long commandline options
Franz Glasner <fzglas.hg@dom66.de>
parents:
802
diff
changeset
|
704 h|help) |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
705 echo "${USAGE}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
706 exit 0 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
707 ;; |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
708 j|jail) |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
709 opt_jail="${OPTARG}" |
|
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
710 ;; |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
711 \?) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
712 exit 2; |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
713 ;; |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
714 *) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
715 fatal 2 "option handling failed" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
716 ;; |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
717 esac |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
718 done |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
719 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
720 # |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
721 # Reset the Shell's option handling system to prepare for handling |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
722 # command-local options. |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
723 # |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
724 shift $((OPTIND-1)) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
725 OPTIND=1 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
726 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
727 command="${1-}" |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
728 shift |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
729 |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
730 case "${command}" in |
| 813 | 731 '') |
| 732 fatal 2 "no command given";; | |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
733 deptree) |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
734 command_deptree "${opt_jail}" "$@";; |
|
796
e48d173534ec
fports: Implement "fports detail" to print the status of all given packages in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
788
diff
changeset
|
735 detail) |
|
814
2310764e5c4e
fports: Implement a global "--jail/-j" option: execute the fports commands in a jail.
Franz Glasner <fzglas.hg@dom66.de>
parents:
813
diff
changeset
|
736 command_detail "${opt_jail}" "$@";; |
|
770
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
737 *) |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
738 fatal 2 "unknown command \`${command}'";; |
|
56ab5c012d5f
fports: Begin a new command "fports" and fully implemented its subcommand "fports deptree".
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
739 esac |
