Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate sbin/check-ports @ 135:8152028661c2
Comments
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 23 Oct 2019 09:06:09 +0200 |
| parents | 993fecdf2a70 |
| children | 8afc4eb30406 |
| 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 |
|
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
4 repository versions. |
|
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 |
|
a3b9d4fe560e
Provide "module" doc-strings
Franz Glasner <fzglas.hg@dom66.de>
parents:
85
diff
changeset
|
7 :Copyright: (c) 2017-2019 Franz Glasner. |
|
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> |
| 93 | 13 :ID: @(#)@@PKGORIGIN@@ $HGid$ |
|
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 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
19 # |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
20 # Configuration directory |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
21 # |
|
66
1f3a64254c9c
Replace @@ETCDIR@@ and @@INDEXFILE@@ dynamically at package build time
Franz Glasner <hg@dom66.de>
parents:
64
diff
changeset
|
22 : ${CONFIGDIR:=@@ETCDIR@@} |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
23 |
|
131
993fecdf2a70
Rename etc/tools.conf to etc/pkgtools.conf.
Franz Glasner <fzglas.hg@dom66.de>
parents:
130
diff
changeset
|
24 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
|
25 |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
26 # |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
27 # 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
|
28 # 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
|
29 # |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
30 : ${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
|
31 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
32 # |
| 55 | 33 # Local repository with non-public packages and/or ports with changed |
| 34 # OPTIONS (i.e. not using the defaults) or forks of official packages with | |
| 35 # other package names | |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
36 # |
| 1 | 37 : ${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
|
38 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
39 # |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
40 # Local repository with ports with default OPTIONS (i.e. unchanged) |
|
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
41 # but newer than the packages in the "FreeBSD" repository. |
|
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
42 # Some sort of a fast-track repository. |
|
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
43 # |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
44 : ${LOCALBSDPORTS_REPO:=LocalBSDPorts} |
| 59 | 45 |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
46 # |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
47 # The official FreeBSD binary repository |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
48 # |
| 1 | 49 : ${FREEBSD_REPO:=FreeBSD} |
| 59 | 50 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
51 # |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
52 # Directly installed from ports |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
53 # |
| 1 | 54 : ${PORTS_DIRECT_INSTALLED_REPO:=unknown-repository} |
| 55 | |
|
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
|
56 # |
|
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
|
57 # 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
|
58 # |
|
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
|
59 : ${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
|
60 : ${INDEXDIR:=${PORTSDIR}} |
|
66
1f3a64254c9c
Replace @@ETCDIR@@ and @@INDEXFILE@@ dynamically at package build time
Franz Glasner <hg@dom66.de>
parents:
64
diff
changeset
|
61 : ${INDEXFILE:=@@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
|
62 |
|
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
|
63 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
64 get_remote_repo_versions() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
65 : 'Determine the remote repository versions of all packages in |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
66 repository `_repo`. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
67 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
68 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
69 _repo: the name of the repote repository |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
70 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
71 Returns: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
72 status 0 on success, 1 on errors |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
73 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
74 Output (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
75 remote_versions_${_repo}: the versions of all packages in `_repo` and |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
76 their extended version status with respect to |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
77 locally installed packages |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
78 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
79 ' |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
80 local _repo _data _rv |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
81 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
82 _repo=$1 |
|
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
|
83 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
84 _data=$(pkg version -U -R -r ${_repo} -v) |
| 1 | 85 _rv=$? |
|
60
ec0cc8a8f27a
Renamed remote_REPO_versions to remote_versions_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
59
diff
changeset
|
86 eval remote_versions_${_repo}=\"\${_data}\" |
| 1 | 87 return ${_rv} |
| 88 } | |
| 89 | |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
90 get_remote_repo_data() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
91 : 'Get the extended package version information from the remote repository |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
92 `_repo` for package `_name`. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
93 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
94 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
95 _repo: the name of the remote repository |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
96 _name: the package name |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
97 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
98 Input (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
99 remote_versions_${_repo}: the extended version info for *all* packages |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
100 in repo `_repo`. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
101 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
102 Returns: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
103 status 0 on success, 1 on errors or if the package is not found |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
104 in the remote repository |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
105 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
106 Output (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
107 remote_label_${_repo}: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
108 remote_descr_${_repo}: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
109 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
110 ' |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
111 local _repo _name _rversions _rfqp _rl _rdescr |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
112 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
113 _repo=$1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
114 _name=$2 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
115 |
|
60
ec0cc8a8f27a
Renamed remote_REPO_versions to remote_versions_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
59
diff
changeset
|
116 eval _rversions=\"\${remote_versions_${_repo}}\" |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
117 while read _rfqp _rl _rdescr ; do |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
118 if [ ${_rfqp%-*} = ${_name} ] ; then |
|
58
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
119 eval remote_label_${_repo}=\"\${_rl}\" |
|
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
120 eval remote_descr_${_repo}=\"\${_rdescr}\" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
121 return 0 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
122 fi |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
123 done <<EOF884657 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
124 ${_rversions} |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
125 EOF884657 |
|
58
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
126 eval remote_label_${_repo}="" |
|
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
127 eval remote_descr_${_repo}="" |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
128 return 1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
129 } |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
130 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
131 get_local_index_versions() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
132 : 'Determine the extendes versions of all packages in the local index |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
133 (ports). |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
134 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
135 Returns: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
136 status 0 on success or 1 on errors |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
137 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
138 Output (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
139 local_index_versions: |
|
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 ' |
|
6
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
142 local_index_versions=$(pkg version -I -v) |
| 1 | 143 } |
| 144 | |
|
56
ad454e403e24
Rename function: has now a better name
Franz Glasner <fzglas.hg@dom66.de>
parents:
55
diff
changeset
|
145 get_repo_for_installed_package() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
146 : 'Determine for a package `_name` from which repository is has been |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
147 installed. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
148 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
149 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
150 _name: the name of the package to search for |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
151 |
|
102
91fb0af73fce
Docu: for "get_repo_for_installed_package()()" extended
Franz Glasner <fzglas.hg@dom66.de>
parents:
101
diff
changeset
|
152 Input (Globals): |
|
91fb0af73fce
Docu: for "get_repo_for_installed_package()()" extended
Franz Glasner <fzglas.hg@dom66.de>
parents:
101
diff
changeset
|
153 installed_data the output of ``pkg query "%n %v %R"`` of all |
|
91fb0af73fce
Docu: for "get_repo_for_installed_package()()" extended
Franz Glasner <fzglas.hg@dom66.de>
parents:
101
diff
changeset
|
154 installed packages |
|
91fb0af73fce
Docu: for "get_repo_for_installed_package()()" extended
Franz Glasner <fzglas.hg@dom66.de>
parents:
101
diff
changeset
|
155 |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
156 Returns: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
157 0 on success, 1 on errors or if the package is not installed |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
158 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
159 Output (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
160 repository: the repository from which the installed packages `_name` |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
161 has been installed |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
162 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
163 ' |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
164 local _name _n _v _r |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
165 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
166 _name=$1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
167 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
168 while read _n _v _r ; do |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
169 if [ ${_name} = ${_n} ] ; then |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
170 repository=${_r} |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
171 return 0 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
172 fi |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
173 done <<EOF223777 |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
174 ${installed_data} |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
175 EOF223777 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
176 return 1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
177 } |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
178 |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
179 get_immediate_index_version() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
180 : '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
|
181 local ports index. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
182 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
183 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
184 _package: the package name to search for |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
185 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
186 Input (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
187 INDEXDIR: the directory where to search the index file |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
188 INDEXFILE: the name of the index file |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
189 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
190 Returns: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
191 0 on success, 1 on errors or if the package is not in the index |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
192 |
| 100 | 193 Output (Globals): |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
194 immediate_index_version: the version number of `_package` in the |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
195 index |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
196 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
197 ' |
|
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
|
198 local _package _line _fqpn _n _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
|
199 |
|
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
|
200 _package=$1 |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
201 |
|
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
|
202 # _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
|
203 # _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
|
204 # immediate_index_version=${_val##*-} |
|
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
|
205 # return ${_rv} |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
206 |
|
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
|
207 if [ -r "${INDEXDIR}/${INDEXFILE}" ] ; then |
|
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
|
208 # |
|
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
|
209 # 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
|
210 # "_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
|
211 # 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
|
212 # |
|
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
|
213 # "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
|
214 # 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
|
215 # |
|
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
|
216 _lines=$(egrep '^'"${_package}" "${INDEXDIR}/${INDEXFILE}") |
|
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
|
217 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
|
218 _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
|
219 _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
|
220 if [ "${_package}" = "${_n}" ] ; then |
|
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
|
221 immediate_index_version="${_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
|
222 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
|
223 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
|
224 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
|
225 ${_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
|
226 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
|
227 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
|
228 |
|
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
|
229 immediate_index_version="" |
|
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
|
230 return 1 |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
231 } |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
232 |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
233 get_immediate_remote_repo_version() { |
|
118
cf9dde7a3a0d
FIX: Syntax error: there must be a word separator after the ":" command
Franz Glasner <fzglas.hg@dom66.de>
parents:
109
diff
changeset
|
234 : 'Ask a remote repository for the version of a package. |
|
108
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
235 |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
236 Args: |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
237 _repo: the repository name |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
238 _name: the name of the package |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
239 |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
240 Returns: |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
241 0 on success and other status codes otherwise |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
242 |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
243 Output (Globals): |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
244 immediate_remote_repo_version_${_repo}: the version of package `_name` |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
245 in repo `_repo` |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
246 |
|
ef1551e7cb16
Docu: get_immediate_remote_repo_version() is documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
103
diff
changeset
|
247 ' |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
248 local _repo _name _version _rv |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
249 |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
250 _repo=$1 |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
251 _name=$2 |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
252 |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
253 _version=$(pkg rquery -U -r "${_repo}" '%v' "${_name}") |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
254 _rv=$? |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
255 eval immediate_remote_repo_version_${_repo}=\"\${_version}\" |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
256 return ${_rv} |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
257 } |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
258 |
|
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
|
259 assert_local_version() { |
|
103
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
260 : 'Check whether an installed package `_name` has given |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
261 version `_version`. |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
262 |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
263 Args: |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
264 _name: the package name |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
265 _version: the version to check for |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
266 |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
267 Input (Globals): |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
268 installed_data: the output of ``pkg query "%n %v %R"`` of all |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
269 installed packages |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
270 |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
271 Returns: |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
272 - 0 if the installed version of package `_name` is equal to `_version` |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
273 - 1 if the installed version of package `_name` differs from `_version` |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
274 - 2 on other errors |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
275 |
|
05058a166e6e
Docu: assert_local_version() documented
Franz Glasner <fzglas.hg@dom66.de>
parents:
102
diff
changeset
|
276 ' |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
277 local _name _version _n _v _r |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
278 |
|
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
|
279 _name=$1 |
|
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
|
280 _version=$2 |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
281 |
|
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
|
282 while read _n _v _r ; do |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
283 if [ ${_name} = ${_n} ] ; then |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
284 if [ ${_version} != ${_v} ] ; then |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
285 return 1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
286 else |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
287 return 0 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
288 fi |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
289 fi |
|
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
|
290 done <<EOF223 |
|
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
|
291 ${installed_data} |
|
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
|
292 EOF223 |
|
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
|
293 return 2 |
|
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
|
294 } |
|
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
|
295 |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
296 get_mapping() { |
|
101
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
297 : '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
|
298 another package. |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
299 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
300 Args: |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
301 _package: the new name of the package |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
302 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
303 Returns: |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
304 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
|
305 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
306 Output (Globals): |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
307 mapped_package_name: the name of the package on which `_package` is |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
308 based on |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
309 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
310 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
|
311 `/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
|
312 Example:: |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
313 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
314 # |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
315 # _package mapped_package_name |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
316 # |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
317 fmg-nextcloud-php71 nextcloud-php71 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
318 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
|
319 |
|
bf8f0aa3c698
Docu: get_mapping() is documented now
Franz Glasner <fzglas.hg@dom66.de>
parents:
100
diff
changeset
|
320 ' |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
321 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
|
322 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
323 _package=$1 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
324 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
325 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
|
326 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
|
327 if [ "${_n}" = "${_package}" ] ; then |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
328 mapped_package_name="${_mapped}" |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
329 return 0 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
330 fi |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
331 done < ${PACKAGE_MAPPING} |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
332 fi |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
333 mapped_package_name="" |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
334 return 1 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
335 } |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
336 |
|
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
|
337 print_title() { |
|
94
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
338 : 'Print the output title line for a package |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
339 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
340 Args: |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
341 _package: the package name |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
342 _repo: the repository name |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
343 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
344 Input (Globals). |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
345 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
|
346 to be printed. |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
347 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
348 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
|
349 really printed and the variable is set to |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
350 "yes". |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
351 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
352 Output (Globals): |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
353 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
|
354 |
|
c9fb9e920a32
Docu: documented many functions
Franz Glasner <fzglas.hg@dom66.de>
parents:
93
diff
changeset
|
355 ' |
|
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
|
356 local _package _repo |
|
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
|
357 |
|
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
|
358 _package=$1 |
|
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
|
359 _repo=$2 |
|
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
|
360 if [ -z "${title_printed}" ] ; then |
|
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
|
361 echo "${_package} (${_repo})" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
362 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
|
363 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
|
364 } |
|
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
|
365 |
|
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
|
366 |
|
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
|
367 alldata_flag="" |
|
61
26cf051f6c93
Rename alldata_REPO_flag to alldata_flag_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
368 alldata_flag_LocalBSDPorts="" |
|
26cf051f6c93
Rename alldata_REPO_flag to alldata_flag_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
369 alldata_flag_LocalRepo="" |
|
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
|
370 short_flag="" |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
371 verbose_flag="" |
|
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
372 |
|
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
|
373 while getopts "VAasv" _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
|
374 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
|
375 V) |
|
130
54de2955bfa9
Put @@VERSION@@ and @@HGREVISION@@ in single quotes
Franz Glasner <fzglas.hg@dom66.de>
parents:
128
diff
changeset
|
376 echo 'check-ports v${VERSION} (rv:@@HGREVISION@@)' |
|
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
|
377 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
|
378 ;; |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
379 A) |
| 135 | 380 # Print for every package the status of all repositories |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
381 alldata_flag=1 |
|
61
26cf051f6c93
Rename alldata_REPO_flag to alldata_flag_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
382 alldata_flag_LocalBSDPorts=1 |
|
26cf051f6c93
Rename alldata_REPO_flag to alldata_flag_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
383 alldata_flag_LocalRepo=1 |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
384 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
385 a) |
| 135 | 386 # Print the data of all repos that have the package |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
387 alldata_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
388 ;; |
|
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
|
389 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
|
390 # "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
|
391 # report if only the index is newer |
|
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
|
392 short_flag=1 |
|
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
|
393 ;; |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
394 v) |
| 135 | 395 # |
| 396 # Print all titles and repo of every installed package always. | |
| 397 # The output of the repo status nevertheless depends on the | |
| 398 # other flag settings. | |
| 399 # | |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
400 verbose_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
401 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
402 \?) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
403 exit 2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
404 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
405 *) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
406 echo "option handling failed" >&2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
407 exit 2 |
| 42 | 408 ;; |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
409 esac |
|
12
fd56d1b7d822
Use extra flag for controlling the printing of the package title
Franz Glasner <hg@dom66.de>
parents:
11
diff
changeset
|
410 done |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
411 |
|
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
|
412 if [ -n "${short_flag}" -a -n "${alldata_flag}" ]; then |
|
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
|
413 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
|
414 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
|
415 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
|
416 |
|
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
|
417 installed_packages=$(pkg query '%n') |
|
4
ba95569a12b1
Use standars word separators again (i.e. don't change IFS)
Franz Glasner <hg@dom66.de>
parents:
3
diff
changeset
|
418 installed_data="$(pkg query '%n %v %R' $installed_packages)" |
| 1 | 419 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
420 get_remote_repo_versions ${LOCAL_REPO} |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
421 get_remote_repo_versions ${LOCALBSDPORTS_REPO} |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
422 get_remote_repo_versions ${FREEBSD_REPO} |
|
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
423 get_local_index_versions |
|
6
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
424 |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
425 while read lfqp llabel ldescr ; do |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
426 _installed_name=${lfqp%-*} |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
427 _installed_version=${lfqp##*-} |
|
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
|
428 title_printed="" |
|
56
ad454e403e24
Rename function: has now a better name
Franz Glasner <fzglas.hg@dom66.de>
parents:
55
diff
changeset
|
429 get_repo_for_installed_package ${_installed_name} |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
430 get_mapping ${_installed_name} |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
431 if [ -n "${verbose_flag}" ] ; then |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
432 print_title "${lfqp}" "${repository}" |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
433 fi |
|
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
|
434 if ! assert_local_version ${_installed_name} ${_installed_version} ; then |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
435 echo "Assertion failed: $lfqp ${_installed_name} ${_installed_version} ${llabel}" >&2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
436 exit 1 |
|
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
|
437 fi |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
438 get_remote_repo_data ${LOCAL_REPO} ${_installed_name} |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
439 get_remote_repo_data ${LOCALBSDPORTS_REPO} ${_installed_name} |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
440 get_remote_repo_data ${FREEBSD_REPO} ${_installed_name} |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
441 _print_detail="" |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
442 if [ -n "${mapped_package_name}" ] ; then |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
443 _print_detail=1 |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
444 fi |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
445 if [ \( -n "${alldata_flag}" \) ]; then |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
446 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
447 else |
|
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
|
448 if [ -n "${short_flag}" ]; then |
|
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
|
449 # |
|
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
|
450 # NOTE: -s and -A/-a are incompatible: so "alldata_XXX" needs not |
|
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
|
451 # to be checked! |
|
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
|
452 # |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
453 case "${repository}" in |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
454 "${FREEBSD_REPO}") |
|
58
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
455 if [ \( "${llabel}" != '<' -a "${llabel}" != '=' \) -o "${remote_label_FreeBSD}" != '=' -o "${remote_label_LocalRepo}" != '?' -o "${remote_label_LocalBSDPorts}" != '?' ]; then |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
456 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
457 fi |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
458 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
459 "${LOCAL_REPO}") |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
460 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
461 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
462 "${LOCALBSDPORTS_REPO}") |
|
58
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
463 if [ "${llabel}" != '=' -o "${remote_label_FreeBSD}" != '>' -o "${remote_label_LocalRepo}" != '?' -o "${remote_label_LocalBSDPorts}" = '?' -o "${remote_label_LocalBSDPorts}" = '<' ]; then |
|
50
f4352f7b5c86
When running in "-s"-mode: extra intelligence when the repo is LocalBSDPorts
Franz Glasner <hg@dom66.de>
parents:
49
diff
changeset
|
464 _print_detail=1 |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
465 fi |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
466 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
467 "${PORTS_DIRECT_INSTALLED_REPO}") |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
468 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
469 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
470 *) |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
471 echo "ERROR: unhandled repository: ${repository}" >&2 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
472 exit 1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
473 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
474 esac |
|
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
|
475 else |
|
58
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
476 if [ \( \( "${llabel}" != '?' -a "${llabel}" != '=' \) -o \( "${remote_label_FreeBSD}" != '?' -a "${remote_label_FreeBSD}" != '=' \) -o \( "${remote_label_LocalBSDPorts}" != '?' -a "${remote_label_LocalBSDPorts}" != '=' \) -o \( "${remote_label_LocalRepo}" != '?' -a "${remote_label_LocalRepo}" != '=' \) \) -o \( "${repository}" = "${PORTS_DIRECT_INSTALLED_REPO}" \) ]; then |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
477 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
478 fi |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
479 fi |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
480 fi |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
481 if [ -n "${_print_detail}" ]; then |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
482 print_title "${lfqp}" "${repository}" |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
483 echo " INDEX : ${llabel} ${ldescr}" |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
484 echo " FreeBSD : ${remote_label_FreeBSD} ${remote_descr_FreeBSD}" |
|
61
26cf051f6c93
Rename alldata_REPO_flag to alldata_flag_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
485 if [ \( -n "${alldata_flag_LocalBSDPorts}" \) -o \( "${remote_label_LocalBSDPorts}" != '?' \) ] ; then |
|
58
28800573d702
Rename variables: the repo name in the "label" and "descr" variables at the end of the variable name
Franz Glasner <fzglas.hg@dom66.de>
parents:
56
diff
changeset
|
486 echo " LocalBSDPorts: ${remote_label_LocalBSDPorts} ${remote_descr_LocalBSDPorts}" |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
487 fi |
|
61
26cf051f6c93
Rename alldata_REPO_flag to alldata_flag_REPO
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
488 if [ \( -n "${alldata_flag_LocalRepo}" \) -o \( "${remote_label_LocalRepo}" != '?' \) ] ; then |
|
62
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
489 echo " LocalRepo : ${remote_label_LocalRepo} ${remote_descr_LocalRepo}" |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
490 fi |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
491 if [ -n "${mapped_package_name}" ] ; then |
|
6c8ee1ef9ef2
First parts of checks of forked and/or renamed packages
Franz Glasner <fzglas.hg@dom66.de>
parents:
61
diff
changeset
|
492 echo " ---> ${mapped_package_name}" |
|
63
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
493 get_immediate_index_version "${mapped_package_name}" |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
494 get_immediate_remote_repo_version ${LOCAL_REPO} ${mapped_package_name} |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
495 get_immediate_remote_repo_version ${LOCALBSDPORTS_REPO} ${mapped_package_name} |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
496 get_immediate_remote_repo_version ${FREEBSD_REPO} ${mapped_package_name} |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
497 echo " INDEX : ${immediate_index_version}" |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
498 echo " FreeBSD : ${immediate_remote_repo_version_FreeBSD}" |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
499 echo " LocalBSDPorts: ${immediate_remote_repo_version_LocalBSDPorts}" |
|
0ae7697702b3
Handling of mapped packages is basically implemented.
Franz Glasner <hg@dom66.de>
parents:
62
diff
changeset
|
500 echo " LocalRepo : ${immediate_remote_repo_version_LocalRepo}" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
501 fi |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
502 fi |
|
6
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
503 done <<EOF856661111299999 |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
504 ${local_index_versions} |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
505 EOF856661111299999 |
