diff options
Diffstat (limited to 'lib/libalpm/package.h')
-rw-r--r-- | lib/libalpm/package.h | 104 |
1 files changed, 60 insertions, 44 deletions
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index b161d5f1..d19d8332 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -24,17 +24,21 @@ #ifndef _ALPM_PACKAGE_H #define _ALPM_PACKAGE_H +#include "config.h" /* ensure off_t is correct length */ + #include <sys/types.h> /* off_t */ #include <time.h> /* time_t */ #include "alpm.h" +#include "backup.h" #include "db.h" +#include "signing.h" -typedef enum _pmpkgfrom_t { +typedef enum _alpm_pkgfrom_t { PKG_FROM_FILE = 1, PKG_FROM_LOCALDB, PKG_FROM_SYNCDB -} pmpkgfrom_t; +} alpm_pkgfrom_t; /** Package operations struct. This struct contains function pointers to * all methods used to access data in a package to allow for things such @@ -44,35 +48,35 @@ typedef enum _pmpkgfrom_t { * defined default_pkg_ops struct to work just fine for their needs. */ struct pkg_operations { - const char *(*get_filename) (pmpkg_t *); - const char *(*get_name) (pmpkg_t *); - const char *(*get_version) (pmpkg_t *); - const char *(*get_desc) (pmpkg_t *); - const char *(*get_url) (pmpkg_t *); - time_t (*get_builddate) (pmpkg_t *); - time_t (*get_installdate) (pmpkg_t *); - const char *(*get_packager) (pmpkg_t *); - const char *(*get_md5sum) (pmpkg_t *); - const char *(*get_arch) (pmpkg_t *); - off_t (*get_size) (pmpkg_t *); - off_t (*get_isize) (pmpkg_t *); - pmpkgreason_t (*get_reason) (pmpkg_t *); - int (*has_scriptlet) (pmpkg_t *); - - alpm_list_t *(*get_licenses) (pmpkg_t *); - alpm_list_t *(*get_groups) (pmpkg_t *); - alpm_list_t *(*get_depends) (pmpkg_t *); - alpm_list_t *(*get_optdepends) (pmpkg_t *); - alpm_list_t *(*get_conflicts) (pmpkg_t *); - alpm_list_t *(*get_provides) (pmpkg_t *); - alpm_list_t *(*get_replaces) (pmpkg_t *); - alpm_list_t *(*get_deltas) (pmpkg_t *); - alpm_list_t *(*get_files) (pmpkg_t *); - alpm_list_t *(*get_backup) (pmpkg_t *); - - void *(*changelog_open) (pmpkg_t *); - size_t (*changelog_read) (void *, size_t, const pmpkg_t *, const void *); - int (*changelog_close) (const pmpkg_t *, void *); + const char *(*get_filename) (alpm_pkg_t *); + const char *(*get_desc) (alpm_pkg_t *); + const char *(*get_url) (alpm_pkg_t *); + time_t (*get_builddate) (alpm_pkg_t *); + time_t (*get_installdate) (alpm_pkg_t *); + const char *(*get_packager) (alpm_pkg_t *); + const char *(*get_md5sum) (alpm_pkg_t *); + const char *(*get_arch) (alpm_pkg_t *); + off_t (*get_size) (alpm_pkg_t *); + off_t (*get_isize) (alpm_pkg_t *); + alpm_pkgreason_t (*get_reason) (alpm_pkg_t *); + int (*has_scriptlet) (alpm_pkg_t *); + + alpm_list_t *(*get_licenses) (alpm_pkg_t *); + alpm_list_t *(*get_groups) (alpm_pkg_t *); + alpm_list_t *(*get_depends) (alpm_pkg_t *); + alpm_list_t *(*get_optdepends) (alpm_pkg_t *); + alpm_list_t *(*get_conflicts) (alpm_pkg_t *); + alpm_list_t *(*get_provides) (alpm_pkg_t *); + alpm_list_t *(*get_replaces) (alpm_pkg_t *); + alpm_list_t *(*get_deltas) (alpm_pkg_t *); + alpm_filelist_t *(*get_files) (alpm_pkg_t *); + alpm_list_t *(*get_backup) (alpm_pkg_t *); + + void *(*changelog_open) (alpm_pkg_t *); + size_t (*changelog_read) (void *, size_t, const alpm_pkg_t *, const void *); + int (*changelog_close) (const alpm_pkg_t *, void *); + + int (*force_load) (alpm_pkg_t *); /* still to add: * checkmd5sum() ? @@ -87,7 +91,7 @@ struct pkg_operations { */ extern struct pkg_operations default_pkg_ops; -struct __pmpkg_t { +struct __alpm_pkg_t { unsigned long name_hash; char *filename; char *name; @@ -96,6 +100,7 @@ struct __pmpkg_t { char *url; char *packager; char *md5sum; + char *base64_sig; char *arch; time_t builddate; @@ -107,20 +112,20 @@ struct __pmpkg_t { int scriptlet; - pmpkgreason_t reason; - pmpkgfrom_t origin; + alpm_pkgreason_t reason; + alpm_dbinfrq_t infolevel; + alpm_pkgfrom_t origin; /* origin == PKG_FROM_FILE, use pkg->origin_data.file * origin == PKG_FROM_*DB, use pkg->origin_data.db */ union { - pmdb_t *db; + alpm_db_t *db; char *file; } origin_data; - pmdbinfrq_t infolevel; + alpm_handle_t *handle; alpm_list_t *licenses; alpm_list_t *replaces; alpm_list_t *groups; - alpm_list_t *files; alpm_list_t *backup; alpm_list_t *depends; alpm_list_t *optdepends; @@ -131,16 +136,27 @@ struct __pmpkg_t { alpm_list_t *removes; /* in transaction targets only */ struct pkg_operations *ops; + + alpm_filelist_t files; }; -pmpkg_t* _alpm_pkg_new(void); -pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg); -void _alpm_pkg_free(pmpkg_t *pkg); -void _alpm_pkg_free_trans(pmpkg_t *pkg); +alpm_file_t *_alpm_file_copy(alpm_file_t *dest, const alpm_file_t *src); +int _alpm_files_cmp(const void *f1, const void *f2); + +alpm_pkg_t* _alpm_pkg_new(void); +alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg); +void _alpm_pkg_free(alpm_pkg_t *pkg); +void _alpm_pkg_free_trans(alpm_pkg_t *pkg); + + +alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, + int full, const char *md5sum, const char *base64_sig, + alpm_siglevel_t level); + int _alpm_pkg_cmp(const void *p1, const void *p2); -int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg); -pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle); -int _alpm_pkg_should_ignore(pmpkg_t *pkg); +int _alpm_pkg_compare_versions(alpm_pkg_t *local_pkg, alpm_pkg_t *pkg); +alpm_pkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle); +int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg); #endif /* _ALPM_PACKAGE_H */ |