yast / yast-yast2

YaST module yast2
http://en.opensuse.org/Portal:YaST
GNU General Public License v2.0
56 stars 44 forks source link

Uniquely identify the Resolvable object (bsc#1178688, bsc#1176276) #1131

Closed lslezak closed 3 years ago

lslezak commented 3 years ago

Details

The Resolvable class uses the kind, name, version, arch and source attributes for mapping the Ruby objects to the libzypp objects. (It avoids using memory pointers or other "unsafe" options.) It assumed that a repository cannot contain the same package in exactly same version twice (or more than once).

But it turned out that this is not true for Product objects, the updates repository can contain several sles-release RPM packages defining the very same SLES-15.2-0 product:

S | Name            | Type    | Version             | Arch   | Repository
--+-----------------+---------+---------------------+--------+------------
  | SLES            | product | 15.2-0              | x86_64 | sle-product
  | SLES            | product | 15.2-0              | x86_64 | sle-product
  | sles-release    | package | 15.2-52.1           | x86_64 | sle-product
  | sles-release    | package | 15.2-49.1           | x86_64 | sle-product

The problem is when the code asks: "Is the SLES-15.2-0 product selected to install?" At that point the code will evaluate the status of the first found object. If accidentally the second object is selected to install the YaST will see unselected SLES and report that "No base product selected" error.

The Solution

That means we need to add another attribute which is unique. And that's the path (location) in the repo on the medium (example: ./x86_64/yast2-4.1.77-lp151.2.19.1.rpm). Zypp Product does not have a package path, but we can use it's reference package (usually the *-release.rpm).

Dependencies

Testing

Additional Changes

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.002%) to 31.095% when pulling 739183c9debdf79af9ea278f09ad953d19a42d93 on bsc_1178688_sp2 into 183cdeb5e51c754f930a10b9e3d7aaaa930741bd on SLE-15-SP2.

lslezak commented 3 years ago

Submitted in https://build.suse.de/request/show/234300