Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison bin/check-ports @ 94:c9fb9e920a32
Docu: documented many functions
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 09 Sep 2019 09:43:13 +0200 |
| parents | c95726f83f84 |
| children | 7a064049405f |
comparison
equal
deleted
inserted
replaced
| 93:c95726f83f84 | 94:c9fb9e920a32 |
|---|---|
| 58 : ${INDEXDIR:=${PORTSDIR}} | 58 : ${INDEXDIR:=${PORTSDIR}} |
| 59 : ${INDEXFILE:=@@INDEXFILE@@} | 59 : ${INDEXFILE:=@@INDEXFILE@@} |
| 60 | 60 |
| 61 | 61 |
| 62 get_remote_repo_versions() { | 62 get_remote_repo_versions() { |
| 63 : 'Determine the remote repository versions of all packages in | |
| 64 repository `_repo`. | |
| 65 | |
| 66 Args: | |
| 67 _repo: the name of the repote repository | |
| 68 | |
| 69 Returns: | |
| 70 status 0 on success, 1 on errors | |
| 71 | |
| 72 Output (Globals): | |
| 73 remote_versions_${_repo}: the versions of all packages in `_repo` and | |
| 74 their extended version status with respect to | |
| 75 locally installed packages | |
| 76 | |
| 77 ' | |
| 63 local _repo _data _rv | 78 local _repo _data _rv |
| 64 | 79 |
| 65 _repo=$1 | 80 _repo=$1 |
| 66 | 81 |
| 67 _data=$(pkg version -U -R -r ${_repo} -v) | 82 _data=$(pkg version -U -R -r ${_repo} -v) |
| 69 eval remote_versions_${_repo}=\"\${_data}\" | 84 eval remote_versions_${_repo}=\"\${_data}\" |
| 70 return ${_rv} | 85 return ${_rv} |
| 71 } | 86 } |
| 72 | 87 |
| 73 get_remote_repo_data() { | 88 get_remote_repo_data() { |
| 89 : 'Get the extended package version information from the remote repository | |
| 90 `_repo` for package `_name`. | |
| 91 | |
| 92 Args: | |
| 93 _repo: the name of the remote repository | |
| 94 _name: the package name | |
| 95 | |
| 96 Input (Globals): | |
| 97 remote_versions_${_repo}: the extended version info for *all* packages | |
| 98 in repo `_repo`. | |
| 99 | |
| 100 Returns: | |
| 101 status 0 on success, 1 on errors or if the package is not found | |
| 102 in the remote repository | |
| 103 | |
| 104 Output (Globals): | |
| 105 remote_label_${_repo}: | |
| 106 remote_descr_${_repo}: | |
| 107 | |
| 108 ' | |
| 74 local _repo _name _rversions _rfqp _rl _rdescr | 109 local _repo _name _rversions _rfqp _rl _rdescr |
| 75 | 110 |
| 76 _repo=$1 | 111 _repo=$1 |
| 77 _name=$2 | 112 _name=$2 |
| 78 | 113 |
| 90 eval remote_descr_${_repo}="" | 125 eval remote_descr_${_repo}="" |
| 91 return 1 | 126 return 1 |
| 92 } | 127 } |
| 93 | 128 |
| 94 get_local_index_versions() { | 129 get_local_index_versions() { |
| 130 : 'Determine the extendes versions of all packages in the local index | |
| 131 (ports). | |
| 132 | |
| 133 Returns: | |
| 134 status 0 on success or 1 on errors | |
| 135 | |
| 136 Output (Globals): | |
| 137 local_index_versions: | |
| 138 | |
| 139 ' | |
| 95 local_index_versions=$(pkg version -I -v) | 140 local_index_versions=$(pkg version -I -v) |
| 96 } | 141 } |
| 97 | 142 |
| 98 get_repo_for_installed_package() { | 143 get_repo_for_installed_package() { |
| 144 : 'Determine for a package `_name` from which repository is has been | |
| 145 installed. | |
| 146 | |
| 147 Args: | |
| 148 _name: the name of the package to search for | |
| 149 | |
| 150 Returns: | |
| 151 0 on success, 1 on errors or if the package is not installed | |
| 152 | |
| 153 Output (Globals): | |
| 154 repository: the repository from which the installed packages `_name` | |
| 155 has been installed | |
| 156 | |
| 157 ' | |
| 99 local _name _n _v _r | 158 local _name _n _v _r |
| 100 | 159 |
| 101 _name=$1 | 160 _name=$1 |
| 102 | 161 |
| 103 while read _n _v _r ; do | 162 while read _n _v _r ; do |
| 110 EOF223777 | 169 EOF223777 |
| 111 return 1 | 170 return 1 |
| 112 } | 171 } |
| 113 | 172 |
| 114 get_immediate_index_version() { | 173 get_immediate_index_version() { |
| 174 : 'Determine for package `_package` the version of the package in the | |
| 175 local ports index. | |
| 176 | |
| 177 Args: | |
| 178 _package: the package name to search for | |
| 179 | |
| 180 Input (Globals): | |
| 181 INDEXDIR: the directory where to search the index file | |
| 182 INDEXFILE: the name of the index file | |
| 183 | |
| 184 Returns: | |
| 185 0 on success, 1 on errors or if the package is not in the index | |
| 186 | |
| 187 Output(Globals): | |
| 188 immediate_index_version: the version number of `_package` in the | |
| 189 index | |
| 190 | |
| 191 ' | |
| 115 local _package _line _fqpn _n _lines | 192 local _package _line _fqpn _n _lines |
| 116 | 193 |
| 117 _package=$1 | 194 _package=$1 |
| 118 | 195 |
| 119 # _val=$(pkg rquery -I "${_package}" | cut -f 1 -d '|') | 196 # _val=$(pkg rquery -I "${_package}" | cut -f 1 -d '|') |
| 195 mapped_package_name="" | 272 mapped_package_name="" |
| 196 return 1 | 273 return 1 |
| 197 } | 274 } |
| 198 | 275 |
| 199 print_title() { | 276 print_title() { |
| 277 : 'Print the output title line for a package | |
| 278 | |
| 279 Args: | |
| 280 _package: the package name | |
| 281 _repo: the repository name | |
| 282 | |
| 283 Input (Globals). | |
| 284 title_printed: a global that determines if the title really needs | |
| 285 to be printed. | |
| 286 | |
| 287 If it is an empty string the the title is | |
| 288 really printed and the variable is set to | |
| 289 "yes". | |
| 290 | |
| 291 Output (Globals): | |
| 292 title_printed: set to "yes" if the title has been printed | |
| 293 | |
| 294 ' | |
| 200 local _package _repo | 295 local _package _repo |
| 201 | 296 |
| 202 _package=$1 | 297 _package=$1 |
| 203 _repo=$2 | 298 _repo=$2 |
| 204 if [ -z "${title_printed}" ] ; then | 299 if [ -z "${title_printed}" ] ; then |
