Mercurial > octave
comparison scripts/pkg/pkg.m @ 12778:0ca5672d5f1a
Implement pkg update command
author | Lukas Reichlin <lukas.reichlin@gmail.com> |
---|---|
date | Thu, 07 Jul 2011 19:16:14 -0400 |
parents | 762d10c77277 |
children | 095fd5c8b7e1 |
comparison
equal
deleted
inserted
replaced
12777:6c1d0f03c331 | 12778:0ca5672d5f1a |
---|---|
264 prefix = tilde_expand (prefix); | 264 prefix = tilde_expand (prefix); |
265 archprefix = tilde_expand (archprefix); | 265 archprefix = tilde_expand (archprefix); |
266 endif | 266 endif |
267 | 267 |
268 available_actions = {"list", "install", "uninstall", "load", ... | 268 available_actions = {"list", "install", "uninstall", "load", ... |
269 "unload", "prefix", "local_list", ... | 269 "unload", "prefix", "local_list", ... |
270 "global_list", "rebuild", "build","describe"}; | 270 "global_list", "rebuild", "build", ... |
271 "describe", "update"}; | |
271 ## Handle input | 272 ## Handle input |
272 if (length (varargin) == 0 || ! iscellstr (varargin)) | 273 if (length (varargin) == 0 || ! iscellstr (varargin)) |
273 print_usage (); | 274 print_usage (); |
274 endif | 275 endif |
275 files = {}; | 276 files = {}; |
489 local_packages = pkg_desc_list; | 490 local_packages = pkg_desc_list; |
490 global_packages = flag; | 491 global_packages = flag; |
491 otherwise | 492 otherwise |
492 error ("you can request at most two outputs when calling 'pkg describe'"); | 493 error ("you can request at most two outputs when calling 'pkg describe'"); |
493 endswitch | 494 endswitch |
495 | |
496 case "update" | |
497 if (nargout == 0) | |
498 installed_pkgs_lst = installed_packages (local_list, global_list); | |
499 for i = 1:length (installed_pkgs_lst) | |
500 installed_pkg_name = installed_pkgs_lst{i}.name; | |
501 installed_pkg_version = installed_pkgs_lst{i}.version; | |
502 forge_pkg_version = get_forge_pkg (installed_pkg_name); | |
503 if (compare_versions (forge_pkg_version, installed_pkg_version, ">")) | |
504 feval (@pkg, "install", "-forge", installed_pkg_name); | |
505 endif | |
506 endfor | |
507 else | |
508 error ("no output arguments available"); | |
509 endif | |
494 | 510 |
495 otherwise | 511 otherwise |
496 error ("you must specify a valid action for 'pkg'. See 'help pkg' for details"); | 512 error ("you must specify a valid action for 'pkg'. See 'help pkg' for details"); |
497 endswitch | 513 endswitch |
498 endfunction | 514 endfunction |