diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/alpm.c | 2 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 33 | ||||
-rw-r--r-- | lib/libalpm/be_local.c | 8 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 8 | ||||
-rw-r--r-- | lib/libalpm/be_sync.c | 26 | ||||
-rw-r--r-- | lib/libalpm/db.c | 10 | ||||
-rw-r--r-- | lib/libalpm/db.h | 16 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 12 | ||||
-rw-r--r-- | lib/libalpm/handle.h | 6 | ||||
-rw-r--r-- | lib/libalpm/package.c | 4 | ||||
-rw-r--r-- | lib/libalpm/package.h | 13 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 16 | ||||
-rw-r--r-- | lib/libalpm/trans.c | 4 | ||||
-rw-r--r-- | lib/libalpm/trans.h | 6 | ||||
-rw-r--r-- | lib/libalpm/util.h | 2 |
15 files changed, 89 insertions, 77 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 6b7fa7a9..5225e4f8 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -152,7 +152,7 @@ const char SYMEXPORT *alpm_version(void) /** Get the capabilities of the library. * @return a bitmask of the capabilities * */ -enum alpm_caps SYMEXPORT alpm_capabilities(void) +int SYMEXPORT alpm_capabilities(void) { return 0 #ifdef ENABLE_NLS diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 0f8274bb..2d2491d8 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -917,14 +917,14 @@ int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace); const char *alpm_option_get_dbext(alpm_handle_t *handle); int alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext); -alpm_siglevel_t alpm_option_get_default_siglevel(alpm_handle_t *handle); -int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); +int alpm_option_get_default_siglevel(alpm_handle_t *handle); +int alpm_option_set_default_siglevel(alpm_handle_t *handle, int level); -alpm_siglevel_t alpm_option_get_local_file_siglevel(alpm_handle_t *handle); -int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); +int alpm_option_get_local_file_siglevel(alpm_handle_t *handle); +int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level); -alpm_siglevel_t alpm_option_get_remote_file_siglevel(alpm_handle_t *handle); -int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level); +int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle); +int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level); /** @} */ @@ -957,7 +957,7 @@ alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle); * @return an alpm_db_t* on success (the value), NULL on error */ alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename, - alpm_siglevel_t level); + int level); /** Unregister all package databases. * @param handle the context handle @@ -983,7 +983,7 @@ const char *alpm_db_get_name(const alpm_db_t *db); * @param db pointer to the package database * @return the signature verification level */ -alpm_siglevel_t alpm_db_get_siglevel(alpm_db_t *db); +int alpm_db_get_siglevel(alpm_db_t *db); /** Check the validity of a database. * This is most useful for sync databases and verifying signature status. @@ -1050,14 +1050,14 @@ typedef enum _alpm_db_usage_ { * @param usage a bitmask of alpm_db_usage_t values * @return 0 on success, or -1 on error */ -int alpm_db_set_usage(alpm_db_t *db, alpm_db_usage_t usage); +int alpm_db_set_usage(alpm_db_t *db, int usage); /** Gets the usage of a database. * @param db pointer to the package database to get the status of * @param usage pointer to an alpm_db_usage_t to store db's status * @return 0 on success, or -1 on error */ -int alpm_db_get_usage(alpm_db_t *db, alpm_db_usage_t *usage); +int alpm_db_get_usage(alpm_db_t *db, int *usage); /** @} */ @@ -1081,7 +1081,7 @@ int alpm_db_get_usage(alpm_db_t *db, alpm_db_usage_t *usage); * @return 0 on success, -1 on error (pm_errno is set accordingly) */ int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full, - alpm_siglevel_t level, alpm_pkg_t **pkg); + int level, alpm_pkg_t **pkg); /** Find a package in a list by name. * @param haystack a list of alpm_pkg_t @@ -1318,7 +1318,7 @@ const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg); * @param pkg a pointer to package * @return an enum member giving the validation method */ -alpm_pkgvalidation_t alpm_pkg_get_validation(alpm_pkg_t *pkg); +int alpm_pkg_get_validation(alpm_pkg_t *pkg); /* End of alpm_pkg_t accessors */ /* @} */ @@ -1480,7 +1480,7 @@ typedef enum _alpm_transflag_t { * @param handle the context handle * @return the bitfield of transaction flags */ -alpm_transflag_t alpm_trans_get_flags(alpm_handle_t *handle); +int alpm_trans_get_flags(alpm_handle_t *handle); /** Returns a list of packages added by the transaction. * @param handle the context handle @@ -1496,10 +1496,10 @@ alpm_list_t *alpm_trans_get_remove(alpm_handle_t *handle); /** Initialize the transaction. * @param handle the context handle - * @param flags flags of the transaction (like nodeps, etc) + * @param flags flags of the transaction (like nodeps, etc; see alpm_transflag_t) * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags); +int alpm_trans_init(alpm_handle_t *handle, int flags); /** Prepare a transaction. * @param handle the context handle @@ -1613,7 +1613,8 @@ enum alpm_caps { }; const char *alpm_version(void); -enum alpm_caps alpm_capabilities(void); +/* Return a bitfield of capabilities using values from 'enum alpm_caps' */ +int alpm_capabilities(void); void alpm_fileconflict_free(alpm_fileconflict_t *conflict); void alpm_depmissing_free(alpm_depmissing_t *miss); diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 43c6bc93..123ed6bf 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -47,7 +47,7 @@ /* local database format version */ size_t ALPM_LOCAL_DB_VERSION = 9; -static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq); +static int local_db_read(alpm_pkg_t *info, int inforeq); #define LAZY_LOAD(info, errret) \ do { \ @@ -117,7 +117,7 @@ static alpm_pkgreason_t _cache_get_reason(alpm_pkg_t *pkg) return pkg->reason; } -static alpm_pkgvalidation_t _cache_get_validation(alpm_pkg_t *pkg) +static int _cache_get_validation(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->validation; @@ -660,7 +660,7 @@ char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info, f = alpm_list_add(f, alpm_dep_from_string(line)); \ } while(1) /* note the while(1) and not (0) */ -static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq) +static int local_db_read(alpm_pkg_t *info, int inforeq) { FILE *fp = NULL; char line[1024]; @@ -910,7 +910,7 @@ static void write_deps(FILE *fp, const char *header, alpm_list_t *deplist) fputc('\n', fp); } -int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq) +int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq) { FILE *fp = NULL; mode_t oldmask; diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index befcba31..b7c54fa1 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -270,8 +270,8 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t * * @return 0 if package is fully valid, -1 and pm_errno otherwise */ int _alpm_pkg_validate_internal(alpm_handle_t *handle, - const char *pkgfile, alpm_pkg_t *syncpkg, alpm_siglevel_t level, - alpm_siglist_t **sigdata, alpm_pkgvalidation_t *validation) + const char *pkgfile, alpm_pkg_t *syncpkg, int level, + alpm_siglist_t **sigdata, int *validation) { int has_sig; handle->pm_errno = ALPM_ERR_OK; @@ -726,9 +726,9 @@ static int read_sigfile(const char *sigpath, unsigned char **sig) } int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full, - alpm_siglevel_t level, alpm_pkg_t **pkg) + int level, alpm_pkg_t **pkg) { - alpm_pkgvalidation_t validation = 0; + int validation = 0; char *sigpath; CHECK_HANDLE(handle, return -1); diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 856aa420..7774975e 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -71,7 +71,7 @@ static char *get_sync_dir(alpm_handle_t *handle) static int sync_db_validate(alpm_db_t *db) { - alpm_siglevel_t level; + int siglevel; const char *dbpath; if(db->status & DB_STATUS_VALID || db->status & DB_STATUS_MISSING) { @@ -104,20 +104,20 @@ static int sync_db_validate(alpm_db_t *db) /* this takes into account the default verification level if UNKNOWN * was assigned to this db */ - level = alpm_db_get_siglevel(db); + siglevel = alpm_db_get_siglevel(db); - if(level & ALPM_SIG_DATABASE) { + if(siglevel & ALPM_SIG_DATABASE) { int retry, ret; do { retry = 0; alpm_siglist_t *siglist; ret = _alpm_check_pgp_helper(db->handle, dbpath, NULL, - level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK, - level & ALPM_SIG_DATABASE_UNKNOWN_OK, &siglist); + siglevel & ALPM_SIG_DATABASE_OPTIONAL, siglevel & ALPM_SIG_DATABASE_MARGINAL_OK, + siglevel & ALPM_SIG_DATABASE_UNKNOWN_OK, &siglist); if(ret) { retry = _alpm_process_siglist(db->handle, db->treename, siglist, - level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK, - level & ALPM_SIG_DATABASE_UNKNOWN_OK); + siglevel & ALPM_SIG_DATABASE_OPTIONAL, siglevel & ALPM_SIG_DATABASE_MARGINAL_OK, + siglevel & ALPM_SIG_DATABASE_UNKNOWN_OK); } alpm_siglist_cleanup(siglist); free(siglist); @@ -181,7 +181,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) int ret = -1; mode_t oldmask; alpm_handle_t *handle; - alpm_siglevel_t level; + int siglevel; /* Sanity checks */ ASSERT(db != NULL, return -1); @@ -207,7 +207,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) /* make sure we have a sane umask */ oldmask = umask(0022); - level = alpm_db_get_siglevel(db); + siglevel = alpm_db_get_siglevel(db); /* attempt to grab a lock */ if(_alpm_handle_lock(handle)) { @@ -247,7 +247,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) _alpm_dload_payload_reset(&payload); updated = (updated || ret == 0); - if(ret != -1 && updated && (level & ALPM_SIG_DATABASE)) { + if(ret != -1 && updated && (siglevel & ALPM_SIG_DATABASE)) { /* an existing sig file is no good at this point */ char *sigpath = _alpm_sigpath(handle, _alpm_db_path(db)); if(!sigpath) { @@ -292,7 +292,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) payload.handle = handle; payload.force = 1; - payload.errors_ok = (level & ALPM_SIG_DATABASE_OPTIONAL); + payload.errors_ok = (siglevel & ALPM_SIG_DATABASE_OPTIONAL); /* set hard upper limit of 16KiB */ payload.max_size = 16 * 1024; @@ -343,7 +343,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) static int sync_db_read(alpm_db_t *db, struct archive *archive, struct archive_entry *entry, alpm_pkg_t **likely_pkg); -static alpm_pkgvalidation_t _sync_get_validation(alpm_pkg_t *pkg) +static int _sync_get_validation(alpm_pkg_t *pkg) { if(pkg->validation) { return pkg->validation; @@ -769,7 +769,7 @@ struct db_operations sync_db_ops = { }; alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename, - alpm_siglevel_t level) + int level) { alpm_db_t *db; diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 46d2ccf3..5d78ee52 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -44,7 +44,7 @@ /** Register a sync database of packages. */ alpm_db_t SYMEXPORT *alpm_register_syncdb(alpm_handle_t *handle, - const char *treename, alpm_siglevel_t level) + const char *treename, int siglevel) { alpm_list_t *i; @@ -67,7 +67,7 @@ alpm_db_t SYMEXPORT *alpm_register_syncdb(alpm_handle_t *handle, } } - return _alpm_db_register_sync(handle, treename, level); + return _alpm_db_register_sync(handle, treename, siglevel); } /* Helper function for alpm_db_unregister{_all} */ @@ -235,7 +235,7 @@ const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db) } /** Get the signature verification level for a database. */ -alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db) +int SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db) { ASSERT(db != NULL, return -1); if(db->siglevel & ALPM_SIG_USE_DEFAULT) { @@ -307,7 +307,7 @@ alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles) } /** Sets the usage bitmask for a repo */ -int SYMEXPORT alpm_db_set_usage(alpm_db_t *db, alpm_db_usage_t usage) +int SYMEXPORT alpm_db_set_usage(alpm_db_t *db, int usage) { ASSERT(db != NULL, return -1); db->usage = usage; @@ -315,7 +315,7 @@ int SYMEXPORT alpm_db_set_usage(alpm_db_t *db, alpm_db_usage_t usage) } /** Gets the usage bitmask for a repo */ -int SYMEXPORT alpm_db_get_usage(alpm_db_t *db, alpm_db_usage_t *usage) +int SYMEXPORT alpm_db_get_usage(alpm_db_t *db, int *usage) { ASSERT(db != NULL, return -1); ASSERT(usage != NULL, return -1); diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index e6962985..8e50196f 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -71,10 +71,14 @@ struct __alpm_db_t { alpm_list_t *grpcache; alpm_list_t *servers; struct db_operations *ops; - /* flags determining validity, local, loaded caches, etc. */ - enum _alpm_dbstatus_t status; - alpm_siglevel_t siglevel; - alpm_db_usage_t usage; + + /* bitfields for validity, local, loaded caches, etc. */ + /* From _alpm_dbstatus_t */ + int status; + /* alpm_siglevel_t */ + int siglevel; + /* alpm_db_usage_t */ + int usage; }; @@ -86,12 +90,12 @@ int _alpm_db_cmp(const void *d1, const void *d2); alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles); alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle); alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename, - alpm_siglevel_t level); + int level); void _alpm_db_unregister(alpm_db_t *db); /* be_*.c, backend specific calls */ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info); -int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq); +int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq); int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info); char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info, const char *filename); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index e9439a0b..28e81481 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -777,7 +777,7 @@ int SYMEXPORT alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext) } int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle, - alpm_siglevel_t level) + int level) { CHECK_HANDLE(handle, return -1); #ifdef HAVE_LIBGPGME @@ -790,14 +790,14 @@ int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle, return 0; } -alpm_siglevel_t SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle) +int SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle) { CHECK_HANDLE(handle, return -1); return handle->siglevel; } int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle, - alpm_siglevel_t level) + int level) { CHECK_HANDLE(handle, return -1); #ifdef HAVE_LIBGPGME @@ -810,7 +810,7 @@ int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle, return 0; } -alpm_siglevel_t SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *handle) +int SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *handle) { CHECK_HANDLE(handle, return -1); if(handle->localfilesiglevel & ALPM_SIG_USE_DEFAULT) { @@ -821,7 +821,7 @@ alpm_siglevel_t SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *han } int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, - alpm_siglevel_t level) + int level) { CHECK_HANDLE(handle, return -1); #ifdef HAVE_LIBGPGME @@ -834,7 +834,7 @@ int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, return 0; } -alpm_siglevel_t SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle) +int SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle) { CHECK_HANDLE(handle, return -1); if(handle->remotefilesiglevel & ALPM_SIG_USE_DEFAULT) { diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index ecbe8370..652f17d2 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -97,10 +97,10 @@ struct __alpm_handle_t { int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ int checkspace; /* Check disk space before installing */ char *dbext; /* Sync DB extension */ - alpm_siglevel_t siglevel; /* Default signature verification level */ - alpm_siglevel_t localfilesiglevel; /* Signature verification level for local file + int siglevel; /* Default signature verification level */ + int localfilesiglevel; /* Signature verification level for local file upgrade operations */ - alpm_siglevel_t remotefilesiglevel; /* Signature verification level for remote file + int remotefilesiglevel; /* Signature verification level for remote file upgrade operations */ /* error code */ diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index a666bf05..05becf01 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -92,7 +92,7 @@ static const char *_pkg_get_packager(alpm_pkg_t *pkg) { return pkg->packager; static const char *_pkg_get_arch(alpm_pkg_t *pkg) { return pkg->arch; } static off_t _pkg_get_isize(alpm_pkg_t *pkg) { return pkg->isize; } static alpm_pkgreason_t _pkg_get_reason(alpm_pkg_t *pkg) { return pkg->reason; } -static alpm_pkgvalidation_t _pkg_get_validation(alpm_pkg_t *pkg) { return pkg->validation; } +static int _pkg_get_validation(alpm_pkg_t *pkg) { return pkg->validation; } static int _pkg_has_scriptlet(alpm_pkg_t *pkg) { return pkg->scriptlet; } static alpm_list_t *_pkg_get_licenses(alpm_pkg_t *pkg) { return pkg->licenses; } @@ -300,7 +300,7 @@ alpm_pkgreason_t SYMEXPORT alpm_pkg_get_reason(alpm_pkg_t *pkg) return pkg->ops->get_reason(pkg); } -alpm_pkgvalidation_t SYMEXPORT alpm_pkg_get_validation(alpm_pkg_t *pkg) +int SYMEXPORT alpm_pkg_get_validation(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = ALPM_ERR_OK; diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index 114d2250..0822a8d0 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -52,7 +52,7 @@ struct pkg_operations { const char *(*get_arch) (alpm_pkg_t *); off_t (*get_isize) (alpm_pkg_t *); alpm_pkgreason_t (*get_reason) (alpm_pkg_t *); - alpm_pkgvalidation_t (*get_validation) (alpm_pkg_t *); + int (*get_validation) (alpm_pkg_t *); int (*has_scriptlet) (alpm_pkg_t *); alpm_list_t *(*get_licenses) (alpm_pkg_t *); @@ -130,11 +130,14 @@ struct __alpm_pkg_t { char *file; } origin_data; - alpm_dbinfrq_t infolevel; - alpm_pkgvalidation_t validation; alpm_pkgfrom_t origin; alpm_pkgreason_t reason; int scriptlet; + + /* Bitfield from alpm_dbinfrq_t */ + int infolevel; + /* Bitfield from alpm_pkgvalidation_t */ + int validation; }; alpm_file_t *_alpm_file_copy(alpm_file_t *dest, const alpm_file_t *src); @@ -145,8 +148,8 @@ void _alpm_pkg_free(alpm_pkg_t *pkg); void _alpm_pkg_free_trans(alpm_pkg_t *pkg); int _alpm_pkg_validate_internal(alpm_handle_t *handle, - const char *pkgfile, alpm_pkg_t *syncpkg, alpm_siglevel_t level, - alpm_siglist_t **sigdata, alpm_pkgvalidation_t *validation); + const char *pkgfile, alpm_pkg_t *syncpkg, int level, + alpm_siglist_t **sigdata, int *validation); alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, int full); diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 65c1bbc6..837639d4 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -1056,7 +1056,7 @@ static int check_keyring(alpm_handle_t *handle) for(i = handle->trans->add; i; i = i->next, current++) { alpm_pkg_t *pkg = i->data; - alpm_siglevel_t level; + int level; int percent = (current * 100) / numtargs; PROGRESS(handle, ALPM_PROGRESS_KEYRING_START, "", percent, @@ -1126,8 +1126,8 @@ static int check_validity(alpm_handle_t *handle, alpm_pkg_t *pkg; char *path; alpm_siglist_t *siglist; - alpm_siglevel_t level; - alpm_pkgvalidation_t validation; + int siglevel; + int validation; alpm_errno_t error; }; size_t current = 0; @@ -1151,10 +1151,10 @@ static int check_validity(alpm_handle_t *handle, current_bytes += v.pkg->size; v.path = _alpm_filecache_find(handle, v.pkg->filename); - v.level = alpm_db_get_siglevel(alpm_pkg_get_db(v.pkg)); + v.siglevel = alpm_db_get_siglevel(alpm_pkg_get_db(v.pkg)); if(_alpm_pkg_validate_internal(handle, v.path, v.pkg, - v.level, &v.siglist, &v.validation) == -1) { + v.siglevel, &v.siglist, &v.validation) == -1) { struct validity *invalid; v.error = handle->pm_errno; MALLOC(invalid, sizeof(struct validity), return -1); @@ -1181,9 +1181,9 @@ static int check_validity(alpm_handle_t *handle, _("%s: missing required signature\n"), v->pkg->name); } else if(v->error == ALPM_ERR_PKG_INVALID_SIG) { _alpm_process_siglist(handle, v->pkg->name, v->siglist, - v->level & ALPM_SIG_PACKAGE_OPTIONAL, - v->level & ALPM_SIG_PACKAGE_MARGINAL_OK, - v->level & ALPM_SIG_PACKAGE_UNKNOWN_OK); + v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL, + v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK, + v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK); prompt_to_delete(handle, v->path, v->error); } else if(v->error == ALPM_ERR_PKG_INVALID_CHECKSUM) { prompt_to_delete(handle, v->path, v->error); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 13984707..91db2fde 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -48,7 +48,7 @@ */ /** Initialize the transaction. */ -int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags) +int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, int flags) { alpm_trans_t *trans; @@ -415,7 +415,7 @@ cleanup: return retval; } -alpm_transflag_t SYMEXPORT alpm_trans_get_flags(alpm_handle_t *handle) +int SYMEXPORT alpm_trans_get_flags(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return -1); diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h index 73111be4..ac13b891 100644 --- a/lib/libalpm/trans.h +++ b/lib/libalpm/trans.h @@ -37,7 +37,8 @@ typedef enum _alpm_transstate_t { /* Transaction */ struct __alpm_trans_t { - alpm_transflag_t flags; + /* bitfield of alpm_transflag_t flags */ + int flags; alpm_transstate_t state; alpm_list_t *unresolvable; /* list of (alpm_pkg_t *) */ alpm_list_t *add; /* list of (alpm_pkg_t *) */ @@ -46,7 +47,8 @@ struct __alpm_trans_t { }; void _alpm_trans_free(alpm_trans_t *trans); -int _alpm_trans_init(alpm_trans_t *trans, alpm_transflag_t flags); +/* flags is a bitfield of alpm_transflag_t flags */ +int _alpm_trans_init(alpm_trans_t *trans, int flags); int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath, const char *script, const char *ver, const char *oldver, int is_archive); diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index b9c5c172..135697da 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -131,6 +131,8 @@ int _alpm_ldconfig(alpm_handle_t *handle); int _alpm_str_cmp(const void *s1, const void *s2); char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename); const char *_alpm_filecache_setup(alpm_handle_t *handle); +/* Unlike many uses of alpm_pkgvalidation_t, _alpm_test_checksum expects + * an enum value rather than a bitfield. */ int _alpm_test_checksum(const char *filepath, const char *expected, alpm_pkgvalidation_t type); int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b); int _alpm_splitname(const char *target, char **name, char **version, |