annotate bin/check-ports @ 42:ace5d471abbd

Code style
author Franz Glasner <hg@dom66.de>
date Wed, 22 Nov 2017 08:49:18 +0100
parents 36a10ff20355
children 1066c046c93b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 #
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
12 # Local repository with
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
13 # non-public packages and/or ports with changed OPTIONS (i.e. not using the
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
14 # defaults)
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
15 #
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
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}
15
532757223c28 Handle a "FreeBSDPorts" repository also.
Franz Glasner <hg@dom66.de>
parents: 14
diff changeset
23 #
14
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
24 # The official FreeBSD binary repository
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
25 #
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
26 : ${FREEBSD_REPO:=FreeBSD}
14
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
27 #
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
28 # Directly installed from ports
c0e2eb5613fe Comment on the 3 repositories handled repositories
Franz Glasner <hg@dom66.de>
parents: 12
diff changeset
29 #
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
30 : ${PORTS_DIRECT_INSTALLED_REPO:=unknown-repository}
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
31
5
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
32 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
33 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
34
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
35 _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
36
5
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
37 _data=$(pkg version -U -R -r ${_repo} -v)
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
38 _rv=$?
5
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
39 eval remote_${_repo}_versions=\"\${_data}\"
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
40 return ${_rv}
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
41 }
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
42
8
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
43 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
44 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
45
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
46 _repo=$1
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
47 _name=$2
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
48
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
49 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
50 while read _rfqp _rl _rdescr ; do
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
51 if [ ${_rfqp%-*} = ${_name} ] ; then
33
1537aff795c5 FIX: Quote all variables used for labels because they can contain a '?' character and thus is influenced by the shell's automatic filename expansion.
Franz Glasner <hg@dom66.de>
parents: 32
diff changeset
52 eval remote_${_repo}_label=\"\${_rl}\"
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
53 eval remote_${_repo}_descr=\"\${_rdescr}\"
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
54 return 0
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
55 fi
8
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
56 done <<EOF884657
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
57 ${_rversions}
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
58 EOF884657
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
59 eval remote_${_repo}_label=""
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
60 eval remote_${_repo}_descr=""
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
61 return 1
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
62 }
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
63
5
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
64 get_local_index_versions() {
6
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
65 local_index_versions=$(pkg version -I -v)
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
66 }
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
67
8
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
68 get_repo_for_package() {
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
69 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
70
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
71 _name=$1
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 while read _n _v _r ; do
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
74 if [ ${_name} = ${_n} ] ; then
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
75 repository=${_r}
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
76 return 0
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
77 fi
23
242055572964 FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents: 22
diff changeset
78 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
79 ${installed_data}
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
80 EOF223777
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
81 return 1
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
82 }
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
83
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
84 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
85 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
86
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
87 _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
88 _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
89
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
90 while read _n _v _r ; do
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
91 if [ ${_name} = ${_n} ] ; then
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
92 if [ ${_version} != ${_v} ] ; then
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
93 return 1
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
94 else
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
95 return 0
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
96 fi
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
97 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
98 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
99 ${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
100 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 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
102 }
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
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
104 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
105 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
106
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 _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
108 _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
109 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
110 echo "${_package} (${_repo})"
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
111 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
112 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
113 }
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
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
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
116 alldata_flag=""
22
864971f5cddd Renamed FreeBSDPorts to LocalBSDPorts.
Franz Glasner <f.glasner@feldmann-mg.com>
parents: 21
diff changeset
117 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
118 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
119 short_flag=""
9
6b77068e7ec8 Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents: 8
diff changeset
120 verbose_flag=""
6b77068e7ec8 Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents: 8
diff changeset
121
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
122 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
123 case ${_opt} in
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
124 A)
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
125 # print for every package the status of all repositories
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
126 alldata_flag=1
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
127 alldata_LocalBSDPorts_flag=1
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
128 alldata_LocalRepo_flag=1
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
129 ;;
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
130 a)
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
131 # 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
132 alldata_flag=1
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
133 ;;
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
134 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
135 # "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
136 # 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
137 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
138 ;;
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
139 v)
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
140 # print all titles and repo of every installed always
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
141 verbose_flag=1
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
142 ;;
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
143 \?)
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
144 exit 2
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 *)
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
147 echo "option handling failed" >&2
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
148 exit 2
42
ace5d471abbd Code style
Franz Glasner <hg@dom66.de>
parents: 34
diff changeset
149 ;;
9
6b77068e7ec8 Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents: 8
diff changeset
150 esac
12
fd56d1b7d822 Use extra flag for controlling the printing of the package title
Franz Glasner <hg@dom66.de>
parents: 11
diff changeset
151 done
9
6b77068e7ec8 Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents: 8
diff changeset
152
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
153 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
154 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
155 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
156 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
157
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
158 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
159 installed_data="$(pkg query '%n %v %R' $installed_packages)"
1
7c9ddbea00c8 Work on the check script
Franz Glasner <hg@dom66.de>
parents: 0
diff changeset
160
5
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
161 get_remote_repo_versions ${LOCAL_REPO}
23
242055572964 FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents: 22
diff changeset
162 get_remote_repo_versions ${LOCALBSDPORTS_REPO}
5
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
163 get_remote_repo_versions ${FREEBSD_REPO}
53c3500894d2 Begin a new implementation algorithm
Franz Glasner <hg@dom66.de>
parents: 4
diff changeset
164 get_local_index_versions
6
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
165
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
166 while read lfqp llabel ldescr ; do
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
167 _installed_name=${lfqp%-*}
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
168 _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
169 title_printed=""
24
eb764268337c FIX: Print the correct repository in all cases
Franz Glasner <f.glasner@feldmann-mg.com>
parents: 23
diff changeset
170 get_repo_for_package ${_installed_name}
9
6b77068e7ec8 Introduced option handling with getopts: implemented a "v" option (verbose)
Franz Glasner <hg@dom66.de>
parents: 8
diff changeset
171 if [ -n "${verbose_flag}" ] ; then
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
172 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
173 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
174 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
175 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
176 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
177 fi
8
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
178 get_remote_repo_data ${LOCAL_REPO} ${_installed_name}
23
242055572964 FIX: Variable naming
Franz Glasner <f.glasner@feldmann-mg.com>
parents: 22
diff changeset
179 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
180 get_remote_repo_data ${FREEBSD_REPO} ${_installed_name}
33
1537aff795c5 FIX: Quote all variables used for labels because they can contain a '?' character and thus is influenced by the shell's automatic filename expansion.
Franz Glasner <hg@dom66.de>
parents: 32
diff changeset
181 if [ \( -n "${alldata_flag}" \) -o \( "${llabel}" != '?' -a "${llabel}" != '=' \) -o \( "${remote_FreeBSD_label}" != '?' -a "${remote_FreeBSD_label}" != '=' \) -o \( "${remote_LocalBSDPorts_label}" != '?' -a "${remote_LocalBSDPorts_label}" != '=' \) -o \( "${remote_LocalRepo_label}" != '?' -a "${remote_LocalRepo_label}" != '=' \) ] ; then
34
36a10ff20355 Implemented a -s (short) flag that filters output if the repo is FreeBSD and only the local portstree INDEX has a newer version
Franz Glasner <hg@dom66.de>
parents: 33
diff changeset
182 _print_detail=""
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
183 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
184 #
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
185 # 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
186 # 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
187 #
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 if [ "${repository}" != "${FREEBSD_REPO}" -o "${llabel}" != '<' -o "${remote_FreeBSD_label}" != '=' -o "${remote_LocalRepo_label}" != '?' -o "${remote_LocalBSDPorts_label}" != '?' ]; 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
189 _print_detail=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
190 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
191 else
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
192 _print_detail=1
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
193 fi
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
194 if [ -n "${_print_detail}" ]; 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
195 print_title "${lfqp}" "${repository}"
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
196 echo " INDEX: ${llabel} ${ldescr}"
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
197 echo " FreeBSD: ${remote_FreeBSD_label} ${remote_FreeBSD_descr}"
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
198 if [ \( -n "${alldata_LocalBSDPorts_flag}" \) -o \( "${remote_LocalBSDPorts_label}" != '?' \) ] ; 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
199 echo " LocalBSDPorts: ${remote_LocalBSDPorts_label} ${remote_LocalBSDPorts_descr}"
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
200 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
201 if [ \( -n "${alldata_LocalRepo_flag}" \) -o \( "${remote_LocalRepo_label}" != '?' \) ] ; 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
202 echo " LocalRepo: ${remote_LocalRepo_label} ${remote_LocalRepo_descr}"
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
203 fi
32
37f003c9f4e2 untabify and comments for options
Franz Glasner <hg@dom66.de>
parents: 31
diff changeset
204 fi
8
208545b92d43 First working version: real useful output of packages differing from any repo
Franz Glasner <hg@dom66.de>
parents: 7
diff changeset
205 fi
6
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
206 done <<EOF856661111299999
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
207 ${local_index_versions}
0d9a499e89e9 More tests with regard to the new algorithm
Franz Glasner <hg@dom66.de>
parents: 5
diff changeset
208 EOF856661111299999