new: support for local package files

This commit is contained in:
ngn
2024-08-06 04:44:42 +03:00
parent 73a1f997e6
commit 1219501aaa
9 changed files with 210 additions and 50 deletions

View File

@ -124,3 +124,9 @@ bool lm_ctx_database_next(lm_ctx_t *ctx, lm_entry_t *entry); // load the n
bool lm_ctx_database_next_free(lm_ctx_t *ctx, lm_entry_t *entry); // free the used next pointers
char *lm_ctx_database_changes(
lm_ctx_t *ctx, lm_entry_t *entry); // get changes file path for a package, FREE THE RETURNED POINTER
/* #######################
## package fucntions ##
####################### */
bool lm_ctx_package_from(lm_ctx_t *ctx, lm_pkg_t *pkg, char *archive);
void lm_ctx_package_from_free(lm_pkg_t *pkg);

View File

@ -144,6 +144,7 @@ typedef enum lm_error {
LM_ERR_PoolListBadDir = 142,
LM_ERR_FileNotExist = 143,
LM_ERR_FileNotLink = 144,
LM_ERR_ArchiveSetFail = 145,
} lm_error_t;
typedef struct lm_error_desc {

View File

@ -8,6 +8,12 @@
#define PKG_DATA_DEPENDS "depends"
#define PKG_DATA_KEEPS "keeps"
#define DATA_FILE "DATA"
#define HASHES_FILE "HASHES"
#define CHANGES_FILE "CHANGES"
#define INSTALL_FILE "INSTALL"
#define FILES_ARCHIVE "files.tar.gz"
typedef struct lm_pkg_data {
char *name;
char *desc;
@ -17,6 +23,14 @@ typedef struct lm_pkg_data {
ssize_t size;
} lm_pkg_data_t;
typedef struct lm_pkg_files {
char *data_file;
char *hashes_file;
char *changes_file;
char *install_file;
char *files_archive;
} lm_pkg_files_t;
typedef struct lm_pkg {
struct lm_pkg_data data;
struct lm_pool *pool;
@ -51,3 +65,6 @@ void lm_package_data_keep_free(lm_pkg_data_t *data);
bool lm_package_path_set_signature(lm_pkg_t *pkg, char *signature_path);
bool lm_package_path_set_archive(lm_pkg_t *pkg, char *archive_path);
bool lm_package_path_is_empty(lm_pkg_t *pkg);
lm_pkg_files_t *lm_package_extract(lm_pkg_t *pkg, char *target);
void lm_package_extract_free(lm_pkg_files_t *files);