summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/alpm.c2
-rw-r--r--lib/libalpm/alpm.h33
-rw-r--r--lib/libalpm/be_local.c8
-rw-r--r--lib/libalpm/be_package.c8
-rw-r--r--lib/libalpm/be_sync.c26
-rw-r--r--lib/libalpm/db.c10
-rw-r--r--lib/libalpm/db.h16
-rw-r--r--lib/libalpm/handle.c12
-rw-r--r--lib/libalpm/handle.h6
-rw-r--r--lib/libalpm/package.c4
-rw-r--r--lib/libalpm/package.h13
-rw-r--r--lib/libalpm/sync.c16
-rw-r--r--lib/libalpm/trans.c4
-rw-r--r--lib/libalpm/trans.h6
-rw-r--r--lib/libalpm/util.h2
-rw-r--r--src/pacman/conf.c17
-rw-r--r--src/pacman/conf.h24
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/sync.c2
-rw-r--r--src/pacman/upgrade.c8
-rw-r--r--src/pacman/util.c2
-rw-r--r--src/pacman/util.h3
-rw-r--r--src/util/cleanupdelta.c4
-rw-r--r--src/util/testpkg.c4
24 files changed, 123 insertions, 109 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,
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 25de7afa..d8d64fb0 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -325,10 +325,10 @@ int config_set_arch(const char *arch)
* @param linenum current line number in file
* @return 0 on success, 1 on any parsing error
*/
-static int process_siglevel(alpm_list_t *values, alpm_siglevel_t *storage,
- alpm_siglevel_t *storage_mask, const char *file, int linenum)
+static int process_siglevel(alpm_list_t *values, int *storage,
+ int *storage_mask, const char *file, int linenum)
{
- alpm_siglevel_t level = *storage, mask = *storage_mask;
+ int level = *storage, mask = *storage_mask;
alpm_list_t *i;
int ret = 0;
@@ -421,13 +421,12 @@ static int process_siglevel(alpm_list_t *values, alpm_siglevel_t *storage,
}
/**
- * Merge the package entires of two signature verification levels.
+ * Merge the package entries of two signature verification levels.
* @param base initial siglevel
- * @param over overridden siglevel
+ * @param over overriding siglevel
* @return merged siglevel
*/
-static alpm_siglevel_t merge_siglevel(alpm_siglevel_t base,
- alpm_siglevel_t over, alpm_siglevel_t mask)
+static int merge_siglevel(int base, int over, int mask)
{
return mask ? (over & mask) | (base & ~mask) : over;
}
@@ -845,11 +844,11 @@ struct section_t {
int depth;
};
-static int process_usage(alpm_list_t *values, alpm_db_usage_t *usage,
+static int process_usage(alpm_list_t *values, int *usage,
const char *file, int linenum)
{
alpm_list_t *i;
- alpm_db_usage_t level = *usage;
+ int level = *usage;
int ret = 0;
for(i = values; i; i = i->next) {
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 2ddeadb3..945de7ce 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -37,9 +37,9 @@ typedef struct __colstr_t {
typedef struct __config_repo_t {
char *name;
alpm_list_t *servers;
- alpm_db_usage_t usage;
- alpm_siglevel_t siglevel;
- alpm_siglevel_t siglevel_mask;
+ int usage;
+ int siglevel;
+ int siglevel_mask;
} config_repo_t;
typedef struct __config_t {
@@ -95,14 +95,16 @@ typedef struct __config_t {
unsigned short group;
unsigned short noask;
unsigned int ask;
- alpm_transflag_t flags;
- alpm_siglevel_t siglevel;
- alpm_siglevel_t localfilesiglevel;
- alpm_siglevel_t remotefilesiglevel;
-
- alpm_siglevel_t siglevel_mask;
- alpm_siglevel_t localfilesiglevel_mask;
- alpm_siglevel_t remotefilesiglevel_mask;
+ /* Bitfield of alpm_transflag_t */
+ int flags;
+ /* Bitfields of alpm_siglevel_t */
+ int siglevel;
+ int localfilesiglevel;
+ int remotefilesiglevel;
+
+ int siglevel_mask;
+ int localfilesiglevel_mask;
+ int remotefilesiglevel_mask;
/* conf file options */
/* I Love Candy! */
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 3ab9abc0..62ed7ce1 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -230,7 +230,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
break;
}
- alpm_pkgvalidation_t v = alpm_pkg_get_validation(pkg);
+ int v = alpm_pkg_get_validation(pkg);
if(v) {
if(v & ALPM_PKG_VALIDATION_NONE) {
validation = alpm_list_add(validation, _("None"));
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 8b306034..eeeb727a 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -630,7 +630,7 @@ static int process_target(const char *target, int error)
if(targname && targname != targstring) {
alpm_db_t *db;
const char *dbname;
- alpm_db_usage_t usage;
+ int usage;
*targname = '\0';
targname++;
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 591556d3..ab4a3b1e 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -89,15 +89,15 @@ int pacman_upgrade(alpm_list_t *targets)
for(i = targets, n = 0; i; i = alpm_list_next(i), n++) {
const char *targ = i->data;
alpm_pkg_t *pkg;
- alpm_siglevel_t level;
+ int siglevel;
if(file_is_remote[n]) {
- level = alpm_option_get_remote_file_siglevel(config->handle);
+ siglevel = alpm_option_get_remote_file_siglevel(config->handle);
} else {
- level = alpm_option_get_local_file_siglevel(config->handle);
+ siglevel = alpm_option_get_local_file_siglevel(config->handle);
}
- if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) {
+ if(alpm_pkg_load(config->handle, targ, 1, siglevel, &pkg) != 0) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
targ, alpm_strerror(alpm_errno(config->handle)));
retval = 1;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index b9790836..fd7438b3 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -61,7 +61,7 @@ enum {
CELL_FREE = (1 << 3)
};
-int trans_init(alpm_transflag_t flags, int check_valid)
+int trans_init(int flags, int check_valid)
{
int ret;
diff --git a/src/pacman/util.h b/src/pacman/util.h
index 74ce4cb2..0a6ce978 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -45,7 +45,8 @@ typedef struct _pm_target_t {
} pm_target_t;
void trans_init_error(void);
-int trans_init(alpm_transflag_t flags, int check_valid);
+/* flags is a bitfield of alpm_transflag_t flags */
+int trans_init(int flags, int check_valid);
int trans_release(void);
int needs_root(void);
int check_syncdbs(size_t need_repos, int check_valid);
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index 043acf1a..bb178ce9 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -68,11 +68,11 @@ static void checkdbs(alpm_list_t *dbnames)
{
alpm_db_t *db = NULL;
alpm_list_t *i;
- const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
+ const int siglevel = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
for(i = dbnames; i; i = alpm_list_next(i)) {
const char *dbname = i->data;
- db = alpm_register_syncdb(handle, dbname, level);
+ db = alpm_register_syncdb(handle, dbname, siglevel);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database '%s' (%s)\n",
dbname, alpm_strerror(alpm_errno(handle)));
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index 89e8dbd4..d5d90af8 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
alpm_handle_t *handle;
alpm_errno_t err;
alpm_pkg_t *pkg = NULL;
- const alpm_siglevel_t level = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL;
+ const int siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL;
if(argc != 2) {
fprintf(stderr, "testpkg (pacman) v" PACKAGE_VERSION "\n\n"
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
/* set gpgdir to default */
alpm_option_set_gpgdir(handle, GPGDIR);
- if(alpm_pkg_load(handle, argv[1], 1, level, &pkg) == -1
+ if(alpm_pkg_load(handle, argv[1], 1, siglevel, &pkg) == -1
|| pkg == NULL) {
err = alpm_errno(handle);
switch(err) {