85 lines
1.7 KiB
C
85 lines
1.7 KiB
C
#ifndef PKG_H_
|
|
#define PKG_H_
|
|
|
|
#define _POSIX_C_SOURCE 200809L
|
|
#define _XOPEN_SOURCE 700
|
|
|
|
#include <libconfig.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <sys/stat.h>
|
|
|
|
#include "common.h"
|
|
|
|
typedef struct {
|
|
int maj;
|
|
int min;
|
|
int pat;
|
|
char *tag;
|
|
}
|
|
semver_t;
|
|
|
|
typedef struct {
|
|
char *dep_name;
|
|
semver_t dep_ver;
|
|
}
|
|
dep_t;
|
|
|
|
typedef struct {
|
|
char *conf_name;
|
|
semver_t conf_ver;
|
|
}
|
|
conf_t;
|
|
|
|
typedef struct {
|
|
char *pkg_name;
|
|
semver_t pkg_ver;
|
|
char *pkg_desc;
|
|
char *pkg_maint;
|
|
char *pkg_copyright;
|
|
dep_t *pkg_dependencies;
|
|
conf_t *pkg_conflicts;
|
|
}
|
|
gl_pkg_t;
|
|
|
|
extern const dir_t gl_root;
|
|
|
|
extern const dir_t gl_usr;
|
|
extern const dir_t gl_usr_index;
|
|
extern const dir_t gl_usr_store;
|
|
|
|
extern const dir_t gl_sys;
|
|
extern const dir_t gl_sys_index;
|
|
extern const dir_t gl_sys_store;
|
|
|
|
extern dep_t null_dep;
|
|
extern conf_t null_conf;
|
|
extern gl_pkg_t empty;
|
|
|
|
semver_t gl_pkgver(int major, int minor, int patch);
|
|
semver_t gl_parse_semver(const char *str);
|
|
void gl_free_semver(semver_t *v);
|
|
|
|
gl_pkg_t *gl_spawn_pkg(
|
|
char *name, semver_t *ver, char *desc,
|
|
char *maint, char *copy, dep_t *dep,
|
|
conf_t conf
|
|
);
|
|
|
|
void gl_show_pkg_props(const gl_pkg_t *pkg);
|
|
void gl_free_pkg(gl_pkg_t *pkg);
|
|
|
|
int gl_mkdir(dir_t *dir);
|
|
char *gl_cat_dir(const dir_t *a, const dir_t *b);
|
|
char *gl_cat_dir_and_ver(const dir_t *base, const gl_pkg_t *pkg);
|
|
dir_t gl_return_dir(const dir_t *a, const dir_t *b, mode_t mode);
|
|
dir_t gl_return_dir_and_ver(const dir_t *base, gl_pkg_t *pkg, mode_t mode);
|
|
void gl_free_path(char *path);
|
|
void gl_free_dir(dir_t *dir);
|
|
|
|
int gl_gpm2gpkg(const char *filename, gl_pkg_t *pkg);
|
|
int gl_prepare_pkgdir(gl_pkg_t *pkg, bool is_syspkg);
|
|
char *join_with_cwd(const char *path);
|
|
|
|
#endif
|