Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
annotate bin/check-ports @ 59:4805789ebbb3
Style: WS
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 21 Mar 2019 00:58:09 +0100 |
| parents | 28800573d702 |
| children | ec0cc8a8f27a |
| 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 |
|
16
08fc189baf67
Put some keyword expansion into the port.
Franz Glasner <hg@dom66.de>
parents:
15
diff
changeset
|
2 # |
|
21
441e007426e7
Adjusted keyword replacement to my latest standard
Franz Glasner <hg@dom66.de>
parents:
20
diff
changeset
|
3 # $HGsource$ |
|
441e007426e7
Adjusted keyword replacement to my latest standard
Franz Glasner <hg@dom66.de>
parents:
20
diff
changeset
|
4 # $Revision$ $Date$ $Author$ |
|
441e007426e7
Adjusted keyword replacement to my latest standard
Franz Glasner <hg@dom66.de>
parents:
20
diff
changeset
|
5 # |
|
441e007426e7
Adjusted keyword replacement to my latest standard
Franz Glasner <hg@dom66.de>
parents:
20
diff
changeset
|
6 # $HGpath$ |
|
16
08fc189baf67
Put some keyword expansion into the port.
Franz Glasner <hg@dom66.de>
parents:
15
diff
changeset
|
7 # |
|
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
|
8 |
|
17
089afc4908c0
Expand @@VERSION@@ with the package version also
Franz Glasner <hg@dom66.de>
parents:
16
diff
changeset
|
9 VERSION=@@VERSION@@ |
|
089afc4908c0
Expand @@VERSION@@ with the package version also
Franz Glasner <hg@dom66.de>
parents:
16
diff
changeset
|
10 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
11 # |
| 55 | 12 # Local repository with non-public packages and/or ports with changed |
| 13 # OPTIONS (i.e. not using the defaults) or forks of official packages with | |
| 14 # other package names | |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
15 # |
| 1 | 16 : ${LOCAL_REPO:=LocalRepo} |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
17 # |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
18 # 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
|
19 # but newer than the packages in the "FreeBSD" repository. |
|
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
20 # Some sort of a fast-track repository. |
|
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
21 # |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
22 : ${LOCALBSDPORTS_REPO:=LocalBSDPorts} |
| 59 | 23 |
|
15
532757223c28
Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents:
14
diff
changeset
|
24 # |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
25 # The official FreeBSD binary repository |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
26 # |
| 1 | 27 : ${FREEBSD_REPO:=FreeBSD} |
| 59 | 28 |
|
14
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
29 # |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
30 # Directly installed from ports |
|
c0e2eb5613fe
Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents:
12
diff
changeset
|
31 # |
| 1 | 32 : ${PORTS_DIRECT_INSTALLED_REPO:=unknown-repository} |
| 33 | |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
34 get_remote_repo_versions() { |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
35 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
|
36 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
37 _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
|
38 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
39 _data=$(pkg version -U -R -r ${_repo} -v) |
| 1 | 40 _rv=$? |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
41 eval remote_${_repo}_versions=\"\${_data}\" |
| 1 | 42 return ${_rv} |
| 43 } | |
| 44 | |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
45 get_remote_repo_data() { |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
46 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
|
47 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
48 _repo=$1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
49 _name=$2 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
50 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
51 eval _rversions=\"\${remote_${_repo}_versions}\" |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
52 while read _rfqp _rl _rdescr ; do |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
53 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
|
54 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
|
55 eval remote_descr_${_repo}=\"\${_rdescr}\" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
56 return 0 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
57 fi |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
58 done <<EOF884657 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
59 ${_rversions} |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 return 1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
64 } |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
65 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
66 get_local_index_versions() { |
|
6
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
67 local_index_versions=$(pkg version -I -v) |
| 1 | 68 } |
| 69 | |
|
56
ad454e403e24
Rename function: has now a better name
Franz Glasner <fzglas.hg@dom66.de>
parents:
55
diff
changeset
|
70 get_repo_for_installed_package() { |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
71 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
|
72 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
73 _name=$1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
74 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
75 while read _n _v _r ; do |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
76 if [ ${_name} = ${_n} ] ; then |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
77 repository=${_r} |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
78 return 0 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
79 fi |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
80 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
|
81 ${installed_data} |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
82 EOF223777 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
83 return 1 |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
84 } |
|
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
85 |
|
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
|
86 assert_local_version() { |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
87 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
|
88 |
|
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
|
89 _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
|
90 _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
|
91 |
|
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
|
92 while read _n _v _r ; do |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
93 if [ ${_name} = ${_n} ] ; then |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
94 if [ ${_version} != ${_v} ] ; then |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
95 return 1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
96 else |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
97 return 0 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
98 fi |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
99 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
|
100 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
|
101 ${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
|
102 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
|
103 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
|
104 } |
|
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
|
105 |
|
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
|
106 print_title() { |
|
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
|
107 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
|
108 |
|
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
|
109 _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
|
110 _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
|
111 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
|
112 echo "${_package} (${_repo})" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
113 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
|
114 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
|
115 } |
|
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
|
116 |
|
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
|
117 |
|
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
|
118 alldata_flag="" |
|
22
864971f5cddd
Renamed FreeBSDPorts to LocalBSDPorts.
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
21
diff
changeset
|
119 alldata_LocalBSDPorts_flag="" |
|
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
|
120 alldata_LocalRepo_flag="" |
|
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
|
121 short_flag="" |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
122 verbose_flag="" |
|
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
123 |
|
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
|
124 while getopts "Aasv" _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
|
125 case ${_opt} in |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
126 A) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
127 # print for every package the status of all repositories |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
128 alldata_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
129 alldata_LocalBSDPorts_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
130 alldata_LocalRepo_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
131 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
132 a) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
133 # print the data of all repos that have the package |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
134 alldata_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
135 ;; |
|
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
|
136 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
|
137 # "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
|
138 # 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
|
139 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
|
140 ;; |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
141 v) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
142 # print all titles and repo of every installed always |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
143 verbose_flag=1 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
144 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
145 \?) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
146 exit 2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
147 ;; |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
148 *) |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
149 echo "option handling failed" >&2 |
|
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
150 exit 2 |
| 42 | 151 ;; |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
152 esac |
|
12
fd56d1b7d822
Use extra flag for controlling the printing of the package title
Franz Glasner <hg@dom66.de>
parents:
11
diff
changeset
|
153 done |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
154 |
|
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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 |
|
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
|
160 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
|
161 installed_data="$(pkg query '%n %v %R' $installed_packages)" |
| 1 | 162 |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
163 get_remote_repo_versions ${LOCAL_REPO} |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
164 get_remote_repo_versions ${LOCALBSDPORTS_REPO} |
|
5
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
165 get_remote_repo_versions ${FREEBSD_REPO} |
|
53c3500894d2
Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents:
4
diff
changeset
|
166 get_local_index_versions |
|
6
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
167 |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
168 while read lfqp llabel ldescr ; do |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
169 _installed_name=${lfqp%-*} |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
170 _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
|
171 title_printed="" |
|
56
ad454e403e24
Rename function: has now a better name
Franz Glasner <fzglas.hg@dom66.de>
parents:
55
diff
changeset
|
172 get_repo_for_installed_package ${_installed_name} |
|
9
6b77068e7ec8
Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents:
8
diff
changeset
|
173 if [ -n "${verbose_flag}" ] ; then |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 fi |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
180 get_remote_repo_data ${LOCAL_REPO} ${_installed_name} |
|
23
242055572964
FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
22
diff
changeset
|
181 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
|
182 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
|
183 _print_detail="" |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
184 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
|
185 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
186 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
|
187 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
|
188 # |
|
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
|
189 # 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
|
190 # 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
|
191 # |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
192 case "${repository}" in |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
193 "${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
|
194 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
|
195 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
196 fi |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
197 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
198 "${LOCAL_REPO}") |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
199 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
200 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
201 "${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
|
202 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
|
203 _print_detail=1 |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
204 fi |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
205 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
206 "${PORTS_DIRECT_INSTALLED_REPO}") |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
207 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
208 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
209 *) |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
210 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
|
211 exit 1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
212 ;; |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 _print_detail=1 |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
217 fi |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
218 fi |
|
51
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
219 fi |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
220 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
|
221 print_title "${lfqp}" "${repository}" |
|
9e131a355fbe
Refactor: new -s (short-mode) implementation and new loop architecture
Franz Glasner <hg@dom66.de>
parents:
50
diff
changeset
|
222 echo " INDEX: ${llabel} ${ldescr}" |
|
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
|
223 echo " FreeBSD: ${remote_label_FreeBSD} ${remote_descr_FreeBSD}" |
|
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
|
224 if [ \( -n "${alldata_LocalBSDPorts_flag}" \) -o \( "${remote_label_LocalBSDPorts}" != '?' \) ] ; then |
|
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
|
225 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
|
226 fi |
|
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
|
227 if [ \( -n "${alldata_LocalRepo_flag}" \) -o \( "${remote_label_LocalRepo}" != '?' \) ] ; then |
|
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
|
228 echo " LocalRepo: ${remote_label_LocalRepo} ${remote_descr_LocalRepo}" |
|
32
37f003c9f4e2
untabify and comments for options
Franz Glasner <hg@dom66.de>
parents:
31
diff
changeset
|
229 fi |
|
8
208545b92d43
First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents:
7
diff
changeset
|
230 fi |
|
6
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
231 done <<EOF856661111299999 |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
232 ${local_index_versions} |
|
0d9a499e89e9
More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents:
5
diff
changeset
|
233 EOF856661111299999 |
