Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate sbin/check-ports @ 386:84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
While being there: adjusting copyright year to end in 2023 now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 23 Feb 2023 01:08:31 +0100 |
| parents | 8298a93dd083 |
| children | 9c3b1966ba91 |
| rev | line source |
|---|---|
|
0
08cf7bf119b7
Current version of a tool to check the versions of installed ports against the source ports tree and other binary repositories
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
1 #!/bin/sh |
| 79 | 2 # -*- indent-tabs-mode: nil; -*- |
|
86
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
3 : 'Check the version status of installed ports and compare them to |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
4 version in remote repositories and the local ports index. |
|
86
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
5 |
|
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
6 :Author: Franz Glasner |
|
386
84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
361
diff
changeset
|
7 :Copyright: (c) 2017-2023 Franz Glasner. |
|
86
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
8 All rights reserved. |
|
99
7a064049405f
Use the "Full name" in the license section
Franz Glasner <fzglas.hg@dom66.de>
parents:
94
diff
changeset
|
9 :License: BSD 3-Clause "New" or "Revised" License. |
|
86
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
10 See LICENSE for details. |
|
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
11 If you cannot find LICENSE see |
|
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
12 <https://opensource.org/licenses/BSD-3-Clause> |
|
386
84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
361
diff
changeset
|
13 :ID: @(#)@@SIMPLEVERSIONTAG@@ |
|
86
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
14 |
|
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
15 ' |
|
0
08cf7bf119b7
Current version of a tool to check the versions of installed ports against the source ports tree and other binary repositories
Franz Glasner <hg@dom66.de>
parents:
diff
changeset
|
16 |
|
130
54de2955bfa9
Put @@VERSION@@ and @@HGREVISION@@ in single quotes
Franz Glasner <fzglas.hg@dom66.de>
parents:
128
diff
changeset
|
17 VERSION='@@VERSION@@' |
|
17
089afc4908c0
Expand @@VERSION@@ with the package version also
Franz Glasner <hg@dom66.de>
parents:
16
diff
changeset
|
18 |
|
153
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
19 USAGE=' |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
20 USAGE: check-ports [options] [args...] |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
21 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
22 Options: |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
23 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
24 -V Print the program name and version number to stdout and exit |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
25 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
26 -h Print this help message to stdout and exit |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
27 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
28 -A Print for every package the status of all repositories |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
29 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
30 -a Print the data of all repos that have the package |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
31 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
32 -n Print the status of given packages in `args` in all details. |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
33 No other options are respected. |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
34 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
35 -s Print the status of all packages that need some attention |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
36 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
37 -v Print the title and repository of every installed package always |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
38 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
39 Per Default (without any option) the status of every package is |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
40 printed with respect to repositories that have the package and have |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
41 differing versions. |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
42 ' |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
43 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
44 # |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
45 # Configuration directory |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
46 # |
|
66
1f3a64254c9c
Replace @@ETCDIR@@ and @@INDEXFILE@@ dynamically at package build time
Franz Glasner <hg@dom66.de>
parents:
64
diff
changeset
|
47 : ${CONFIGDIR:=@@ETCDIR@@} |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
48 |
|
131
993fecdf2a70
Rename etc/tools.conf to etc/pkgtools.conf.
Franz Glasner <fzglas.hg@dom66.de>
parents:
130
diff
changeset
|
49 test -r "${CONFIGDIR}/pkgtools.conf" && . "${CONFIGDIR}/pkgtools.conf" |
|
109
0bd594fb56f8
Read the tools.conf configuration file where appropriate
Franz Glasner <fzglas.hg@dom66.de>
parents:
108
diff
changeset
|
50 |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
51 # |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
52 # Mapping configuration: installed package name -> original package name |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
53 # Note: This is independent of any repo |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
54 # |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
55 : ${PACKAGE_MAPPING:=${CONFIGDIR}/package-mapping.conf} |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
56 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
57 # |
| 55 | 58 # Local repository with non-public packages and/or ports with changed |
| 59 # OPTIONS (i.e. not using the defaults) or forks of official packages with | |
| 136 | 60 # other package names. |
| 61 # This repo is strictly *local* to the host and/or jail. | |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
62 # |
| 1 | 63 : ${LOCAL_REPO:=LocalRepo} |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
64 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
65 # |
|
138
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
66 # Shared local repository with non-public packages and/or ports with |
|
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
67 # changed OPTIONS (i.e. not using the defaults). |
|
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
68 # Contrary to LOCAL_REPO this repository may be shared. |
|
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
69 # |
|
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
70 : ${SHARED_LOCAL_REPO:=SharedLocalRepo} |
|
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
71 |
|
850ebdb132d1
Name a shared local repository: SharedLocalRepo
Franz Glasner <fzglas.hg@dom66.de>
parents:
137
diff
changeset
|
72 # |
| 136 | 73 # (Shared) repository with ports with default OPTIONS (i.e. unchanged) |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
74 # but newer than the packages in the "FreeBSD" repository. |
| 136 | 75 # Can also contain non-FreeBSD *public* packages. |
| 76 # May be shared. | |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
77 # Some sort of a fast-track repository. |
|
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
78 # |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
79 : ${LOCALBSDPORTS_REPO:=LocalBSDPorts} |
| 59 | 80 |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
81 # |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
82 # The official FreeBSD binary repository |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
83 # |
| 1 | 84 : ${FREEBSD_REPO:=FreeBSD} |
| 59 | 85 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
86 # |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
87 # Directly installed from ports |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
88 # |
| 1 | 89 : ${PORTS_DIRECT_INSTALLED_REPO:=unknown-repository} |
| 90 | |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
91 # |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
92 # For the workaround of the bug in pkg rquery -I |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
93 # |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
94 : ${PORTSDIR:=/usr/ports} |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
95 |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
96 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
97 test_exists_local_index() { |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
98 : 'Determine whether there exists a ports directory with an index |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
99 file. |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
100 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
101 Returns: |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
102 status 0 iff the local index exists |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
103 ' |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
104 pkg version -I -n DUMMY >/dev/null 2>/dev/null |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
105 } |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
106 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
107 |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
108 get_ports_index_directory() { |
|
151
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
109 : 'Ask the packager configuration for the `INDEXDIR` and/or `PORTSDIR` |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
110 configuration value: either `INDEXDIR` or -- if `INDEXDIR` is empty -- |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
111 `PORTSDIR` is used. |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
112 |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
113 Output (stdout) |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
114 the directory where the index database file lives |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
115 |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
116 ' |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
117 local _dir |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
118 |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
119 _dir="$(pkg config INDEXDIR)" |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
120 if [ -z "${_dir}" ]; then |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
121 _dir="$(pkg config PORTSDIR)" |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
122 fi |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
123 printf '%s' "${_dir}" |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
124 } |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
125 |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
126 |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
127 get_ports_index_version() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
128 : 'Determine for package `_package` the version of the package in the |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
129 local ports index. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
130 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
131 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
132 _package: the package name to search for |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
133 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
134 Returns: |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
135 0 on success, 1 on errors or if the package is not in the local |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
136 ports index |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
137 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
138 Output (stdout): |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
139 the version number of `_package` in the local ports index |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
140 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
141 ' |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
142 local _package _line _fqpn _n _lines |
|
151
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
143 local _indexdir _indexfile |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
144 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
145 _package="$1" |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
146 |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
147 # _val=$(pkg rquery -I "${_package}" | cut -f 1 -d '|') |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
148 # _rv=$? |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
149 # immediate_index_version=${_val##*-} |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
150 # return ${_rv} |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
151 |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
152 _indexdir="$(get_ports_index_directory)" |
|
151
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
153 _indexfile="$(pkg config INDEXFILE)" |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
154 |
|
27b7454140be
Determine INDEXDIR and INDEXFILE dynamically from the packager configuration via "pkg config"
Franz Glasner <fzglas.hg@dom66.de>
parents:
150
diff
changeset
|
155 if [ -r "${_indexdir}/${_indexfile}" ] ; then |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
156 # |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
157 # Note: Direct piping does not set immediate_index_version at return correctly |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
158 # "_line" is set correctly and parsing works, but the return 0 seems to kill |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
159 # some of the previous effects. |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
160 # |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
161 # "grep" does a fast pre-selection, reading, parsing and comparing is done for |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
162 # exact matching. |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
163 # |
|
348
9b388927b12b
FIX: Use BREs with grep because is handles "+" characters in package names properly.
Franz Glasner <fzglas.hg@dom66.de>
parents:
153
diff
changeset
|
164 # Use BREs because a `+' char needs to be handled as an ordinary |
|
9b388927b12b
FIX: Use BREs with grep because is handles "+" characters in package names properly.
Franz Glasner <fzglas.hg@dom66.de>
parents:
153
diff
changeset
|
165 # character (e.g. for the "lucene++" package). |
|
9b388927b12b
FIX: Use BREs with grep because is handles "+" characters in package names properly.
Franz Glasner <fzglas.hg@dom66.de>
parents:
153
diff
changeset
|
166 # Note that `^' at the start of an RE is not an ordinary |
|
9b388927b12b
FIX: Use BREs with grep because is handles "+" characters in package names properly.
Franz Glasner <fzglas.hg@dom66.de>
parents:
153
diff
changeset
|
167 # character. See re_format(7). |
|
9b388927b12b
FIX: Use BREs with grep because is handles "+" characters in package names properly.
Franz Glasner <fzglas.hg@dom66.de>
parents:
153
diff
changeset
|
168 # |
|
9b388927b12b
FIX: Use BREs with grep because is handles "+" characters in package names properly.
Franz Glasner <fzglas.hg@dom66.de>
parents:
153
diff
changeset
|
169 _lines=$(/usr/bin/grep -G '^'"${_package}" "${_indexdir}/${_indexfile}") |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
170 while read _line ; do |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
171 _fqpn="${_line%%|*}" |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
172 _n=${_fqpn%-*} |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
173 if [ "${_package}" = "${_n}" ] ; then |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
174 printf '%s' "${_fqpn##*-}" |
|
64
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
175 return 0 |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
176 fi |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
177 done <<EOF1334TGH1 |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
178 ${_lines} |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
179 EOF1334TGH1 |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
180 fi |
|
ffd5f575edd5
FIX: Work around the bug in "pkg rquery -i" not asking the port's INDEX file.
Franz Glasner <hg@dom66.de>
parents:
63
diff
changeset
|
181 return 1 |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
182 } |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
183 |
|
7
2712d249c371
Assert that the installed version number we get from "pkg query" is the same as the version in "pkg version"
Franz Glasner <hg@dom66.de>
parents:
6
diff
changeset
|
184 |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
185 get_mapping() { |
|
101
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
186 : 'Determine whether a package `_package` is essentially the same as |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
187 another package. |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
188 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
189 Args: |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
190 _package: the new name of the package |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
191 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
192 Returns: |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
193 0 when a package mapping has been found, 1 otherwise |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
194 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
195 Output (stdout): |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
196 the name of the package on which `_package` is based on |
|
101
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
197 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
198 This command reads from the mapping database in in file |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
199 `/usr/local/etc/local-bsdtools/package-mapping.conf`. |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
200 Example:: |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
201 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
202 # |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
203 # _package mapped_package_name |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
204 # |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
205 fmg-nextcloud-php71 nextcloud-php71 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
206 fmg-nextcloud-twofactor_totp-php71 nextcloud-twofactor_totp-php71 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
207 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
208 ' |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
209 local _package _n _mapped |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
210 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
211 _package="$1" |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
212 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
213 if [ -r "${PACKAGE_MAPPING}" ] ; then |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
214 while read _n _mapped ; do |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
215 if [ "${_n}" = "${_package}" ] ; then |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
216 printf '%s' "${_mapped}" |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
217 return 0 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
218 fi |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
219 done < ${PACKAGE_MAPPING} |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
220 fi |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
221 return 1 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
222 } |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
223 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
224 |
|
31
abe1659ff3c1
Refactor: a "print_title()" function which prints the title line (package and repo) if its not yet printed
Franz Glasner <hg@dom66.de>
parents:
24
diff
changeset
|
225 print_title() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
226 : 'Print the output title line for a package |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
227 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
228 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
229 _package: the package name |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
230 _version: the package version |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
231 _repo: the repository name |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
232 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
233 Input (Globals). |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
234 title_printed: a global that determines if the title really needs |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
235 to be printed. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
236 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
237 If it is an empty string the the title is |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
238 really printed and the variable is set to |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
239 "yes". |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
240 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
241 Output (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
242 title_printed: set to "yes" if the title has been printed |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
243 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
244 ' |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
245 local _package _version _repo |
|
31
abe1659ff3c1
Refactor: a "print_title()" function which prints the title line (package and repo) if its not yet printed
Franz Glasner <hg@dom66.de>
parents:
24
diff
changeset
|
246 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
247 _package="$1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
248 _version="$2" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
249 _repo="$3" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
250 if [ -z "${title_printed}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
251 printf '%-36s %-17s (%s)\n' "${_package}" "${_version}" "${_repo}" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
252 title_printed=yes |
|
31
abe1659ff3c1
Refactor: a "print_title()" function which prints the title line (package and repo) if its not yet printed
Franz Glasner <hg@dom66.de>
parents:
24
diff
changeset
|
253 fi |
|
abe1659ff3c1
Refactor: a "print_title()" function which prints the title line (package and repo) if its not yet printed
Franz Glasner <hg@dom66.de>
parents:
24
diff
changeset
|
254 } |
|
abe1659ff3c1
Refactor: a "print_title()" function which prints the title line (package and repo) if its not yet printed
Franz Glasner <hg@dom66.de>
parents:
24
diff
changeset
|
255 |
|
abe1659ff3c1
Refactor: a "print_title()" function which prints the title line (package and repo) if its not yet printed
Franz Glasner <hg@dom66.de>
parents:
24
diff
changeset
|
256 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
257 print_detail_item() { |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
258 : 'Print a detail item to stdout. |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
259 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
260 The description `_descr` will not be printed if the label `_label` |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
261 is ``?``. |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
262 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
263 Args: |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
264 _repo: the repository name |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
265 _version: the version number to print to |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
266 _label: the label (aka comparison character) to print to |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
267 _descr: the description to print to |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
268 _indent: (optional) extra indentation number (default 0) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
269 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
270 Output (stdout): |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
271 the formatted detail line |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
272 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
273 ' |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
274 local _repo _version _label _descr _indent |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
275 local _real_descr |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
276 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
277 _repo="$1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
278 _version="$2" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
279 _label="$3" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
280 _descr="$4" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
281 _indent="$5" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
282 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
283 if [ -z "${_indent}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
284 _indent="0" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
285 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
286 if [ "${_label}" = '?' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
287 _real_descr='' |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
288 else |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
289 _real_descr="${_descr}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
290 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
291 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
292 printf '%-*s %-15s: %-17s %s %s\n' $((_indent)) '' "${_repo}" "${_version}" "${_label}" "${_real_descr}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
293 } |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
294 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
295 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
296 check_ports() { |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
297 : 'Implementation of all command variants besides of `-n` |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
298 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
299 ' |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
300 local _ipackage _iversion _irepo _mapped_package_name _dummy |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
301 local _print_detail _local_index_exists |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
302 local _index_version _index_label _index_descr |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
303 local _remote_version_FreeBSD _remote_label_FreeBSD _remote_descr_FreeBSD |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
304 local _remote_version_LocalBSDPorts _remote_label_LocalBSDPorts _remote_descr_LocalBSDPorts |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
305 local _remote_version_SharedLocalRepo _remote_label_SharedLocalRepo _remote_descr_SharedLocalRepo |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
306 local _remote_version_LocalRepo _remote_label_LocalRepo _remote_descr_LocalRepo |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
307 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
308 if test_exists_local_index; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
309 _local_index_exists="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
310 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
311 pkg query '%n %v %R' | |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
312 while read -r _ipackage _iversion _irepo; do |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
313 title_printed="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
314 _print_detail="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
315 if [ -n "${_local_index_exists}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
316 read -r _dummy _index_label _index_descr <<EOF_INDEX |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
317 $(pkg version -U -I -n "${_ipackage}" -v) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
318 EOF_INDEX |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
319 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
320 read -r _dummy _remote_label_FreeBSD _remote_descr_FreeBSD <<EOF_FreeBSD |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
321 $(pkg version -U -R -r "${FREEBSD_REPO}" -n "${_ipackage}" -v) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
322 EOF_FreeBSD |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
323 read -r _dummy _remote_label_LocalBSDPorts _remote_descr_LocalBSDPorts <<EOF_LocalBSDPorts |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
324 $(pkg version -U -R -r "${LOCALBSDPORTS_REPO}" -n "${_ipackage}" -v) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
325 EOF_LocalBSDPorts |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
326 read -r _remote_fpname_SharedLocalRepo _remote_label_SharedLocalRepo _remote_descr_SharedLocalRepo <<EOF_SharedLocalRepo |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
327 $(pkg version -U -R -r "${SHARED_LOCAL_REPO}" -n "${_ipackage}" -v) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
328 EOF_SharedLocalRepo |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
329 read -r _remote_fpname_LocalRepo _remote_label_LocalRepo _remote_descr_LocalRepo <<EOF_LocalRepo |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
330 $(pkg version -U -R -r "${LOCAL_REPO}" -n "${_ipackage}" -v) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
331 EOF_LocalRepo |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
332 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
333 if [ -n "${option_verbose}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
334 print_title "${_ipackage}" "${_iversion}" "${_irepo}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
335 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
336 if get_mapping "${_ipackage}" >/dev/null; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
337 _print_detail="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
338 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
339 if [ -n "${option_alldata}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
340 _print_detail="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
341 else |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
342 if [ -n "${option_short}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
343 case "${_irepo}" in |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
344 "${FREEBSD_REPO}") |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
345 if [ -n "${_local_index_exists}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
346 if [ "${_index_label}" != '<' -a "${_index_label}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
347 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
348 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
349 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
350 if [ "${_remote_label_FreeBSD}" != '=' -o "${_remote_label_SharedLocalRepo}" != '?' -o "${_remote_label_LocalRepo}" != '?' -o "${_remote_label_LocalBSDPorts}" != '?' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
351 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
352 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
353 ;; |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
354 "${LOCALBSDPORTS_REPO}") |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
355 if [ -n "${_local_index_exists}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
356 if [ "${_index_label}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
357 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
358 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
359 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
360 if [ "${_remote_label_FreeBSD}" != '>' -o "${_remote_label_LocalRepo}" != '?' -o "${_remote_label_SharedLocalRepo}" != '?' -o "${_remote_label_LocalBSDPorts}" = '?' -o "${_remote_label_LocalBSDPorts}" = '<' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
361 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
362 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
363 ;; |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
364 "${SHARED_LOCAL_REPO}") |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
365 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
366 ;; |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
367 "${LOCAL_REPO}") |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
368 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
369 ;; |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
370 "${PORTS_DIRECT_INSTALLED_REPO}") |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
371 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
372 ;; |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
373 *) |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
374 echo "ERROR: unhandled repository: ${_irepo}" >&2 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
375 exit 1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
376 ;; |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
377 esac |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
378 else |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
379 if [ -n "${_local_index_exists}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
380 if [ "${_index_label}" != '?' -a "${_index_label}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
381 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
382 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
383 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
384 if [ "${_remote_label_FreeBSD}" != '?' -a "${_remote_label_FreeBSD}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
385 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
386 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
387 if [ "${_remote_label_LocalBSDPorts}" != '?' -a "${_remote_label_LocalBSDPorts}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
388 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
389 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
390 if [ "${_remote_label_SharedLocalRepo}" != '?' -a "${_remote_label_SharedLocalRepo}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
391 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
392 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
393 if [ "${_remote_label_LocalRepo}" != '?' -a "${_remote_label_LocalRepo}" != '=' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
394 _print_detail=1 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
395 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
396 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
397 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
398 if [ -n "${_print_detail}" ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
399 print_title "${_ipackage}" "${_iversion}" "${_irepo}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
400 if [ -n "${_local_index_exists}" ]; then |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
401 _index_version="$(get_ports_index_version "${_ipackage}")" |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
402 print_detail_item "INDEX" "${_index_version}" "${_index_label}" "${_index_descr}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
403 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
404 if [ -n "${option_alldata_FreeBSD}" -o "${_remote_label_FreeBSD}" != '?' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
405 _remote_version_FreeBSD="$(pkg rquery -U -r "${FREEBSD_REPO}" '%v' "${_ipackage}")" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
406 print_detail_item "${FREEBSD_REPO}" "${_remote_version_FreeBSD}" "${_remote_label_FreeBSD}" "${_remote_descr_FreeBSD}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
407 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
408 if [ -n "${option_alldata_LocalBSDPorts}" -o "${_remote_label_LocalBSDPorts}" != '?' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
409 _remote_version_LocalBSDPorts="$(pkg rquery -U -r "${LOCALBSDPORTS_REPO}" '%v' "${_ipackage}")" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
410 print_detail_item "${LOCALBSDPORTS_REPO}" "${_remote_version_LocalBSDPorts}" "${_remote_label_LocalBSDPorts}" "${_remote_descr_LocalBSDPorts}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
411 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
412 if [ -n "${option_alldata_SharedLocalRepo}" -o "${_remote_label_SharedLocalRepo}" != '?' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
413 _remote_version_SharedLocalRepo="$(pkg rquery -U -r "${SHARED_LOCAL_REPO}" '%v' "${_ipackage}")" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
414 print_detail_item "${SHARED_LOCAL_REPO}" "${_remote_version_SharedLocalRepo}" "${_remote_label_SharedLocalRepo}" "${_remote_descr_SharedLocalRepo}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
415 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
416 if [ -n "${option_alldata_LocalRepo}" -o "${_remote_label_LocalRepo}" != '?' ]; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
417 _remote_version_LocalRepo="$(pkg rquery -U -r "${LOCAL_REPO}" '%v' "${_ipackage}")" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
418 print_detail_item "${LOCAL_REPO}" "${_remote_version_LocalRepo}" "${_remote_label_LocalRepo}" "${_remote_descr_LocalRepo}" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
419 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
420 _mapped_package_name="$(get_mapping "${_ipackage}")" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
421 if [ -n "${_mapped_package_name}" ] ; then |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
422 printf '%18s %s %s (%s)\n' "--------------->" "${_mapped_package_name}" "$(pkg rquery -U '%v' "${_mapped_package_name}")" "$(pkg rquery -U '%R' "${_mapped_package_name}")" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
423 if [ -n "${_local_index_exists}" ]; then |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
424 print_detail_item "INDEX" "$(get_ports_index_version "${_mapped_package_name}")" "" "" |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
425 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
426 print_detail_item "${FREEBSD_REPO}" "$(pkg rquery -U -r "${FREEBSD_REPO}" '%v' "${_mapped_package_name}")" "" "" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
427 print_detail_item "${LOCALBSDPORTS_REPO}" "$(pkg rquery -U -r "${LOCALBSDPORTS_REPO}" '%v' "${_mapped_package_name}")" "" "" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
428 print_detail_item "${SHARED_LOCAL_REPO}" "$(pkg rquery -U -r "${SHARED_LOCAL_REPO}" '%v' "${_mapped_package_name}")" "" "" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
429 print_detail_item "${LOCAL_REPO}" "$(pkg rquery -U -r "${LOCAL_REPO}" '%v' "${_mapped_package_name}")" "" "" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
430 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
431 fi |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
432 done |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
433 } |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
434 |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
435 |
|
153
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
436 check_given_packages() { |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
437 : 'Check the status of all given packages in the most detail possible |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
438 |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
439 Args: |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
440 $@: the name of packaged to handle to |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
441 |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
442 ' |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
443 local _package _version _label _repo _descr _dummy |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
444 local _local_index_exists _mapped_package_name |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
445 |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
446 if test_exists_local_index; then |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
447 _local_index_exists="1" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
448 fi |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
449 |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
450 while [ $# -gt 0 ]; do |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
451 _package="$1" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
452 shift |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
453 read -r _version _repo <<EOF_INSTALLED |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
454 $(pkg query '%v %R' "${_package}") |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
455 EOF_INSTALLED |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
456 if [ -n "${_version}" ]; then |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
457 title_printed="" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
458 print_title "${_package}" "${_version}" "${_repo}" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
459 if [ -n "${_local_index_exists}" ]; then |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
460 read -r _dummy _label _descr <<EOF_INDEX |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
461 $(pkg version -U -I -n "${_package}" -v) |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
462 EOF_INDEX |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
463 _version="$(get_ports_index_version "${_package}")" |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
464 print_detail_item "INDEX" "${_version}" "${_label}" "${_descr}" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
465 fi |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
466 for _repo in "${FREEBSD_REPO}" "${LOCALBSDPORTS_REPO}" "${SHARED_LOCAL_REPO}" "${LOCAL_REPO}"; do |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
467 read -r _dummy _label _descr <<EOF_REPO |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
468 $(pkg version -U -R -r "${_repo}" -n "${_package}" -v) |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
469 EOF_REPO |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
470 _version="$(pkg rquery -U -r "${_repo}" '%v' "${_package}")" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
471 print_detail_item "${_repo}" "${_version}" "${_label}" "${_descr}" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
472 done |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
473 _mapped_package_name="$(get_mapping "${_ipackage}")" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
474 if [ -n "${_mapped_package_name}" ] ; then |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
475 printf '%18s %s %s (%s)\n' "--------------->" "${_mapped_package_name}" "$(pkg rquery -U '%v' "${_mapped_package_name}")" "$(pkg rquery -U '%R' "${_mapped_package_name}")" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
476 if [ -n "${_local_index_exists}" ]; then |
|
152
29e708b524e1
Renamed some ports index related functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
151
diff
changeset
|
477 print_detail_item "INDEX" "$(get_ports_index_version "${_mapped_package_name}")" "" "" |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
478 fi |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
479 for _repo in "${FREEBSD_REPO}" "${LOCALBSDPORTS_REPO}" "${SHARED_LOCAL_REPO}" "${LOCAL_REPO}"; do |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
480 print_detail_item "${_repo}" "$(pkg rquery -U -r "${_repo}" '%v' "${_mapped_package_name}")" "" "" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
481 done |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
482 fi |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
483 fi |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
484 done |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
485 } |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
486 |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
487 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
488 option_alldata="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
489 option_alldata_FreeBSD="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
490 option_alldata_LocalBSDPorts="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
491 opeion_alldata_SharedLocalRepo="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
492 option_alldata_LocalRepo="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
493 option_short="" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
494 option_verbose="" |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
495 option_packages="" |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
496 |
|
153
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
497 while getopts "VhAansv" _opt ; do |
|
10
f08b39dacb21
Implemented "-A" and "-a" options for printing info for all installed packages and/or with LocalRepo data
Franz Glasner <hg@dom66.de>
parents:
9
diff
changeset
|
498 case ${_opt} in |
|
81
124faa20ae80
Implemented a "-V" global option to print the program's name and version number to stdout
Franz Glasner <fzglas.hg@dom66.de>
parents:
79
diff
changeset
|
499 V) |
|
386
84d2735fe7f6
Simplified version tagging a lot: it is also faster now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
361
diff
changeset
|
500 printf 'check-ports %s\n' '@@SIMPLEVERSIONSTR@@' |
|
81
124faa20ae80
Implemented a "-V" global option to print the program's name and version number to stdout
Franz Glasner <fzglas.hg@dom66.de>
parents:
79
diff
changeset
|
501 exit 0 |
|
124faa20ae80
Implemented a "-V" global option to print the program's name and version number to stdout
Franz Glasner <fzglas.hg@dom66.de>
parents:
79
diff
changeset
|
502 ;; |
|
153
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
503 h) |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
504 echo "${USAGE}" |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
505 exit 0 |
|
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
506 ;; |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
507 A) |
| 135 | 508 # Print for every package the status of all repositories |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
509 option_alldata="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
510 option_alldata_FreeBSD="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
511 option_alldata_LocalBSDPorts="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
512 option_alldata_SharedLocalRepo="1" |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
513 option_alldata_LocalRepo="1" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
514 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
515 a) |
| 135 | 516 # Print the data of all repos that have the package |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
517 option_alldata="1" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
518 ;; |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
519 n) |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
520 # |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
521 # Print status of given packages in all details. |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
522 # No other options are respected. |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
523 # |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
524 option_packages="1" |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
525 ;; |
|
34
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
526 s) |
|
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
527 # "short" output: if installed from FreeBSD repo: don't |
|
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
528 # report if only the index is newer |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
529 option_short="1" |
|
34
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
530 ;; |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
531 v) |
| 135 | 532 # |
| 533 # Print all titles and repo of every installed package always. | |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
534 # The output of the other repo status nevertheless depends on the |
| 135 | 535 # other flag settings. |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
536 # |
|
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
537 option_verbose="1" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
538 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
539 \?) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
540 exit 2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
541 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
542 *) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
543 echo "option handling failed" >&2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
544 exit 2 |
| 42 | 545 ;; |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
546 esac |
|
12
fd56d1b7d822
Use extra flag for controlling the printing of the package title
Franz Glasner <hg@dom66.de>
parents:
11
diff
changeset
|
547 done |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
548 |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
549 # |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
550 # Reset the Shell's option handling system to prepare for handling |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
551 # command-local options. |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
552 # |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
553 shift $((OPTIND-1)) |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
554 OPTIND=1 |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
555 |
|
140
17b2f4fa9c1b
- Refactor: check-ports now deals with missing local index files
Franz Glasner <fzglas.hg@dom66.de>
parents:
139
diff
changeset
|
556 if [ -n "${option_short}" -a -n "${option_alldata}" ]; then |
|
34
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
557 echo "the -s option cannot be combined with -A or -a" >&2 |
|
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
558 exit 2 |
|
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
559 fi |
|
36a10ff20355
Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents:
33
diff
changeset
|
560 |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
561 if [ -n "${option_packages}" ]; then |
|
153
59a334dc9b53
Implement a usage message with the "-h" option
Franz Glasner <fzglas.hg@dom66.de>
parents:
152
diff
changeset
|
562 check_given_packages "$@" |
|
150
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
563 else |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
564 check_ports |
|
937c96ffe358
Implemented the "-n" option to check only given packages but in the most detail possible
Franz Glasner <fzglas.hg@dom66.de>
parents:
145
diff
changeset
|
565 fi |
