[pacman-dev] CVS update of pacman-lib (30 files)
Aaron Griffin
aaron at archlinux.org
Tue Jan 23 22:02:55 EST 2007
Date: Tuesday, January 23, 2007 @ 22:02:55
Author: aaron
Path: /home/cvs-pacman/pacman-lib
Modified: lib/libalpm/add.c (1.102 -> 1.103)
lib/libalpm/alpm.c (1.104 -> 1.105)
lib/libalpm/alpm.h (1.66 -> 1.67)
lib/libalpm/be_files.c (1.20 -> 1.21)
lib/libalpm/cache.c (1.25 -> 1.26)
lib/libalpm/cache.h (1.9 -> 1.10)
lib/libalpm/conflict.c (1.30 -> 1.31)
lib/libalpm/conflict.h (1.10 -> 1.11)
lib/libalpm/db.c (1.55 -> 1.56) lib/libalpm/db.h (1.22 -> 1.23)
lib/libalpm/deps.c (1.57 -> 1.58) lib/libalpm/deps.h (1.16 -> 1.17)
lib/libalpm/handle.c (1.27 -> 1.28)
lib/libalpm/handle.h (1.13 -> 1.14) lib/libalpm/log.c (1.8 -> 1.9)
lib/libalpm/log.h (1.7 -> 1.8) lib/libalpm/package.c (1.49 -> 1.50)
lib/libalpm/package.h (1.23 -> 1.24)
lib/libalpm/sync.c (1.91 -> 1.92) lib/libalpm/sync.h (1.16 -> 1.17)
lib/libalpm/trans.c (1.30 -> 1.31)
lib/libalpm/trans.h (1.21 -> 1.22)
lib/libalpm/util.c (1.39 -> 1.40) lib/libalpm/util.h (1.18 -> 1.19)
lib/libalpm/versioncmp.c (1.8 -> 1.9)
src/pacman/add.c (1.23 -> 1.24) src/pacman/deptest.c (1.10 -> 1.11)
src/pacman/sync.c (1.97 -> 1.98) src/pacman/trans.c (1.27 -> 1.28)
src/pacman/trans.h (1.5 -> 1.6)
This mainly deals with code clarity- removing currently unneeded
optimizations in order to make the code much more readable and
type-checkable. Every enum in the library now has it's own type that
should be used instead of the generic 'unsigned char'. In addition,
several #define statements dealing with constants were converted to
enums.
Signed-off-by: Dan McGee <dpmcgee at gmail.com>
--------------------------+
lib/libalpm/add.c | 2
lib/libalpm/alpm.c | 6 +-
lib/libalpm/alpm.h | 132 +++++++++++++++++++++++++--------------------
lib/libalpm/be_files.c | 2
lib/libalpm/cache.c | 8 +-
lib/libalpm/cache.h | 6 +-
lib/libalpm/conflict.c | 2
lib/libalpm/conflict.h | 2
lib/libalpm/db.c | 2
lib/libalpm/db.h | 20 +++---
lib/libalpm/deps.c | 39 ++++++++-----
lib/libalpm/deps.h | 17 +++--
lib/libalpm/handle.c | 32 ++++++++--
lib/libalpm/handle.h | 4 -
lib/libalpm/log.c | 2
lib/libalpm/log.h | 4 +
lib/libalpm/package.c | 4 -
lib/libalpm/package.h | 15 ++---
lib/libalpm/sync.c | 2
lib/libalpm/sync.h | 2
lib/libalpm/trans.c | 6 +-
lib/libalpm/trans.h | 28 +++++----
lib/libalpm/util.c | 4 -
lib/libalpm/util.h | 2
lib/libalpm/versioncmp.c | 14 ++--
src/pacman/add.c | 14 +++-
src/pacman/deptest.c | 14 +++-
src/pacman/sync.c | 19 ++++--
src/pacman/trans.c | 78 ++++++++++++++------------
src/pacman/trans.h | 8 +-
30 files changed, 290 insertions(+), 200 deletions(-)
Index: pacman-lib/lib/libalpm/add.c
diff -u pacman-lib/lib/libalpm/add.c:1.102 pacman-lib/lib/libalpm/add.c:1.103
--- pacman-lib/lib/libalpm/add.c:1.102 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/add.c Tue Jan 23 22:02:53 2007
@@ -332,7 +332,7 @@
register struct archive *archive;
struct archive_entry *entry;
char expath[PATH_MAX], cwd[PATH_MAX] = "", *what;
- unsigned char cb_state;
+ pmtransprog_t cb_state;
time_t t;
alpm_list_t *targ, *lp;
Index: pacman-lib/lib/libalpm/alpm.c
diff -u pacman-lib/lib/libalpm/alpm.c:1.104 pacman-lib/lib/libalpm/alpm.c:1.105
--- pacman-lib/lib/libalpm/alpm.c:1.104 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/alpm.c Tue Jan 23 22:02:54 2007
@@ -63,7 +63,7 @@
/* Globals */
pmhandle_t *handle = NULL;
-enum __pmerrno_t pm_errno;
+enum _pmerrno_t pm_errno;
/** \addtogroup alpm_interface Interface Functions
* @brief Functions to initialize and release libalpm
@@ -622,7 +622,9 @@
* @param progress progress callback function pointer
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress)
+int alpm_trans_init(pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress)
{
char path[PATH_MAX];
Index: pacman-lib/lib/libalpm/alpm.h
diff -u pacman-lib/lib/libalpm/alpm.h:1.66 pacman-lib/lib/libalpm/alpm.h:1.67
--- pacman-lib/lib/libalpm/alpm.h:1.66 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/alpm.h Tue Jan 23 22:02:54 2007
@@ -71,13 +71,15 @@
*/
/* Levels */
-#define PM_LOG_DEBUG 0x01
-#define PM_LOG_ERROR 0x02
-#define PM_LOG_WARNING 0x04
-#define PM_LOG_FLOW1 0x08
-#define PM_LOG_FLOW2 0x10
-#define PM_LOG_FUNCTION 0x20
-#define PM_LOG_DOWNLOAD 0x40
+typedef enum _pmloglevel_t {
+ PM_LOG_DEBUG = 0x01,
+ PM_LOG_ERROR = 0x02,
+ PM_LOG_WARNING = 0x04,
+ PM_LOG_FLOW1 = 0x08,
+ PM_LOG_FLOW2 = 0x10,
+ PM_LOG_FUNCTION = 0x20,
+ PM_LOG_DOWNLOAD = 0x40
+} pmloglevel_t;
typedef void (*alpm_cb_log)(unsigned short, char *);
int alpm_logaction(char *fmt, ...);
@@ -100,8 +102,8 @@
alpm_cb_download alpm_option_get_dlcb();
void alpm_option_set_dlcb(alpm_cb_download cb);
-unsigned char alpm_option_get_logmask();
-void alpm_option_set_logmask(unsigned char mask);
+unsigned short alpm_option_get_logmask();
+void alpm_option_set_logmask(unsigned short mask);
const char *alpm_option_get_root();
void alpm_option_set_root(const char *root);
@@ -115,8 +117,8 @@
const char *alpm_option_get_logfile();
void alpm_option_set_logfile(const char *logfile);
-unsigned char alpm_option_get_usesyslog();
-void alpm_option_set_usesyslog(unsigned char usesyslog);
+unsigned short alpm_option_get_usesyslog();
+void alpm_option_set_usesyslog(unsigned short usesyslog);
alpm_list_t *alpm_option_get_noupgrades();
void alpm_option_add_noupgrade(char *pkg);
@@ -188,19 +190,26 @@
/* Info parameters */
/* reasons -- ie, why the package was installed */
-#define PM_PKG_REASON_EXPLICIT 0 /* explicitly requested by the user */
-#define PM_PKG_REASON_DEPEND 1 /* installed as a dependency for another package */
+typedef enum _pmpkgreason_t {
+ PM_PKG_REASON_EXPLICIT = 0, /* explicitly requested by the user */
+ PM_PKG_REASON_DEPEND = 1 /* installed as a dependency for another package */
+} pmpkgreason_t;
/* package name formats */
-#define PM_PKG_WITHOUT_ARCH 0 /* pkgname-pkgver-pkgrel, used under PM_DBPATH */
-#define PM_PKG_WITH_ARCH 1 /* ie, pkgname-pkgver-pkgrel-arch, used under PM_CACHEDIR */
+/*
+typedef enum _pmpkghasarch_t {
+ PM_PKG_WITHOUT_ARCH = 0, / pkgname-pkgver-pkgrel, used under PM_DBPATH /
+ PM_PKG_WITH_ARCH = 1 / pkgname-pkgver-pkgrel-arch, used under PM_CACHEDIR /
+} pmpkghasarch_t;
+*/
int alpm_pkg_load(char *filename, pmpkg_t **pkg);
int alpm_pkg_free(pmpkg_t *pkg);
int alpm_pkg_checkmd5sum(pmpkg_t *pkg);
int alpm_pkg_checksha1sum(pmpkg_t *pkg);
char *alpm_fetch_pkgurl(char *url);
-int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this_section);
+int alpm_parse_config(char *file, alpm_cb_db_register callback,
+ const char *this_section);
int alpm_pkg_vercmp(const char *ver1, const char *ver2);
char *alpm_pkg_name_hasarch(char *pkgname);
@@ -218,7 +227,7 @@
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
-unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
+pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg);
@@ -229,7 +238,7 @@
alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
-unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg);
+unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
/*
* Groups
@@ -242,13 +251,13 @@
*/
/* Types */
-enum {
+typedef enum _pmsynctype_t {
PM_SYNC_TYPE_REPLACE = 1,
PM_SYNC_TYPE_UPGRADE,
PM_SYNC_TYPE_DEPEND
-};
+} pmsynctype_t;
-unsigned char alpm_sync_get_type(pmsyncpkg_t *sync);
+pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync);
pmpkg_t *alpm_sync_get_package(pmsyncpkg_t *sync);
void *alpm_sync_get_data(pmsyncpkg_t *sync);
@@ -257,30 +266,32 @@
*/
/* Types */
-enum {
+typedef enum _pmtranstype_t {
PM_TRANS_TYPE_ADD = 1,
PM_TRANS_TYPE_REMOVE,
PM_TRANS_TYPE_UPGRADE,
PM_TRANS_TYPE_SYNC
-};
+} pmtranstype_t;
/* Flags */
-#define PM_TRANS_FLAG_NODEPS 0x01
-#define PM_TRANS_FLAG_FORCE 0x02
-#define PM_TRANS_FLAG_NOSAVE 0x04
-#define PM_TRANS_FLAG_FRESHEN 0x08
-#define PM_TRANS_FLAG_CASCADE 0x10
-#define PM_TRANS_FLAG_RECURSE 0x20
-#define PM_TRANS_FLAG_DBONLY 0x40
-#define PM_TRANS_FLAG_DEPENDSONLY 0x80
-#define PM_TRANS_FLAG_ALLDEPS 0x100
-#define PM_TRANS_FLAG_DOWNLOADONLY 0x200
-#define PM_TRANS_FLAG_NOSCRIPTLET 0x400
-#define PM_TRANS_FLAG_NOCONFLICTS 0x800
-#define PM_TRANS_FLAG_PRINTURIS 0x1000
+typedef enum _pmtransflag_t {
+ PM_TRANS_FLAG_NODEPS = 0x01,
+ PM_TRANS_FLAG_FORCE = 0x02,
+ PM_TRANS_FLAG_NOSAVE = 0x04,
+ PM_TRANS_FLAG_FRESHEN = 0x08,
+ PM_TRANS_FLAG_CASCADE = 0x10,
+ PM_TRANS_FLAG_RECURSE = 0x20,
+ PM_TRANS_FLAG_DBONLY = 0x40,
+ PM_TRANS_FLAG_DEPENDSONLY = 0x80,
+ PM_TRANS_FLAG_ALLDEPS = 0x100,
+ PM_TRANS_FLAG_DOWNLOADONLY = 0x200,
+ PM_TRANS_FLAG_NOSCRIPTLET = 0x400,
+ PM_TRANS_FLAG_NOCONFLICTS = 0x800,
+ PM_TRANS_FLAG_PRINTURIS = 0x1000
+} pmtransflag_t;
/* Transaction Events */
-enum {
+typedef enum _pmtransevt_t {
PM_TRANS_EVT_CHECKDEPS_START = 1,
PM_TRANS_EVT_CHECKDEPS_DONE,
PM_TRANS_EVT_FILECONFLICTS_START,
@@ -306,10 +317,10 @@
PM_TRANS_EVT_PRINTURI,
PM_TRANS_EVT_RETRIEVE_START,
PM_TRANS_EVT_RETRIEVE_LOCAL
-};
+} pmtransevt_t;
/* Transaction Conversations (ie, questions) */
-enum {
+typedef enum _pmtransconv_t {
PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01,
PM_TRANS_CONV_REPLACE_PKG = 0x02,
PM_TRANS_CONV_CONFLICT_PKG = 0x04,
@@ -317,30 +328,33 @@
PM_TRANS_CONV_LOCAL_NEWER = 0x10,
PM_TRANS_CONV_LOCAL_UPTODATE = 0x20,
PM_TRANS_CONV_REMOVE_HOLDPKG = 0x40
-};
+} pmtransconv_t;
/* Transaction Progress */
-enum {
+typedef enum _pmtransprog_t {
PM_TRANS_PROGRESS_ADD_START,
PM_TRANS_PROGRESS_UPGRADE_START,
PM_TRANS_PROGRESS_REMOVE_START,
PM_TRANS_PROGRESS_CONFLICTS_START
-};
+} pmtransprog_t;
/* Transaction Event callback */
-typedef void (*alpm_trans_cb_event)(unsigned char, void *, void *);
+typedef void (*alpm_trans_cb_event)(pmtransevt_t, void *, void *);
/* Transaction Conversation callback */
-typedef void (*alpm_trans_cb_conv)(unsigned char, void *, void *, void *, int *);
+typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *,
+ void *, int *);
/* Transaction Progress callback */
-typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
+typedef void (*alpm_trans_cb_progress)(pmtransprog_t, char *, int, int, int);
-unsigned char alpm_trans_get_type();
+pmtranstype_t alpm_trans_get_type();
unsigned int alpm_trans_get_flags();
alpm_list_t * alpm_trans_get_targets();
alpm_list_t * alpm_trans_get_packages();
-int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress);
+int alpm_trans_init(pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress cb_progress);
int alpm_trans_sysupgrade(void);
int alpm_trans_addtarget(char *target);
int alpm_trans_prepare(alpm_list_t **data);
@@ -351,21 +365,22 @@
* Dependencies and conflicts
*/
-enum {
+typedef enum _pmdepmod_t {
PM_DEP_MOD_ANY = 1,
PM_DEP_MOD_EQ,
PM_DEP_MOD_GE,
PM_DEP_MOD_LE
-};
-enum {
+} pmdepmod_t;
+
+typedef enum _pmdeptype_t {
PM_DEP_TYPE_DEPEND = 1,
PM_DEP_TYPE_REQUIRED,
PM_DEP_TYPE_CONFLICT
-};
+} pmdeptype_t;
const char *alpm_dep_get_target(pmdepmissing_t *miss);
-unsigned char alpm_dep_get_type(pmdepmissing_t *miss);
-unsigned char alpm_dep_get_mod(pmdepmissing_t *miss);
+pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss);
+pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss);
const char *alpm_dep_get_name(pmdepmissing_t *miss);
const char *alpm_dep_get_version(pmdepmissing_t *miss);
@@ -373,19 +388,20 @@
* File conflicts
*/
-enum {
+typedef enum _pmconflicttype_t {
PM_CONFLICT_TYPE_TARGET = 1,
PM_CONFLICT_TYPE_FILE
-};
+} pmconflicttype_t;
const char *alpm_conflict_get_target(pmconflict_t *conflict);
-unsigned char alpm_conflict_get_type(pmconflict_t *conflict);
+pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict);
const char *alpm_conflict_get_file(pmconflict_t *conflict);
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict);
/*
* Helpers
*/
+
/* md5sums */
char *alpm_get_md5sum(char *name);
@@ -394,7 +410,7 @@
/*
* Errors
*/
-enum __pmerrno_t {
+enum _pmerrno_t {
PM_ERR_MEMORY = 1,
PM_ERR_SYSTEM,
PM_ERR_BADPERMS,
@@ -466,7 +482,7 @@
PM_ERR_FORK_FAILED
};
-extern enum __pmerrno_t pm_errno;
+extern enum _pmerrno_t pm_errno;
char *alpm_strerror(int err);
Index: pacman-lib/lib/libalpm/be_files.c
diff -u pacman-lib/lib/libalpm/be_files.c:1.20 pacman-lib/lib/libalpm/be_files.c:1.21
--- pacman-lib/lib/libalpm/be_files.c:1.20 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/be_files.c Tue Jan 23 22:02:54 2007
@@ -98,7 +98,7 @@
rewinddir(db->handle);
}
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq)
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq)
{
struct dirent *ent = NULL;
struct stat sbuf;
Index: pacman-lib/lib/libalpm/cache.c
diff -u pacman-lib/lib/libalpm/cache.c:1.25 pacman-lib/lib/libalpm/cache.c:1.26
--- pacman-lib/lib/libalpm/cache.c:1.25 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/cache.c Tue Jan 23 22:02:54 2007
@@ -41,12 +41,12 @@
/* Returns a new package cache from db.
* It frees the cache if it already exists.
*/
-int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel)
+int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
pmpkg_t *info;
int count = 0;
/* The group cache needs INFRQ_DESC as well */
- /*unsigned char infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/
+ /* pmdbinfrq_t infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/
if(db == NULL) {
return(-1);
@@ -86,7 +86,7 @@
}
}
-alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel)
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
if(db == NULL) {
return(NULL);
@@ -101,7 +101,7 @@
return(db->pkgcache);
}
-int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel)
+int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel)
{
int reloaded = 0;
/* for each pkg, check and reload if the requested
Index: pacman-lib/lib/libalpm/cache.h
diff -u pacman-lib/lib/libalpm/cache.h:1.9 pacman-lib/lib/libalpm/cache.h:1.10
--- pacman-lib/lib/libalpm/cache.h:1.9 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/cache.h Tue Jan 23 22:02:54 2007
@@ -27,12 +27,12 @@
#include "package.h"
/* packages */
-int _alpm_db_load_pkgcache(pmdb_t *db, unsigned char infolevel);
+int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
void _alpm_db_free_pkgcache(pmdb_t *db);
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
-alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, unsigned char infolevel);
-int _alpm_db_ensure_pkgcache(pmdb_t *db, unsigned char infolevel);
+alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
+int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target);
/* groups */
int _alpm_db_load_grpcache(pmdb_t *db);
Index: pacman-lib/lib/libalpm/conflict.c
diff -u pacman-lib/lib/libalpm/conflict.c:1.30 pacman-lib/lib/libalpm/conflict.c:1.31
--- pacman-lib/lib/libalpm/conflict.c:1.30 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/conflict.c Tue Jan 23 22:02:54 2007
@@ -368,7 +368,7 @@
return conflict->target;
}
-unsigned char alpm_conflict_get_type(pmconflict_t *conflict)
+pmconflicttype_t alpm_conflict_get_type(pmconflict_t *conflict)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/conflict.h
diff -u pacman-lib/lib/libalpm/conflict.h:1.10 pacman-lib/lib/libalpm/conflict.h:1.11
--- pacman-lib/lib/libalpm/conflict.h:1.10 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/conflict.h Tue Jan 23 22:02:54 2007
@@ -28,7 +28,7 @@
struct __pmconflict_t {
char target[PKG_NAME_LEN];
- unsigned char type;
+ pmconflicttype_t type;
char file[CONFLICT_FILE_LEN];
char ctarget[PKG_NAME_LEN];
};
Index: pacman-lib/lib/libalpm/db.c
diff -u pacman-lib/lib/libalpm/db.c:1.55 pacman-lib/lib/libalpm/db.c:1.56
--- pacman-lib/lib/libalpm/db.c:1.55 Mon Jan 22 20:34:58 2007
+++ pacman-lib/lib/libalpm/db.c Tue Jan 23 22:02:54 2007
@@ -110,7 +110,7 @@
char *matched = NULL;
regex_t reg;
- if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE) != 0) {
+ if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
}
Index: pacman-lib/lib/libalpm/db.h
diff -u pacman-lib/lib/libalpm/db.h:1.22 pacman-lib/lib/libalpm/db.h:1.23
--- pacman-lib/lib/libalpm/db.h:1.22 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/db.h Tue Jan 23 22:02:54 2007
@@ -27,12 +27,14 @@
#include <limits.h>
/* Database entries */
-#define INFRQ_NONE 0x00
-#define INFRQ_DESC 0x01
-#define INFRQ_DEPENDS 0x02
-#define INFRQ_FILES 0x04
-#define INFRQ_SCRIPTLET 0x08
-#define INFRQ_ALL 0xFF
+typedef enum _pmdbinfrq_t {
+ INFRQ_NONE = 0x00,
+ INFRQ_DESC = 0x01,
+ INFRQ_DEPENDS = 0x02,
+ INFRQ_FILES = 0x04,
+ INFRQ_SCRIPTLET = 0x08,
+ INFRQ_ALL = 0xFF
+} pmdbinfrq_t;
/* Database */
struct __pmdb_t {
@@ -55,9 +57,9 @@
int _alpm_db_open(pmdb_t *db);
void _alpm_db_close(pmdb_t *db);
void _alpm_db_rewind(pmdb_t *db);
-pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, unsigned int inforeq);
-int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info);
-int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq);
+pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq);
+int _alpm_db_read(pmdb_t *db, pmdbinfrq_t inforeq, pmpkg_t *info);
+int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
int _alpm_db_getlastupdate(pmdb_t *db, char *ts);
int _alpm_db_setlastupdate(pmdb_t *db, char *ts);
Index: pacman-lib/lib/libalpm/deps.c
diff -u pacman-lib/lib/libalpm/deps.c:1.57 pacman-lib/lib/libalpm/deps.c:1.58
--- pacman-lib/lib/libalpm/deps.c:1.57 Fri Jan 19 04:28:44 2007
+++ pacman-lib/lib/libalpm/deps.c Tue Jan 23 22:02:54 2007
@@ -44,8 +44,9 @@
extern pmhandle_t *handle;
-pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
- const char *depname, const char *depversion)
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
+ pmdepmod_t depmod, const char *depname,
+ const char *depversion)
{
pmdepmissing_t *miss;
@@ -187,7 +188,8 @@
* dependencies can include versions with depmod operators.
*
*/
-alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, alpm_list_t *packages)
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
+ alpm_list_t *packages)
{
pmdepend_t depend;
alpm_list_t *i, *j, *k;
@@ -224,7 +226,7 @@
continue;
}
if(_alpm_pkg_isin(p->name, packages)) {
- /* this package is also in the upgrade list, so don't worry about it */
+ /* this package also in the upgrade list, so don't worry about it */
continue;
}
_alpm_db_read(db, INFRQ_DEPENDS, p);
@@ -246,8 +248,10 @@
FREELISTPTR(provides);
}
if(!_alpm_depcmp(tp, &depend)) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), depend.name, p->name);
- miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
+ depend.name, p->name);
+ miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod,
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -278,7 +282,8 @@
_alpm_splitdep((char *)j->data, &depend);
found = 0;
/* check database for literal packages */
- for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); k && !found; k = k->next) {
+ for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS);
+ k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
found = _alpm_depcmp(p, &depend);
}
@@ -316,8 +321,9 @@
/* else if still not found... */
if(!found) {
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as a dependency for %s"),
- depend.name, tp->name);
- miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod, depend.name, depend.version);
+ depend.name, tp->name);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_DEPEND, depend.mod,
+ depend.name, depend.version);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -363,8 +369,10 @@
}
}
if(!found) {
- _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), reqname, tp->name);
- miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED, PM_DEP_MOD_ANY, j->data, NULL);
+ _alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"),
+ reqname, tp->name);
+ miss = _alpm_depmiss_new(tp->name, PM_DEP_TYPE_REQUIRED,
+ PM_DEP_MOD_ANY, j->data, NULL);
if(!_alpm_depmiss_isin(miss, baddeps)) {
baddeps = alpm_list_add(baddeps, miss);
} else {
@@ -512,8 +520,9 @@
*
* make sure *list and *trail are already initialized
*/
-int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *list,
- alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data)
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
+ alpm_list_t *list, alpm_list_t *trail, pmtrans_t *trans,
+ alpm_list_t **data)
{
alpm_list_t *i, *j;
alpm_list_t *targ;
@@ -647,7 +656,7 @@
return miss->target;
}
-unsigned char alpm_dep_get_type(pmdepmissing_t *miss)
+pmdeptype_t alpm_dep_get_type(pmdepmissing_t *miss)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -656,7 +665,7 @@
return miss->type;
}
-unsigned char alpm_dep_get_mod(pmdepmissing_t *miss)
+pmdepmod_t alpm_dep_get_mod(pmdepmissing_t *miss)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/deps.h
diff -u pacman-lib/lib/libalpm/deps.h:1.16 pacman-lib/lib/libalpm/deps.h:1.17
--- pacman-lib/lib/libalpm/deps.h:1.16 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/deps.h Tue Jan 23 22:02:54 2007
@@ -30,7 +30,7 @@
/* Dependency */
struct __pmdepend_t {
- unsigned char mod;
+ pmdepmod_t mod;
char name[PKG_NAME_LEN];
char version[PKG_VERSION_LEN];
};
@@ -38,19 +38,22 @@
/* Missing dependency */
struct __pmdepmissing_t {
char target[PKG_NAME_LEN];
- unsigned char type;
+ pmdeptype_t type;
pmdepend_t depend;
};
-pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsigned char depmod,
- const char *depname, const char *depversion);
+pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
+ pmdepmod_t depmod, const char *depname,
+ const char *depversion);
int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack);
alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode);
-alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, alpm_list_t *packages);
+alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op,
+ alpm_list_t *packages);
int _alpm_splitdep(char *depstr, pmdepend_t *depend);
alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs);
-int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *list,
- alpm_list_t *trail, pmtrans_t *trans, alpm_list_t **data);
+int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
+ alpm_list_t *list, alpm_list_t *trail, pmtrans_t *trans,
+ alpm_list_t **data);
#endif /* _ALPM_DEPS_H */
Index: pacman-lib/lib/libalpm/handle.c
diff -u pacman-lib/lib/libalpm/handle.c:1.27 pacman-lib/lib/libalpm/handle.c:1.28
--- pacman-lib/lib/libalpm/handle.c:1.27 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/handle.c Tue Jan 23 22:02:54 2007
@@ -117,12 +117,12 @@
alpm_cb_log alpm_option_get_logcb() { return handle->logcb; }
alpm_cb_download alpm_option_get_dlcb() { return handle->dlcb; }
-unsigned char alpm_option_get_logmask() { return handle->logmask; }
+unsigned short alpm_option_get_logmask() { return handle->logmask; }
const char *alpm_option_get_root() { return handle->root; }
const char *alpm_option_get_dbpath() { return handle->dbpath; }
const char *alpm_option_get_cachedir() { return handle->cachedir; }
const char *alpm_option_get_logfile() { return handle->logfile; }
-unsigned char alpm_option_get_usesyslog() { return handle->usesyslog; }
+unsigned short alpm_option_get_usesyslog() { return handle->usesyslog; }
alpm_list_t *alpm_option_get_noupgrades() { return handle->noupgrade; }
alpm_list_t *alpm_option_get_noextracts() { return handle->noextract; }
alpm_list_t *alpm_option_get_ignorepkgs() { return handle->ignorepkg; }
@@ -135,13 +135,16 @@
unsigned short alpm_option_get_usecolor() { return handle->use_color; }
pmdb_t *alpm_option_get_localdb() { return handle->db_local; }
-alpm_list_t *alpm_option_get_syncdbs() { return handle->dbs_sync; }
+alpm_list_t *alpm_option_get_syncdbs()
+{
+ return handle->dbs_sync;
+}
void alpm_option_set_logcb(alpm_cb_log cb) { handle->logcb = cb; }
void alpm_option_set_dlcb(alpm_cb_download cb) { handle->dlcb = cb; }
-void alpm_option_set_logmask(unsigned char mask) { handle->logmask = mask; }
+void alpm_option_set_logmask(unsigned short mask) { handle->logmask = mask; }
void alpm_option_set_root(const char *root)
{
@@ -176,12 +179,16 @@
}
}
-void alpm_option_set_usesyslog(unsigned char usesyslog) { handle->usesyslog = usesyslog; }
+void alpm_option_set_usesyslog(unsigned short usesyslog)
+{
+ handle->usesyslog = usesyslog;
+}
void alpm_option_add_noupgrade(char *pkg)
{
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
}
+
void alpm_option_set_noupgrades(alpm_list_t *noupgrade)
{
if(handle->noupgrade) FREELIST(handle->noupgrade);
@@ -218,7 +225,10 @@
if(holdpkgs) handle->holdpkg = holdpkgs;
}
-void alpm_option_set_upgradedelay(time_t delay) { handle->upgradedelay = delay; }
+void alpm_option_set_upgradedelay(time_t delay)
+{
+ handle->upgradedelay = delay;
+}
void alpm_option_set_xfercommand(const char *cmd)
{
@@ -226,7 +236,10 @@
if(cmd) handle->xfercommand = strdup(cmd);
}
-void alpm_option_set_nopassiveftp(unsigned short nopasv) { handle->nopassiveftp = nopasv; }
+void alpm_option_set_nopassiveftp(unsigned short nopasv)
+{
+ handle->nopassiveftp = nopasv;
+}
void alpm_option_set_chomp(unsigned short chomp) { handle->chomp = chomp; }
@@ -239,6 +252,9 @@
if(handle->needles) FREELIST(handle->needles);
if(needles) handle->needles = needles;
}
-void alpm_option_set_usecolor(unsigned short usecolor) { handle->use_color = usecolor; }
+void alpm_option_set_usecolor(unsigned short usecolor)
+{
+ handle->use_color = usecolor;
+}
/* vim: set ts=2 sw=2 et: */
Index: pacman-lib/lib/libalpm/handle.h
diff -u pacman-lib/lib/libalpm/handle.h:1.13 pacman-lib/lib/libalpm/handle.h:1.14
--- pacman-lib/lib/libalpm/handle.h:1.13 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/handle.h Tue Jan 23 22:02:54 2007
@@ -45,12 +45,12 @@
/* options */
alpm_cb_log logcb; /* Log callback function */
alpm_cb_download dlcb; /* Download callback function */
- unsigned char logmask; /* Output mask for logging functions */
+ unsigned short logmask; /* Output mask for logging functions */
char *root; /* Root path, default '/' */
char *dbpath; /* Base path to pacman's DBs */
char *cachedir; /* Base path to pacman's cache */
char *logfile; /* Name of the file to log to */ /*TODO is this used?*/
- unsigned char usesyslog; /* Use syslog instead of logfile? */
+ unsigned short usesyslog; /* Use syslog instead of logfile? */
alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */
alpm_list_t *noextract; /* List of packages NOT to extrace */ /*TODO is this used?*/
Index: pacman-lib/lib/libalpm/log.c
diff -u pacman-lib/lib/libalpm/log.c:1.8 pacman-lib/lib/libalpm/log.c:1.9
--- pacman-lib/lib/libalpm/log.c:1.8 Mon Nov 20 04:10:24 2006
+++ pacman-lib/lib/libalpm/log.c Tue Jan 23 22:02:54 2007
@@ -27,7 +27,7 @@
#include "alpm.h"
#include "log.h"
-void _alpm_log(unsigned char flag, char *fmt, ...)
+void _alpm_log(pmloglevel_t flag, char *fmt, ...)
{
alpm_cb_log logcb = alpm_option_get_logcb();
if(logcb == NULL) {
Index: pacman-lib/lib/libalpm/log.h
diff -u pacman-lib/lib/libalpm/log.h:1.7 pacman-lib/lib/libalpm/log.h:1.8
--- pacman-lib/lib/libalpm/log.h:1.7 Mon Nov 20 04:10:24 2006
+++ pacman-lib/lib/libalpm/log.h Tue Jan 23 22:02:54 2007
@@ -21,9 +21,11 @@
#ifndef _ALPM_LOG_H
#define _ALPM_LOG_H
+#include "alpm.h"
+
#define LOG_STR_LEN 1024
-void _alpm_log(unsigned char flag, char *fmt, ...);
+void _alpm_log(pmloglevel_t flag, char *fmt, ...);
#endif /* _ALPM_LOG_H */
Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.49 pacman-lib/lib/libalpm/package.c:1.50
--- pacman-lib/lib/libalpm/package.c:1.49 Mon Jan 22 11:16:51 2007
+++ pacman-lib/lib/libalpm/package.c Tue Jan 23 22:02:54 2007
@@ -606,7 +606,7 @@
return pkg->isize;
}
-unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
+pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -741,7 +741,7 @@
return pkg->backup;
}
-unsigned char alpm_pkg_has_scriptlet(pmpkg_t *pkg)
+unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/package.h
diff -u pacman-lib/lib/libalpm/package.h:1.23 pacman-lib/lib/libalpm/package.h:1.24
--- pacman-lib/lib/libalpm/package.h:1.23 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/package.h Tue Jan 23 22:02:54 2007
@@ -30,11 +30,12 @@
#endif
#include "alpm.h"
+#include "db.h"
-enum {
+typedef enum _pmpkgfrom_t {
PKG_FROM_CACHE = 1,
PKG_FROM_FILE
-};
+} pmpkgfrom_t;
/* Packages */
#define PKG_FILENAME_LEN 512
@@ -65,10 +66,10 @@
char arch[PKG_ARCH_LEN];
unsigned long size;
unsigned long isize;
- unsigned char scriptlet;
- unsigned char force;
+ unsigned short scriptlet;
+ unsigned short force;
time_t date;
- unsigned char reason;
+ pmpkgreason_t reason;
alpm_list_t *desc_localized;
alpm_list_t *license;
alpm_list_t *replaces;
@@ -81,9 +82,9 @@
alpm_list_t *conflicts;
alpm_list_t *provides;
/* internal */
- unsigned char origin;
+ unsigned short origin;
void *data;
- unsigned char infolevel;
+ pmdbinfrq_t infolevel;
};
#define FREEPKG(p) do { if(p){_alpm_pkg_free(p); p = NULL;}} while(0)
Index: pacman-lib/lib/libalpm/sync.c
diff -u pacman-lib/lib/libalpm/sync.c:1.91 pacman-lib/lib/libalpm/sync.c:1.92
--- pacman-lib/lib/libalpm/sync.c:1.91 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/sync.c Tue Jan 23 22:02:54 2007
@@ -1069,7 +1069,7 @@
return(-1);
}
-unsigned char alpm_sync_get_type(pmsyncpkg_t *sync)
+pmsynctype_t alpm_sync_get_type(pmsyncpkg_t *sync)
{
/* Sanity checks */
ASSERT(sync != NULL, return(-1));
Index: pacman-lib/lib/libalpm/sync.h
diff -u pacman-lib/lib/libalpm/sync.h:1.16 pacman-lib/lib/libalpm/sync.h:1.17
--- pacman-lib/lib/libalpm/sync.h:1.16 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/sync.h Tue Jan 23 22:02:54 2007
@@ -27,7 +27,7 @@
/* Sync package */
struct __pmsyncpkg_t {
- unsigned char type;
+ pmsynctype_t type;
pmpkg_t *pkg;
void *data;
};
Index: pacman-lib/lib/libalpm/trans.c
diff -u pacman-lib/lib/libalpm/trans.c:1.30 pacman-lib/lib/libalpm/trans.c:1.31
--- pacman-lib/lib/libalpm/trans.c:1.30 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/trans.c Tue Jan 23 22:02:54 2007
@@ -85,7 +85,9 @@
FREE(trans);
}
-int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress)
+int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress)
{
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
@@ -226,7 +228,7 @@
return(0);
}
-unsigned char alpm_trans_get_type()
+pmtranstype_t alpm_trans_get_type()
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
Index: pacman-lib/lib/libalpm/trans.h
diff -u pacman-lib/lib/libalpm/trans.h:1.21 pacman-lib/lib/libalpm/trans.h:1.22
--- pacman-lib/lib/libalpm/trans.h:1.21 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/trans.h Tue Jan 23 22:02:54 2007
@@ -26,11 +26,21 @@
#include "alpm.h"
+typedef enum _pmtransstate_t {
+ STATE_IDLE = 0,
+ STATE_INITIALIZED,
+ STATE_PREPARED,
+ STATE_DOWNLOADING,
+ STATE_COMMITING,
+ STATE_COMMITED,
+ STATE_INTERRUPTED
+} pmtransstate_t;
+
/* Transaction */
struct __pmtrans_t {
- unsigned char type;
+ pmtranstype_t type;
unsigned int flags;
- unsigned char state;
+ pmtransstate_t state;
alpm_list_t *targets; /* alpm_list_t of (char *) */
alpm_list_t *packages; /* alpm_list_t of (pmpkg_t *) or (pmsyncpkg_t *) */
alpm_list_t *skiplist; /* alpm_list_t of (char *) */
@@ -39,16 +49,6 @@
alpm_trans_cb_progress cb_progress;
};
-enum {
- STATE_IDLE = 0,
- STATE_INITIALIZED,
- STATE_PREPARED,
- STATE_DOWNLOADING,
- STATE_COMMITING,
- STATE_COMMITED,
- STATE_INTERRUPTED
-};
-
#define FREETRANS(p) \
do { \
if(p) { \
@@ -77,7 +77,9 @@
pmtrans_t *_alpm_trans_new(void);
void _alpm_trans_free(void *data);
-int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress);
+int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags,
+ alpm_trans_cb_event event, alpm_trans_cb_conv conv,
+ alpm_trans_cb_progress progress);
int _alpm_trans_sysupgrade(pmtrans_t *trans);
int _alpm_trans_addtarget(pmtrans_t *trans, char *target);
int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data);
Index: pacman-lib/lib/libalpm/util.c
diff -u pacman-lib/lib/libalpm/util.c:1.39 pacman-lib/lib/libalpm/util.c:1.40
--- pacman-lib/lib/libalpm/util.c:1.39 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/util.c Tue Jan 23 22:02:54 2007
@@ -66,7 +66,7 @@
#ifdef __sun__
/* This is a replacement for strsep which is not portable (missing on Solaris).
- * Copyright (c) 2001 by François Gouget <fgouget_at_codeweavers.com> */
+ * Copyright (c) 2001 by François Gouget <fgouget_at_codeweavers.com> */
char* strsep(char** str, const char* delims)
{
char* token;
@@ -342,7 +342,7 @@
return(0);
}
-int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str)
+int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str)
{
_alpm_log(PM_LOG_DEBUG, _("logaction called: %s"), str);
Index: pacman-lib/lib/libalpm/util.h
diff -u pacman-lib/lib/libalpm/util.h:1.18 pacman-lib/lib/libalpm/util.h:1.19
--- pacman-lib/lib/libalpm/util.h:1.18 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/util.h Tue Jan 23 22:02:54 2007
@@ -62,7 +62,7 @@
int _alpm_lckrm(char *file);
int _alpm_unpack(const char *archive, const char *prefix, const char *fn);
int _alpm_rmrf(char *path);
-int _alpm_logaction(unsigned char usesyslog, FILE *f, const char *str);
+int _alpm_logaction(unsigned short usesyslog, FILE *f, const char *str);
int _alpm_ldconfig(char *root);
#ifdef _ALPM_TRANS_H
int _alpm_runscriptlet(char *util, char *installfn, char *script, char *ver, char *oldver, pmtrans_t *trans);
Index: pacman-lib/lib/libalpm/versioncmp.c
diff -u pacman-lib/lib/libalpm/versioncmp.c:1.8 pacman-lib/lib/libalpm/versioncmp.c:1.9
--- pacman-lib/lib/libalpm/versioncmp.c:1.8 Fri Jan 19 04:28:45 2007
+++ pacman-lib/lib/libalpm/versioncmp.c Tue Jan 23 22:02:54 2007
@@ -253,17 +253,19 @@
} else {
int cmp = _alpm_versioncmp(pkg->version, dep->version);
switch(dep->mod) {
- case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
- case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
- case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
+ case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
+ case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
+ case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
+ default: equal = 1; break;
}
}
char *mod = "~=";
switch(dep->mod) {
- case PM_DEP_MOD_EQ: mod = "=="; break;
- case PM_DEP_MOD_GE: mod = ">="; break;
- case PM_DEP_MOD_LE: mod = "<="; break;
+ case PM_DEP_MOD_EQ: mod = "=="; break;
+ case PM_DEP_MOD_GE: mod = ">="; break;
+ case PM_DEP_MOD_LE: mod = "<="; break;
+ default: break;
}
if(strlen(dep->version) > 0) {
Index: pacman-lib/src/pacman/add.c
diff -u pacman-lib/src/pacman/add.c:1.23 pacman-lib/src/pacman/add.c:1.24
--- pacman-lib/src/pacman/add.c:1.23 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/add.c Tue Jan 23 22:02:55 2007
@@ -96,9 +96,17 @@
MSG(NL, _(":: %s: requires %s"), alpm_dep_get_target(miss),
alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
Index: pacman-lib/src/pacman/deptest.c
diff -u pacman-lib/src/pacman/deptest.c:1.10 pacman-lib/src/pacman/deptest.c:1.11
--- pacman-lib/src/pacman/deptest.c:1.10 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/deptest.c Tue Jan 23 22:02:55 2007
@@ -114,9 +114,17 @@
if(!config->op_d_resolve) {
MSG(NL, _("requires: %s"), alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
Index: pacman-lib/src/pacman/sync.c
diff -u pacman-lib/src/pacman/sync.c:1.97 pacman-lib/src/pacman/sync.c:1.98
--- pacman-lib/src/pacman/sync.c:1.97 Tue Jan 23 15:09:18 2007
+++ pacman-lib/src/pacman/sync.c Tue Jan 23 22:02:55 2007
@@ -579,12 +579,21 @@
for(i = data; i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
MSG(NL, ":: %s %s %s", alpm_dep_get_target(miss),
- alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
- alpm_dep_get_name(miss));
+ alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ?
+ _("requires") : _("is required by"),
+ alpm_dep_get_name(miss));
switch(alpm_dep_get_mod(miss)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
+ case PM_DEP_MOD_ANY:
+ break;
+ case PM_DEP_MOD_EQ:
+ MSG(CL, "=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_GE:
+ MSG(CL, ">=%s", alpm_dep_get_version(miss));
+ break;
+ case PM_DEP_MOD_LE:
+ MSG(CL, "<=%s", alpm_dep_get_version(miss));
+ break;
}
MSG(CL, "\n");
}
Index: pacman-lib/src/pacman/trans.c
diff -u pacman-lib/src/pacman/trans.c:1.27 pacman-lib/src/pacman/trans.c:1.28
--- pacman-lib/src/pacman/trans.c:1.27 Fri Jan 19 04:28:46 2007
+++ pacman-lib/src/pacman/trans.c Tue Jan 23 22:02:55 2007
@@ -44,7 +44,7 @@
/* Callback to handle transaction events
*/
-void cb_trans_evt(unsigned char event, void *data1, void *data2)
+void cb_trans_evt(pmtransevt_t event, void *data1, void *data2)
{
char str[LOG_STR_LEN] = "";
char out[PATH_MAX];
@@ -53,38 +53,42 @@
switch(event) {
case PM_TRANS_EVT_CHECKDEPS_START:
pm_fprintf(stderr, NL, _("checking dependencies... "));
- break;
+ break;
case PM_TRANS_EVT_FILECONFLICTS_START:
if(config->noprogressbar) {
MSG(NL, _("checking for file conflicts... "));
}
- break;
+ break;
+ case PM_TRANS_EVT_CLEANUP_START:
+ pm_fprintf(stderr, NL, _("resolving dependencies... "));
+ break;
case PM_TRANS_EVT_RESOLVEDEPS_START:
pm_fprintf(stderr, NL, _("resolving dependencies... "));
- break;
+ break;
case PM_TRANS_EVT_INTERCONFLICTS_START:
pm_fprintf(stderr, NL, _("looking for inter-conflicts... "));
- break;
+ break;
case PM_TRANS_EVT_FILECONFLICTS_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
+ case PM_TRANS_EVT_CLEANUP_DONE:
case PM_TRANS_EVT_RESOLVEDEPS_DONE:
case PM_TRANS_EVT_INTERCONFLICTS_DONE:
pm_fprintf(stderr, CL, _("done.\n"));
- break;
+ break;
case PM_TRANS_EVT_EXTRACT_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_ADD_START:
if(config->noprogressbar) {
MSG(NL, _("installing %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_ADD_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -93,12 +97,12 @@
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_REMOVE_START:
if(config->noprogressbar) {
MSG(NL, _("removing %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_REMOVE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -107,12 +111,12 @@
alpm_pkg_get_name(data1),
alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_UPGRADE_START:
if(config->noprogressbar) {
MSG(NL, _("upgrading %s... "), alpm_pkg_get_name(data1));
}
- break;
+ break;
case PM_TRANS_EVT_UPGRADE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
@@ -122,34 +126,34 @@
(char *)alpm_pkg_get_version(data2),
(char *)alpm_pkg_get_version(data1));
alpm_logaction(str);
- break;
+ break;
case PM_TRANS_EVT_INTEGRITY_START:
MSG(NL, _("checking package integrity... "));
- break;
+ break;
case PM_TRANS_EVT_INTEGRITY_DONE:
MSG(CL, _("done.\n"));
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_INFO:
MSG(NL, "%s\n", (char*)data1);
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_START:
MSG(NL, (char*)data1);
MSG(CL, "...");
- break;
+ break;
case PM_TRANS_EVT_SCRIPTLET_DONE:
if(!(long)data1) {
MSG(CL, _(" done.\n"));
} else {
MSG(CL, _(" failed.\n"));
}
- break;
+ break;
case PM_TRANS_EVT_PRINTURI:
MSG(NL, "%s/%s\n", (char*)data1, (char*)data2);
- break;
+ break;
case PM_TRANS_EVT_RETRIEVE_START:
MSG(NL, _(":: Retrieving packages from %s...\n"), (char*)data1);
fflush(stdout);
- break;
+ break;
case PM_TRANS_EVT_RETRIEVE_LOCAL:
MSG(NL, " %s [", (char*)data1);
unsigned int maxcols = getcols();
@@ -159,11 +163,12 @@
MSG(CL, " ");
}
fputs(_("] 100% LOCAL "), stdout);
- break;
+ break;
}
}
-void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, int *response)
+void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
+ void *data3, int *response)
{
char str[LOG_STR_LEN] = "";
@@ -181,7 +186,7 @@
alpm_pkg_get_name(data2));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_REMOVE_HOLDPKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_REMOVE_HOLDPKG) {
@@ -190,11 +195,11 @@
*response = 0;
}
} else {
- snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
+ snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
alpm_pkg_get_name(data1));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_REPLACE_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_REPLACE_PKG) {
@@ -209,7 +214,7 @@
alpm_pkg_get_name(data2));
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_CONFLICT_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_CONFLICT_PKG) {
@@ -224,7 +229,7 @@
(char *)data2);
*response = yesno(str);
}
- break;
+ break;
case PM_TRANS_CONV_LOCAL_NEWER:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_LOCAL_NEWER) {
@@ -242,7 +247,7 @@
*response = 1;
}
}
- break;
+ break;
case PM_TRANS_CONV_LOCAL_UPTODATE:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_LOCAL_UPTODATE) {
@@ -260,7 +265,7 @@
*response = 1;
}
}
- break;
+ break;
case PM_TRANS_CONV_CORRUPTED_PKG:
if(config->noask) {
if(config->ask & PM_TRANS_CONV_CORRUPTED_PKG) {
@@ -277,11 +282,12 @@
*response = 1;
}
}
- break;
+ break;
}
}
-void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain)
+void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
+ int howmany, int remain)
{
static int lasthash = 0, mouth = 0;
int i, hash;
@@ -311,19 +317,19 @@
switch (event) {
case PM_TRANS_PROGRESS_ADD_START:
ptr = _("installing");
- break;
+ break;
case PM_TRANS_PROGRESS_UPGRADE_START:
ptr = _("upgrading");
- break;
+ break;
case PM_TRANS_PROGRESS_REMOVE_START:
ptr = _("removing");
- break;
+ break;
case PM_TRANS_PROGRESS_CONFLICTS_START:
ptr = _("checking for file conflicts");
- break;
+ break;
}
hash=percent*progresslen/100;
Index: pacman-lib/src/pacman/trans.h
diff -u pacman-lib/src/pacman/trans.h:1.5 pacman-lib/src/pacman/trans.h:1.6
--- pacman-lib/src/pacman/trans.h:1.5 Sun Oct 15 15:34:53 2006
+++ pacman-lib/src/pacman/trans.h Tue Jan 23 22:02:55 2007
@@ -22,12 +22,14 @@
#define _PM_TRANS_H
/* callback to handle messages/notifications from pacman transactions */
-void cb_trans_evt(unsigned char event, void *data1, void *data2);
+void cb_trans_evt(pmtransevt_t event, void *data1, void *data2);
/* callback to handle questions from pacman transactions (yes/no) */
-void cb_trans_conv(unsigned char event, void *data1, void *data2, void *data3, int *response);
+void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
+ void *data3, int *response);
-void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howmany, int remain);
+void cb_trans_progress(pmtransprog_t event, char *pkgname, int percent,
+ int howmany, int remain);
#endif /* _PM_TRANS_H */
More information about the pacman-dev
mailing list