diff options
author | Renato Botelho <renato@netgate.com> | 2017-01-10 09:04:38 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-01-10 09:04:38 -0200 |
commit | 155769f2923704ece4aea9671ad925d8222a0b76 (patch) | |
tree | cd4810bc1f656bfab1e95ce5f1df78240bcec055 | |
parent | 09744f3ae9afa8ec935e500024bf7f82a59e2753 (diff) | |
download | pfsense-155769f2923704ece4aea9671ad925d8222a0b76.zip pfsense-155769f2923704ece4aea9671ad925d8222a0b76.tar.gz |
Revert "get_pkg_info() fallback using pkg info if no local copy of repo catalog"
This reverts commit 46237e23f35db70a917939609061dce7b7f955f9.
-rw-r--r-- | src/etc/inc/pkg-utils.inc | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index 4090be1..0e13e88 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -372,13 +372,11 @@ function get_package_internal_name($package_data) { } // Get information about packages. -function get_pkg_info($pkgs = 'all', $local_only = false, $installed_only = false) { - +function get_pkg_info($pkgs = 'all', $only_local = false) { global $g, $input_errors; $out = ''; $err = ''; - $rc = 0; unset($pkg_filter); if (is_array($pkgs)) { @@ -387,7 +385,7 @@ function get_pkg_info($pkgs = 'all', $local_only = false, $installed_only = fals } if ($pkgs == 'all') { - $pkgs = $g['pkg_prefix'] . '*'; // Allows same prefix to work with both pkg search + pkg info + $pkgs = $g['pkg_prefix']; } if (!function_exists('is_subsystem_dirty')) { @@ -396,39 +394,21 @@ function get_pkg_info($pkgs = 'all', $local_only = false, $installed_only = fals /* Do not run remote operations if pkg has a lock */ if (is_subsystem_dirty('pkg')) { - $local_only = true; + $only_local = true; $lock = false; } else { $lock = true; } $extra_param = ""; - if ($local_only) { + if ($only_local) { $extra_param = "-U "; } if ($lock) { mark_subsystem_dirty('pkg'); } - - if (!$installed_only) { - // repo catalog search (either remote or local_only) - $rc = pkg_exec("search {$extra_param}-R --raw-format json-compact " . $pkgs, $out, $err); - } - if ($installed_only || ($local_only && $rc != 0)) { - /* use pkg info if (1) installed pkg search or (2) local catalog copy search requested + failed. - * - * The local repo catalog copy may be cleared if a previous call to pkg search couldn't get the - * remote repo catalog. - * - * If the calling code would have accepted local copy info (which isn't assumed up to date) then it - * makes sense to fall back on pkg info to at least return the known info about installed pkgs (pkg - * info should still work), instead of failing and returning no info at all. For example, this - * enables offline view + management of installed pkgs. - */ - - $rc = pkg_exec("info -R --raw-format json-compact " . $pkgs, $out, $err); - } + $rc = pkg_exec("search {$extra_param}-R --raw-format json-compact " . $pkgs, $out, $err); if ($lock) { clear_subsystem_dirty('pkg'); } @@ -508,8 +488,7 @@ function get_pkg_info($pkgs = 'all', $local_only = false, $installed_only = fals function register_all_installed_packages() { global $g, $config, $pkg_interface; - $pkg_info = get_pkg_info('all', true, true); - + $pkg_info = get_pkg_info('all', true); foreach ($pkg_info as $pkg) { if (!isset($pkg['installed'])) { |