openSUSE / zypper

World's most powerful command line package manager
http://en.opensuse.org/Portal:Zypper
Other
392 stars 107 forks source link

Return ZYPPER_EXIT_INF_CAP_NOT_FOUND when info can't find all caps. #510

Closed arozyev closed 9 months ago

arozyev commented 9 months ago

This change fixes an issue of returning ZYPPER_EXIT_SUCCESS for the situation where 'zypper info non-existent' command fails to find a capatibility with given name (e.g. non-existent). This change will change the 'info' to retrun ZYPPER_EXIT_INF_CAP_NOT_FOUND if any of given capabilities isn't found.

arozyev commented 9 months ago

some test outputs.

1) info for non-existent capability

> zypper info non-existent
Loading repository data...
Reading installed packages...

package 'non-existent' not found.
> echo $?
104

2) list of capabilities, all exist

> zypper info cmake emacs
Loading repository data...
Reading installed packages...

Information for package cmake:
------------------------------
Repository     : Main Repository
Name           : cmake
Version        : 3.20.4-150400.2.5
Arch           : x86_64
Vendor         : SUSE LLC <https://www.suse.com/>
Installed Size : 715 B
Installed      : Yes (automatically)
Status         : up-to-date
Source package : cmake-3.20.4-150400.2.5.src
Upstream URL   : https://www.cmake.org/
Summary        : Cross-platform make system
Description    : 
    CMake is a cross-platform build system.

Information for package emacs:
------------------------------
Repository     : @System
Name           : emacs
Version        : 27.2-150400.3.6.1
Arch           : x86_64
Vendor         : SUSE LLC <https://www.suse.com/>
Installed Size : 71.4 MiB
Installed      : Yes
Status         : up-to-date
Source package : emacs-27.2-150400.3.6.1.src
Upstream URL   : http://www.gnu.org/software/emacs/
Summary        : GNU Emacs Base Package
Description    : 
    Basic package for the GNU Emacs editor. Requires emacs-x11 or
    emacs-nox.

> echo $?
0

3) list of capabilities, one exists, another doesn't exist

> zypper info cmake non-existent
Loading repository data...
Reading installed packages...

Information for package cmake:
------------------------------
Repository     : Main Repository
Name           : cmake
Version        : 3.20.4-150400.2.5
Arch           : x86_64
Vendor         : SUSE LLC <https://www.suse.com/>
Installed Size : 715 B
Installed      : Yes (automatically)
Status         : up-to-date
Source package : cmake-3.20.4-150400.2.5.src
Upstream URL   : https://www.cmake.org/
Summary        : Cross-platform make system
Description    : 
    CMake is a cross-platform build system.

package 'non-existent' not found.
> echo $?
104
arozyev commented 9 months ago

closing as agreed.