X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libopkg%2Fpkg.h;h=600fc9eaa25ca362d67c0ac108686b624de9f953;hb=468158f01ea0cb891f586936217f1a765fd207b7;hp=eeb75e6f2641316e2e65db7972a179d8935e622f;hpb=54cc7e3bd1f79569022aa9fc3d0e748c81e3bcd8;p=oweals%2Fopkg-lede.git diff --git a/libopkg/pkg.h b/libopkg/pkg.h index eeb75e6..600fc9e 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -18,8 +18,6 @@ #ifndef PKG_H #define PKG_H -#include "config.h" - #include #include @@ -60,6 +58,7 @@ enum pkg_state_flag { SF_MARKED = 64, /* temporary mark */ SF_FILELIST_CHANGED = 128, /* needs filelist written */ SF_USER = 256, + SF_NEED_DETAIL = 512, SF_LAST_STATE_FLAG }; typedef enum pkg_state_flag pkg_state_flag_t; @@ -101,6 +100,7 @@ enum pkg_fields { PKG_DEPENDS, PKG_CONFLICTS, PKG_CONFFILES, + PKG_ALTERNATIVES, }; struct abstract_pkg { @@ -119,6 +119,24 @@ struct abstract_pkg { #include "pkg_depends.h" +enum pkg_alternative_field { + PAF_PRIO, + PAF_PATH, + PAF_ALTPATH, + __PAF_MAX, +}; + +struct pkg_alternative { + int prio; + char *path; + char *altpath; +}; + +struct pkg_alternatives { + int nalts; + struct pkg_alternative **alts; +}; + /* XXX: CLEANUP: I'd like to clean up pkg_t in several ways: The 3 version fields should go into a single version struct. (This @@ -144,7 +162,7 @@ struct pkg { pkg_src_t *src; pkg_dest_t *dest; pkg_state_want_t state_want:3; - pkg_state_flag_t state_flag:10; + pkg_state_flag_t state_flag:11; pkg_state_status_t state_status:4; abstract_pkg_t *parent; @@ -157,16 +175,16 @@ struct pkg { still being used within an outer loop. */ int installed_files_ref_cnt; - int essential:1; + unsigned int essential:1; /* Adding this flag, to "force" opkg to choose a "provided_by_hand" package, if there are multiple choice */ - int provided_by_hand:1; + unsigned int provided_by_hand:1; /* this flag specifies whether the package was installed to satisfy another * package's dependancies */ - int auto_installed:1; - int is_upgrade:1; + unsigned int auto_installed:1; + unsigned int is_upgrade:1; - int arch_index:3; + unsigned int arch_index:3; struct blob_buf blob; }; @@ -180,12 +198,14 @@ void *pkg_get_raw(const pkg_t *pkg, int id); static inline int pkg_set_int(pkg_t *pkg, int id, int val) { - return (intptr_t) pkg_set_raw(pkg, id, &val, sizeof(val)); + int *res = pkg_set_raw(pkg, id, &val, sizeof(val)); + return res ? *res : 0; } static inline int pkg_get_int(const pkg_t *pkg, int id) { - return (intptr_t) pkg_get_raw(pkg, id); + int *ptr = pkg_get_raw(pkg, id); + return ptr ? *ptr : 0; } char *pkg_set_string(pkg_t *pkg, int id, const char *s); @@ -197,7 +217,8 @@ static inline char *pkg_get_string(const pkg_t *pkg, int id) static inline void * pkg_set_ptr(pkg_t *pkg, int id, void *ptr) { - return ptr ? *(void **) pkg_set_raw(pkg, id, &ptr, sizeof(ptr)) : NULL; + void **res = pkg_set_raw(pkg, id, &ptr, sizeof(ptr)); + return res ? *res : NULL; } static inline void * pkg_get_ptr(const pkg_t *pkg, int id) @@ -233,8 +254,6 @@ int abstract_pkg_name_compare(const void *a, const void *b); void pkg_formatted_info(FILE * fp, pkg_t * pkg); void pkg_formatted_field(FILE * fp, pkg_t * pkg, const char *field); -void set_flags_from_control(pkg_t * pkg); - void pkg_print_status(pkg_t * pkg, FILE * file); str_list_t *pkg_get_installed_files(pkg_t * pkg); void pkg_free_installed_files(pkg_t * pkg);