agama/rust/zypp-agama/zypp-agama-sys/c-layer
Ladislav Slezák 3811875437
Select addon product to install (bsc#1258187), refresh repos after registration (bsc#1259217) (#3240)
## Problem

- https://bugzilla.suse.com/show_bug.cgi?id=1258187 - the `sle-ha`
product is not installed after registering the SLES-HA extension
- https://bugzilla.suse.com/show_bug.cgi?id=1259217 - no packages are
available after registration

## Solution

- Select the product from the just registered extension to install,
select products from all registered extensions when changing the
configuration via API
- Refresh the repositories after registering a product


## Testing

- Tested manually
- The `sle-ha` product is found (as the repository is refreshed) and is
selected to install:

Log excerpt:
```
Selecting product sle-ha from repository SUSE_Linux_Enterprise_High_Availability_Extension_16.1_x86_64:SLE-Product-HA-16.1
[rust-bindings] Resetting status of all resolvables
Selecting products from service SUSE_Linux_Enterprise_High_Availability_Extension_16.1_x86_64
Selecting product sle-ha from repository SUSE_Linux_Enterprise_High_Availability_Extension_16.1_x86_64:SLE-Product-HA-16.1
Install only required packages: false
[zypp::solver] -------------- Calling SAT Solver -------------------
[zypp::solver] SATResolver::resolvePool()
[zypp::solver] SATResolver::solverInit()
[zypp::solver] Locked 0 installed items and 0 NOT installed items.
[zypp::solver] Install U_Th_(7787)sle-ha-release-16.1-160099.11.1.x86_64(SUSE_Linux_Enterprise_High_Availability_Extension_16.1_x86_64:SLE-Product-HA-16.1)
[zypp::solver] Install U_Th_(7790)product:sle-ha-16.1-0.x86_64(SUSE_Linux_Enterprise_High_Availability_Extension_16.1_x86_64:SLE-Product-HA-16.1)
[zypp::solver] Install U_Th_(7835)NetworkManager-1.54.3-160099.1.1.x86_64(SUSE_Linux_Enterprise_Server_16.1_x86_64:SLE-Product-SLES-16.1)
```
2026-03-05 09:19:13 +01:00
..
include Select addon product to install (bsc#1258187), refresh repos after registration (bsc#1259217) (#3240) 2026-03-05 09:19:13 +01:00
internal initial install callbacks 2025-11-25 14:08:22 +01:00
callbacks.cxx doc: improve the lifetime annotation for the *callbacks members 2025-11-26 14:55:36 +01:00
lib.cxx Select addon product to install (bsc#1258187), refresh repos after registration (bsc#1259217) (#3240) 2026-03-05 09:19:13 +01:00
Makefile Redirect libzypp logs to systemd journal 2025-10-09 16:28:31 +02:00
README.md implement new get patterns in zypp-agama to be able to filter user patterns later 2026-02-06 15:12:44 +01:00

C-Layer on top of Libzypp

Goal of this part is to provide C API on top of libzypp. Goal is to have it as thin layer that allows to call easily libzypp functionality from languages that have issue to call C++ code (so almost all).

Directories

  • /include is official public C API
  • /internal is internal only C++ headers when parts of code need to communicate

Reminders

  • if new header file is added to /include add it also to ../rust/zypp-agama-sys/headers.h

Coding Conventions

  • All public methods are noexcept. Instead it should get status parameter that is properly filled in both case if exception happen and also if call succeed.
  • If method progress can be observed, then use progress parameter. It can have two forms:
    1. just single method pointer and void* for data.
    2. one struct that contain multiple method pointers and for each pointer its void* data. Selection of variant depends on what libzypp provides. If libzypp use global progress Receiver, then it should be still parameter to method and it should be set at the beginning of method and unset at the end.
  • if method provide any pointer, then memory is owned by caller who should deallocate it.
  • if pointer provided by method is non-trivial ( usually struct ), then there have to be API call to free it.
  • if method gets any pointer, it is still owned by caller who is responsible for its deallocation.
  • if callback method receive any pointer, it is owned by library and library will deallocate it after callback finish.
  • if a pointer is owned by the library (and should not be freed by the caller), it must be explicitly documented (e.g. ///< library owned).
  • ideally C layer should only have runtime dependency on libzypp and libstdc++