etc:20-lpm-gui
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| etc:20-lpm-gui [2022/05/14 02:26] – wikiadmin | etc:20-lpm-gui [2022/07/28 18:13] (current) – wikiadmin | ||
|---|---|---|---|
| Line 55: | Line 55: | ||
| As archive format, lpk uses gzip compressed cpio, prepended by a header containing the package information. The prepended header looks like this: | As archive format, lpk uses gzip compressed cpio, prepended by a header containing the package information. The prepended header looks like this: | ||
| - | * 11 bytes made from 5 bytes containing the version signature (EPLM20) and 6 bytes containing the zero-padded size of the following header | + | * 11 bytes made from 5 bytes containing the version signature (ELPM20) and 6 bytes containing the zero-padded size of the following header |
| * The package description, | * The package description, | ||
| Line 189: | Line 189: | ||
| </ | </ | ||
| - | The function | + | The function plpm_exec in lpmsh.c provides a working example on how to call plpm in all cases. |
| - | ===== 8. Important data structures ===== | + | ===== 8. Important |
| + | |||
| + | ==== 8.1 LPI ==== | ||
| + | |||
| + | Most relevant structures and functions are defined in the header file lpm.h, the most important structure is: | ||
| + | < | ||
| + | |||
| + | struct s_lpk_info { | ||
| + | char *name; | ||
| + | char *variant; | ||
| + | char *version; | ||
| + | char *creator; | ||
| + | int arch; | ||
| + | char *desc; | ||
| + | char *clog; | ||
| + | char **deps; | ||
| + | int removable; | ||
| + | unsigned long datasize; | ||
| + | /* The next two are only for repository packages */ | ||
| + | unsigned long filesize; | ||
| + | char *filehash; | ||
| + | char *abs_uri; | ||
| + | char *rel_uri; | ||
| + | /* These three are only for locally installed packages */ | ||
| + | time_t install_time; | ||
| + | char install_type; | ||
| + | char *install_head; | ||
| + | time_t *update_time; | ||
| + | /* The next three are for the signature */ | ||
| + | char *rsa_sig_subj; | ||
| + | char *rsa_sig_data_buf; | ||
| + | int rsa_sig_data_len; | ||
| + | int rsa_verified; | ||
| + | /* Now follows a ekva with any further extended attributes */ | ||
| + | struct s_ekva **ext_attributes; | ||
| + | }; | ||
| + | |||
| + | typedef struct s_lpk_info LPI; | ||
| + | |||
| + | </ | ||
| + | |||
| + | LPI is used throughout lpm for any package information, | ||
| + | |||
| + | The meaning of its members are: | ||
| + | |||
| + | |name|the package name| | ||
| + | |variant|the package variant, can be NULL| | ||
| + | |version|the package version| | ||
| + | |creator|name and mail address of the package creator| | ||
| + | |arch|either i686, | ||
| + | |desc|the package description| | ||
| + | |clog|the package' | ||
| + | |deps|an array of names of the package' | ||
| + | |removable|boolean of package is removable, absolutely unused| | ||
| + | |datasize|the sum of bytes in the data part of a package| | ||
| + | |filesize|the filesize of a package in lpc catalogue| | ||
| + | |abs_uri|the absolute uri of a package in lpc catalogue| | ||
| + | |rel_url|the relative uri of a package in lpc catalogue| | ||
| + | |install_time|the installation unix time of an installed package| | ||
| + | |install_type| \\ X for an installed package if explicitely installed, D if installed as a dependency| | ||
| + | |install_head|if installed as a dependency, the name of the package having required it| | ||
| + | |update_time|an array of unix time when the package was updated, can be NULL| | ||
| + | |rsa_sig_data|the buffer and it's size containing the package' | ||
| + | |rsa_sig_subj|the subject dn of the package signer| | ||
| + | |rsa_verified|a flag containing the vefication status| | ||
| + | |ext_attributes|an EKVA of other package attributes, currently unused| | ||
| + | | | | | ||
| + | |||
| + | ==== 8.2 EKVA ==== | ||
| + | |||
| + | EKVA is an array of stuctures containg a pointer to a key and to a value and is defined in stuff/ | ||
| + | < | ||
| + | |||
| + | struct s_ekva { | ||
| + | char *key; | ||
| + | char *val; | ||
| + | }; | ||
| + | |||
| + | typedef struct s_ekva EKVA; | ||
| + | |||
| + | </ | ||
| + | |||
| + | EKVA arrays are used extensively throughout lpm as text-based keyword-value stores, with multiple values for one keyword possible depending on its initialisation. As their first element, they hold a header containing their current size an mode, allowing for automatic growing and management of multiple values. | ||
| + | |||
| + | EKVA arrays are created, filled, read and deleted by a set of functions defined in ekva.h, the most important ones being: | ||
| + | |||
| + | - ekva_new: to create a new EKVA array \\ - ekva_addval: | ||
| + | |||
| + | ==== 8.3 LPA ==== | ||
| + | |||
| + | LPA arrays are used to store information about available updates in an easily parsable form: | ||
| + | |||
| + | < | ||
| + | struct s_lpa { | ||
| + | char action; | ||
| + | char status; | ||
| + | LPI *lpi; | ||
| + | char *candidate; | ||
| + | }; | ||
| + | typedef struct s_lpa LPA; | ||
| + | |||
| + | </ | ||
| + | |||
| + | - action is ' | ||
| + | |||
| + | ===== 9. important frontend functions ===== | ||
| + | |||
| + | All frontend functions are defined int lpm.h, the ones relevant to a frontend using plpm for privileged actions are: | ||
| + | |||
| + | - lpm_open: " | ||
| + | |||
| + | - lpmui_init: initializes the internally used lpmui, necessary, but has no effect… | ||
| + | |||
| + | - lpm_lpc_load: | ||
| + | |||
| + | - lpm_lpc_connect: | ||
| + | |||
| + | - lpm_lpc_cache_fill: | ||
| + | |||
| + | - lpm_lpc_release: | ||
| + | |||
| + | - lpm_cache_free: | ||
| + | |||
| + | - lpk_info_ekva: | ||
| + | |||
| + | - lpm_list_lpi: | ||
| + | |||
| + | - lpm_lpf_info: | ||
| + | |||
| + | - lpm_findpkg_new: | ||
| + | |||
| + | - lconf_read: reads the lpm config file | ||
| + | |||
| + | - log_init: initializes the internal logging mechanism, necessary | ||
| + | |||
| + | - lpm_pre_update: | ||
| + | |||
| + | - lpm_lpa_list_add_lpt: | ||
| + | |||
| + | ===== 10. Required globals ===== | ||
| + | |||
| + | In order for the frontend to be able to use all further funtions correctly, it has to define a set of global variables: | ||
| + | |||
| + | < | ||
| + | void *lpc_backend_handle; | ||
| + | EKVA **lpm_sys_conf = NULL; | ||
| + | LPC *lpc; | ||
| + | |||
| + | int dry_run = 0; | ||
| + | int vote_mode = LPM_VOTE_DEFAULT; | ||
| + | LPMUI *lpmui = NULL; | ||
| + | struct s_llog *llog; | ||
| + | |||
| + | LPI **lpc_cache; | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== 11. Required initialization sequence ===== | ||
| + | |||
| + | Maybe in later releases, the initialisation sequence will be simplyfied and merged into some lpm_init function, but for the moment, the code from line 490 - 542 from lpmsh.c can be copied for that purpose. | ||
etc/20-lpm-gui.1652487963.txt.gz · Last modified: by wikiadmin
