71 lines
2.2 KiB
C
71 lines
2.2 KiB
C
#pragma once
|
|
#include <stdbool.h>
|
|
#include <sys/types.h>
|
|
|
|
#define PKG_DATA_SIZE "size"
|
|
#define PKG_DATA_DESC "desc"
|
|
#define PKG_DATA_VERSION "version"
|
|
#define PKG_DATA_DEPENDS "depends"
|
|
#define PKG_DATA_KEEPS "keep"
|
|
|
|
#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;
|
|
char **depends;
|
|
char **keeps;
|
|
char *version;
|
|
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;
|
|
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);
|
|
bool lm_package_verify(lm_pkg_t *pkg);
|
|
void lm_package_init(lm_pkg_t *pkg);
|
|
bool lm_package_downloaded(lm_pkg_t *pkg);
|
|
bool lm_package_is_same(lm_pkg_t *one, lm_pkg_t *two);
|
|
|
|
bool lm_package_data_load(lm_pkg_data_t *data, char *file);
|
|
void lm_package_data_free(lm_pkg_data_t *data);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
lm_pkg_files_t *lm_package_extract(lm_pkg_t *pkg, char *target);
|
|
void lm_package_extract_free(lm_pkg_files_t *files);
|