User Tools

Site Tools


etc:20-lpm-gui

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
etc:20-lpm-gui [2022/05/14 04:59] wikiadminetc: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, starting at byte 12.   * The package description, starting at byte 12.
  
Line 191: Line 191:
 The function plpm_exec in lpmsh.c provides a working example on how to call plpm in all cases. 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 frontend data structures =====
  
 ==== 8.1 LPI ==== ==== 8.1 LPI ====
Line 278: Line 278:
  
 - ekva_new: to create a new EKVA array \\ - ekva_addval: to add a key/val pair to the EKVA arrray \\ - ekva_getval: to read the first value for a key \\ - ekva_cntval: to count the number of vaules for a key \\ - ekva_getone: to read the specified value for a key \\ - ekva_getvals: to read all values for a key - ekva_new: to create a new EKVA array \\ - ekva_addval: to add a key/val pair to the EKVA arrray \\ - ekva_getval: to read the first value for a key \\ - ekva_cntval: to count the number of vaules for a key \\ - ekva_getone: to read the specified value for a key \\ - ekva_getvals: to read all values for a key
 +
 +==== 8.3 LPA ====
 +
 +LPA arrays are used to store information about available updates in an easily parsable form:
 +
 +<code>
 +struct s_lpa {
 +    char action;
 +    char status;
 +    LPI *lpi;
 +    char *candidate;
 +};
 +typedef struct s_lpa LPA;
 +
 +</code>
 +
 +- action is 'U' or 'I', as an update might pull a new dependency \\ - status is always 'N' \\ - lpi contains the package info of the package to be installed or updated
 +
 +===== 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: "opens" the local lpm repository and return an LPM * structure for further use.
 +
 +- lpmui_init: initializes the internally used lpmui, necessary, but has no effect…
 +
 +- lpm_lpc_load: loads the configured package catalogue
 +
 +- lpm_lpc_connect: connects the program to the package catalogie
 +
 +- lpm_lpc_cache_fill: fills the package catalogue cache
 +
 +- lpm_lpc_release: disconnects from the package catalogue
 +
 +- lpm_cache_free: frees the cache
 +
 +- lpk_info_ekva: converts an LPI * package description to a string-based EKVA * keyword/value list
 +
 +- lpm_list_lpi: returns a list of locally installed package descriptions
 +
 +- lpm_lpf_info: returns a package description from a package file
 +
 +- lpm_findpkg_new: returns a list of available, not installed packages
 +
 +- lconf_read: reads the lpm config file
 +
 +- log_init: initializes the internal logging mechanism, necessary
 +
 +- lpm_pre_update: checks for an available update of a specified package
 +
 +- lpm_lpa_list_add_lpt: adds the results of lpm_pre_update to an easily readable LPA * list
 +
 +===== 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:
 +
 +<code>
 +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;
 +
 +</code>
 +
 +===== 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.1652497153.txt.gz · Last modified: by wikiadmin