libmp/include/package.h

71 lines
2.2 KiB
C
Raw Permalink Normal View History

#pragma once
#include <stdbool.h>
2024-07-31 18:16:19 +00:00
#include <sys/types.h>
#define PKG_DATA_SIZE "size"
#define PKG_DATA_DESC "desc"
#define PKG_DATA_VERSION "version"
#define PKG_DATA_DEPENDS "depends"
2024-08-15 20:44:20 +00:00
#define PKG_DATA_KEEPS "keep"
2024-08-06 01:44:42 +00:00
#define DATA_FILE "DATA"
#define HASHES_FILE "HASHES"
#define CHANGES_FILE "CHANGES"
#define INSTALL_FILE "INSTALL"
#define FILES_ARCHIVE "files.tar.gz"
2024-07-31 18:16:19 +00:00
typedef struct lm_pkg_data {
char *name;
char *desc;
char **depends;
char **keeps;
char *version;
ssize_t size;
} lm_pkg_data_t;
2024-08-06 01:44:42 +00:00
typedef struct lm_pkg_files {
char *data_file;
char *hashes_file;
char *changes_file;
char *install_file;
char *files_archive;
} lm_pkg_files_t;
2024-07-31 18:16:19 +00:00
typedef struct lm_pkg {
struct lm_pkg_data data;
struct lm_pool *pool;
struct lm_pkg *next;
char *signature;
char *archive;
} lm_pkg_t;
lm_pkg_t *lm_package_new();
void lm_package_free(lm_pkg_t *pkg);
2024-07-02 01:44:07 +00:00
bool lm_package_verify(lm_pkg_t *pkg);
void lm_package_init(lm_pkg_t *pkg);
2024-07-31 18:16:19 +00:00
bool lm_package_downloaded(lm_pkg_t *pkg);
bool lm_package_is_same(lm_pkg_t *one, lm_pkg_t *two);
2024-07-31 18:16:19 +00:00
bool lm_package_data_load(lm_pkg_data_t *data, char *file);
void lm_package_data_free(lm_pkg_data_t *data);
2024-07-31 18:16:19 +00:00
bool lm_package_data_depend_add(lm_pkg_data_t *data, char *depend);
ssize_t lm_package_data_depend_count(lm_pkg_data_t *data);
ssize_t lm_package_data_depend_strlen(lm_pkg_data_t *data);
char *lm_package_data_depend_tostr(lm_pkg_data_t *data, char *buffer);
bool lm_package_data_depend_fromstr(lm_pkg_data_t *data, char *buffer);
void lm_package_data_depend_free(lm_pkg_data_t *data);
bool lm_package_data_depends(lm_pkg_data_t *data, char *dep);
2024-07-02 01:44:07 +00:00
2024-07-31 18:16:19 +00:00
size_t lm_package_data_keep_count(lm_pkg_data_t *data);
bool lm_package_data_keep_add(lm_pkg_data_t *data, char *path);
bool lm_package_data_keep_contains(lm_pkg_data_t *data, char *path);
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);
2024-08-06 01:44:42 +00:00
lm_pkg_files_t *lm_package_extract(lm_pkg_t *pkg, char *target);
void lm_package_extract_free(lm_pkg_files_t *files);