How to get started with writing a library that uses libzypp?
Hello List, I've tried to search the list archives, the openSUSE Wiki, and the developer documentation of libzypp. But couldn't find any recent content around my question. Hence, writing to the list. I need to implement a wrapper library over libzypp to fetch some simple software management information from the system like: * list of available updates - recommended - security * when was the last update installed (if possible) * is the system registered? * apply available updates (optional/future) But I'm not able to get started with a basic library. I've tried to go through the existing implementations. Most of the implementations start with calling `getZypp()` to acquire the lock. I'm not able to figure out what should be the next step. Is there any guide, blog post, document, or (newer) example that would help me understand the process? Should I be using libzypp directly or should I use PackageKit? I'm more comfortable writing in C rather than C++. Any recommendations and pointers would be greatly appreciated! Regards, Srinidhi.
Dne 05. 06. 22 v 10:01 Srinidhi B napsal(a): [...]
I need to implement a wrapper library over libzypp to fetch some simple software management information from the system like: * list of available updates - recommended - security * when was the last update installed (if possible) * is the system registered?
SUSE registration is handled completely outside of libzypp, it does not know whether the system is registered or not. That's handled at a different level. In case of YaST/SUSEConnect it is just a trivial file check for the presence of the /etc/zypp/credentials.d/SCCcredentials file: https://github.com/yast/yast-registration/blob/033c88c33009d34c986501609d109...
* apply available updates (optional/future)
But I'm not able to get started with a basic library. I've tried to go through the existing implementations. Most of the implementations start with calling `getZypp()` to acquire the lock. I'm not able to figure out what should be the next step.
Is there any guide, blog post, document, or (newer) example that would help me understand the process?
This is the minimal YaST code for initializing the libzypp: https://github.com/yast/yast-pkg-bindings/wiki/Code-Snippets#initialization The most important are the last 4 calls, at the beginning there is just some UI initialization code. Check the implementation of these calls.
Should I be using libzypp directly or should I use PackageKit? I'm more comfortable writing in C rather than C++.
It depends. PackageKit has some advantages and disadvantages. Pros: - High level API, no need to learn low-level implementation details - DBUs access, you can implement a client in any language which has DBus bindings, that practically means any language. Here is a Javascript (Cockpit plugin) example for reading the configured repositories: https://github.com/lslezak/cockpit-plugins/blob/master/repositories-packagek... - Can work with other backends (apt,...) so it is easy to support other distributions like Ubuntu or Debian - Possible non-root access, you can install package updates as a regular user Cons: - The high level API might not allow you to set all options or provide all low-level details (for repositories you cannot get the autorefresh status, you cannot set the target root so you cannot manage a system in chroot) - Additional dependencies (DBus, PackageKit libzypp backend) So it highly depends on your requirements and needs... -- Ladislav Slezák YaST Developer SUSE LINUX, s.r.o. Corso IIa Křižíkova 148/34 18600 Praha 8
On Sunday 05 June 2022 10:01:07 Srinidhi B wrote:
But I'm not able to get started with a basic library. I've tried to go through the existing implementations. Most of the implementations start with calling `getZypp()` to acquire the lock. I'm not able to figure out what should be the next step.
Is there any guide, blog post, document, or (newer) example that would help me understand the process?
Should I be using libzypp directly or should I use PackageKit? I'm more comfortable writing in C rather than C++.
Hi Srinidhi, there is no such doc and it would be outdated in a while, as a major rewrite is going on. Basically I would not recommend using libzypp directly, because new features will introduce new rules. You code may easily be outdated/wrong in while or on specific systems. I know, currently zypper provides only XML output for parsing command output like 'list-updates', but I would nevertheless recommend to us this. More flexible command output for parsing query output is planned (similar to rpms --query-format), but we need some time and resources for this. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres (he/him/his), Engineering & Innovation, ma@suse.com +------------------------------------------------------------------+ SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany, (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman +------------------------------------------------------------------+
Navegar por el proceso de búsqueda de empleo a menudo puede parecer un viaje desalentador, lleno de anticipación e incertidumbre. Desde la elaboración meticulosa de currículums gracias a trabajos universitarios por encargo https://sehacentrabajos.com/ hasta la adaptación de cartas de presentación para cada solicitud, el esfuerzo puesto en cada paso es un testimonio de la dedicación de un individuo para encontrar no cualquier trabajo, sino el más adecuado. La creación de redes, ya sea a través de conexiones profesionales, redes sociales o eventos de la industria, surge como una estrategia clave, que abre puertas a oportunidades que tal vez no se encuentren a través de las bolsas de trabajo tradicionales.
participants (4)
-
Ladislav Slezák
-
Michael Andres
-
Page Morrison
-
Srinidhi B