index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | TODO.aaron | 3 | ||||
-rw-r--r-- | lib/libalpm/add.c | 8 | ||||
-rw-r--r-- | lib/libalpm/alpm.c | 52 | ||||
-rw-r--r-- | lib/libalpm/backup.c | 3 | ||||
-rw-r--r-- | lib/libalpm/be_files.c | 20 | ||||
-rw-r--r-- | lib/libalpm/cache.c | 22 | ||||
-rw-r--r-- | lib/libalpm/conflict.c | 12 | ||||
-rw-r--r-- | lib/libalpm/db.c | 13 | ||||
-rw-r--r-- | lib/libalpm/deps.c | 22 | ||||
-rw-r--r-- | lib/libalpm/group.c | 8 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 4 | ||||
-rw-r--r-- | lib/libalpm/log.h | 7 | ||||
-rw-r--r-- | lib/libalpm/md5driver.c | 4 | ||||
-rw-r--r-- | lib/libalpm/package.c | 60 | ||||
-rw-r--r-- | lib/libalpm/provide.c | 3 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 8 | ||||
-rw-r--r-- | lib/libalpm/server.c | 9 | ||||
-rw-r--r-- | lib/libalpm/sha1.c | 4 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 19 | ||||
-rw-r--r-- | lib/libalpm/trans.c | 14 | ||||
-rw-r--r-- | lib/libalpm/util.c | 6 | ||||
-rw-r--r-- | lib/libalpm/versioncmp.c | 4 |
@@ -52,9 +52,6 @@ * pacman: fixup doxygen documentation for public interface -* pacman: use gcc visibility (static) for non-public functions (all _alpm - functions should be static) - **** BUGS **** * Removal of conflicts on -A and -U (INCOMPLETE) * ordering of installed packages based on dependencies diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index d6cef0d2..1efdb042 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -64,6 +64,8 @@ static int add_faketarget(pmtrans_t *trans, char *name) char *str = NULL; pmpkg_t *dummy = NULL; + ALPM_LOG_FUNC; + dummy = _alpm_pkg_new(NULL, NULL); if(dummy == NULL) { RET_ERR(PM_ERR_MEMORY, -1); @@ -113,6 +115,8 @@ int SYMHIDDEN _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) alpm_list_t *i; struct stat buf; + ALPM_LOG_FUNC; + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(name != NULL && strlen(name) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -226,6 +230,8 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) char rm_fname[PATH_MAX]; pmpkg_t *info = NULL; + ALPM_LOG_FUNC; + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); @@ -354,6 +360,8 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db) time_t t; alpm_list_t *targ, *lp; + ALPM_LOG_FUNC; + ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 8d0536f5..77c8f91b 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -103,6 +103,8 @@ int SYMEXPORT alpm_release() { int dbs_left = 0; + ALPM_LOG_FUNC; + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); /* free the transaction if there is any */ @@ -141,6 +143,8 @@ int SYMEXPORT alpm_release() */ pmdb_t SYMEXPORT *alpm_db_register(char *treename) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, NULL)); ASSERT(treename != NULL && strlen(treename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, NULL)); @@ -158,6 +162,8 @@ int alpm_db_unregister(pmdb_t *db) { int found = 0; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); ASSERT(db != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -201,6 +207,8 @@ int alpm_db_setserver(pmdb_t *db, const char *url) { int found = 0; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); @@ -254,6 +262,8 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) char lastupdate[16] = ""; int ret; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -332,6 +342,8 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db) */ pmpkg_t SYMEXPORT *alpm_db_readpkg(pmdb_t *db, char *name) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); @@ -346,6 +358,8 @@ pmpkg_t SYMEXPORT *alpm_db_readpkg(pmdb_t *db, char *name) */ alpm_list_t SYMEXPORT *alpm_db_getpkgcache(pmdb_t *db) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); @@ -360,6 +374,8 @@ alpm_list_t SYMEXPORT *alpm_db_getpkgcache(pmdb_t *db) */ alpm_list_t SYMEXPORT *alpm_db_whatprovides(pmdb_t *db, char *name) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); @@ -375,6 +391,8 @@ alpm_list_t SYMEXPORT *alpm_db_whatprovides(pmdb_t *db, char *name) */ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, char *name) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); @@ -389,6 +407,8 @@ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, char *name) */ alpm_list_t SYMEXPORT *alpm_db_getgrpcache(pmdb_t *db) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); @@ -453,6 +473,8 @@ int alpm_pkg_checksha1sum(pmpkg_t *pkg) char *sha1sum = NULL; int retval = 0; + ALPM_LOG_FUNC; + ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* We only inspect packages from sync repositories */ ASSERT(pkg->origin == PKG_FROM_CACHE, RET_ERR(PM_ERR_PKG_INVALID, -1)); @@ -500,6 +522,8 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg) char *md5sum = NULL; int retval = 0; + ALPM_LOG_FUNC; + ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* We only inspect packages from sync repositories */ ASSERT(pkg->origin == PKG_FROM_CACHE, RET_ERR(PM_ERR_PKG_INVALID, -1)); @@ -545,6 +569,8 @@ int alpm_pkg_checkmd5sum(pmpkg_t *pkg) */ int SYMEXPORT alpm_pkg_vercmp(const char *ver1, const char *ver2) { + ALPM_LOG_FUNC; + return(alpm_versioncmp(ver1, ver2)); } @@ -569,6 +595,8 @@ char SYMEXPORT *alpm_pkg_name_hasarch(char *pkgname) size_t i = 0; char *arch, *cmp, *p; + ALPM_LOG_FUNC; + if((p = strrchr(pkgname, '-'))) { for(i=0; i < sizeof(_supported_archs)/sizeof(char*); ++i) { cmp = p+1; @@ -598,6 +626,8 @@ char SYMEXPORT *alpm_pkg_name_hasarch(char *pkgname) */ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(handle->needles != NULL, return(NULL)); @@ -628,6 +658,8 @@ int SYMEXPORT alpm_trans_init(pmtranstype_t type, unsigned int flags, { char path[PATH_MAX]; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); @@ -655,6 +687,8 @@ int SYMEXPORT alpm_trans_sysupgrade() { pmtrans_t *trans; + ALPM_LOG_FUNC; + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); trans = handle->trans; @@ -673,6 +707,8 @@ int SYMEXPORT alpm_trans_addtarget(char *target) { pmtrans_t *trans; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); ASSERT(target != NULL && strlen(target) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -691,6 +727,8 @@ int SYMEXPORT alpm_trans_addtarget(char *target) */ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -708,6 +746,8 @@ int SYMEXPORT alpm_trans_prepare(alpm_list_t **data) */ int SYMEXPORT alpm_trans_commit(alpm_list_t **data) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); @@ -731,6 +771,8 @@ int SYMEXPORT alpm_trans_release() pmtrans_t *trans; char path[PATH_MAX]; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); @@ -779,6 +821,8 @@ int SYMEXPORT alpm_logaction(char *fmt, ...) char str[LOG_STR_LEN]; va_list args; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); @@ -814,6 +858,8 @@ int SYMEXPORT alpm_logaction(char *fmt, ...) */ char SYMEXPORT *alpm_get_md5sum(char *name) { + ALPM_LOG_FUNC; + ASSERT(name != NULL, return(NULL)); return(_alpm_MDFile(name)); @@ -825,6 +871,8 @@ char SYMEXPORT *alpm_get_md5sum(char *name) */ char SYMEXPORT *alpm_get_sha1sum(char *name) { + ALPM_LOG_FUNC; + ASSERT(name != NULL, return(NULL)); return(_alpm_SHAFile(name)); @@ -836,6 +884,8 @@ char SYMEXPORT *alpm_get_sha1sum(char *name) */ char SYMEXPORT *alpm_fetch_pkgurl(char *url) { + ALPM_LOG_FUNC; + ASSERT(strstr(url, "://"), return(NULL)); return(_alpm_fetch_pkgurl(url)); @@ -857,6 +907,8 @@ int SYMEXPORT alpm_parse_config(char *file, alpm_cb_db_register callback, const char section[256] = ""; pmdb_t *db = NULL; + ALPM_LOG_FUNC; + fp = fopen(file, "r"); if(fp == NULL) { return(0); diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c index dbe6d625..3750f7db 100644 --- a/lib/libalpm/backup.c +++ b/lib/libalpm/backup.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <string.h> /* pacman */ +#include "log.h" #include "backup.h" #include "util.h" @@ -36,6 +37,8 @@ char *_alpm_needbackup(char *file, alpm_list_t *backup) { alpm_list_t *lp; + ALPM_LOG_FUNC; + if(file == NULL || backup == NULL) { return(NULL); } diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 65a5fc71..986d9189 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -51,6 +51,8 @@ */ int _alpm_db_install(pmdb_t *db, const char *dbfile) { + ALPM_LOG_FUNC; + /* ORE we should not simply unpack the archive, but better parse it and db_write each entry (see sync_load_dbarchive to get archive content) */ @@ -65,6 +67,8 @@ int _alpm_db_install(pmdb_t *db, const char *dbfile) int _alpm_db_open(pmdb_t *db) { + ALPM_LOG_FUNC; + if(db == NULL) { RET_ERR(PM_ERR_DB_NULL, -1); } @@ -79,6 +83,8 @@ int _alpm_db_open(pmdb_t *db) void _alpm_db_close(pmdb_t *db) { + ALPM_LOG_FUNC; + if(db == NULL) { return; } @@ -91,6 +97,8 @@ void _alpm_db_close(pmdb_t *db) void _alpm_db_rewind(pmdb_t *db) { + ALPM_LOG_FUNC; + if(db == NULL || db->handle == NULL) { return; } @@ -108,6 +116,8 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, char *target, pmdbinfrq_t inforeq) int found = 0; pmpkg_t *pkg; + ALPM_LOG_FUNC; + if(db == NULL) { RET_ERR(PM_ERR_DB_NULL, NULL); } @@ -184,6 +194,8 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info) alpm_list_t *tmplist; char *locale; + ALPM_LOG_FUNC; + if(db == NULL) { RET_ERR(PM_ERR_DB_NULL, -1); } @@ -452,6 +464,8 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq) int retval = 0; int local = 0; + ALPM_LOG_FUNC; + if(db == NULL || info == NULL) { return(-1); } @@ -650,6 +664,8 @@ int _alpm_db_remove(pmdb_t *db, pmpkg_t *info) { char path[PATH_MAX]; + ALPM_LOG_FUNC; + if(db == NULL || info == NULL) { RET_ERR(PM_ERR_DB_NULL, -1); } @@ -673,6 +689,8 @@ int _alpm_db_getlastupdate(pmdb_t *db, char *ts) FILE *fp; char file[PATH_MAX]; + ALPM_LOG_FUNC; + if(db == NULL || ts == NULL) { return(-1); } @@ -703,6 +721,8 @@ int _alpm_db_setlastupdate(pmdb_t *db, char *ts) FILE *fp; char file[PATH_MAX]; + ALPM_LOG_FUNC; + if(db == NULL || ts == NULL || strlen(ts) == 0) { return(-1); } diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c index 61633a1a..41b23c36 100644 --- a/lib/libalpm/cache.c +++ b/lib/libalpm/cache.c @@ -48,6 +48,8 @@ int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel) /* The group cache needs INFRQ_DESC as well */ /* pmdbinfrq_t infolevel = INFRQ_DEPENDS | INFRQ_DESC;*/ + ALPM_LOG_FUNC; + if(db == NULL) { return(-1); } @@ -72,6 +74,8 @@ int _alpm_db_load_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel) void _alpm_db_free_pkgcache(pmdb_t *db) { + ALPM_LOG_FUNC; + if(db == NULL || db->pkgcache == NULL) { return; } @@ -88,6 +92,8 @@ void _alpm_db_free_pkgcache(pmdb_t *db) alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel) { + ALPM_LOG_FUNC; + if(db == NULL) { return(NULL); } @@ -108,6 +114,8 @@ int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel) * info is not already cached */ + ALPM_LOG_FUNC; + alpm_list_t *p; for(p = db->pkgcache; p; p = p->next) { pmpkg_t *pkg = (pmpkg_t *)p->data; @@ -132,6 +140,8 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg) { pmpkg_t *newpkg; + ALPM_LOG_FUNC; + if(db == NULL || pkg == NULL) { return(-1); } @@ -153,6 +163,8 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg) void *vdata; pmpkg_t *data; + ALPM_LOG_FUNC; + if(db == NULL || pkg == NULL) { return(-1); } @@ -174,6 +186,8 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg) pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, char *target) { + ALPM_LOG_FUNC; + if(db == NULL) { return(NULL); } @@ -187,6 +201,8 @@ int _alpm_db_load_grpcache(pmdb_t *db) { alpm_list_t *lp; + ALPM_LOG_FUNC; + if(db == NULL) { return(-1); } @@ -231,6 +247,8 @@ void _alpm_db_free_grpcache(pmdb_t *db) { alpm_list_t *lg; + ALPM_LOG_FUNC; + if(db == NULL || db->grpcache == NULL) { return; } @@ -246,6 +264,8 @@ void _alpm_db_free_grpcache(pmdb_t *db) alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db) { + ALPM_LOG_FUNC; + if(db == NULL) { return(NULL); } @@ -261,6 +281,8 @@ pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, char *target) { alpm_list_t *i; + ALPM_LOG_FUNC; + if(db == NULL || target == NULL || strlen(target) == 0) { return(NULL); } diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 96d4fd01..33ab6a43 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -57,6 +57,8 @@ alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages) alpm_list_t *baddeps = NULL; pmdepmissing_t *miss = NULL; + ALPM_LOG_FUNC; + if(db == NULL) { return(NULL); } @@ -220,6 +222,8 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, a alpm_list_t *targets = trans->packages; double percent; + ALPM_LOG_FUNC; + if(db == NULL || targets == NULL || root == NULL) { return(NULL); } @@ -362,6 +366,8 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, a const char SYMEXPORT *alpm_conflict_get_target(pmconflict_t *conflict) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(conflict != NULL, return(NULL)); @@ -371,6 +377,8 @@ const char SYMEXPORT *alpm_conflict_get_target(pmconflict_t *conflict) pmconflicttype_t SYMEXPORT alpm_conflict_get_type(pmconflict_t *conflict) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(conflict != NULL, return(-1)); @@ -380,6 +388,8 @@ pmconflicttype_t SYMEXPORT alpm_conflict_get_type(pmconflict_t *conflict) const char SYMEXPORT *alpm_conflict_get_file(pmconflict_t *conflict) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(conflict != NULL, return(NULL)); @@ -389,6 +399,8 @@ const char SYMEXPORT *alpm_conflict_get_file(pmconflict_t *conflict) const char SYMEXPORT *alpm_conflict_get_ctarget(pmconflict_t *conflict) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(conflict != NULL, return(NULL)); diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index cafd74fa..a4c5e198 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -55,6 +55,8 @@ pmdb_t *_alpm_db_new(char *root, char* dbpath, char *treename) { pmdb_t *db; + ALPM_LOG_FUNC; + db = calloc(1, sizeof(pmdb_t)); if(db == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failed: could not allocate %d bytes"), @@ -80,6 +82,8 @@ void _alpm_db_free(void *data) { pmdb_t *db = data; + ALPM_LOG_FUNC; + FREELISTSERVERS(db->servers); FREE(db->path); FREE(db); @@ -89,6 +93,7 @@ void _alpm_db_free(void *data) int _alpm_db_cmp(const void *db1, const void *db2) { + ALPM_LOG_FUNC; return(strcmp(((pmdb_t *)db1)->treename, ((pmdb_t *)db2)->treename)); } @@ -96,6 +101,8 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles) { alpm_list_t *i, *j, *k, *ret = NULL; + ALPM_LOG_FUNC; + for(i = needles; i; i = i->next) { char *targ; @@ -149,6 +156,8 @@ pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback) pmdb_t *db; char path[PATH_MAX]; + ALPM_LOG_FUNC; + if(strcmp(treename, "local") == 0) { if(handle->db_local != NULL) { _alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB")); @@ -201,6 +210,8 @@ pmdb_t *_alpm_db_register(char *treename, alpm_cb_db_register callback) const char SYMEXPORT *alpm_db_get_name(pmdb_t *db) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); @@ -213,6 +224,8 @@ const char *alpm_db_get_url(pmdb_t *db) char path[PATH_MAX]; pmserver_t *s; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(db != NULL, return(NULL)); diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index a8e59f00..285031e7 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -50,6 +50,8 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type, { pmdepmissing_t *miss; + ALPM_LOG_FUNC; + miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t)); if(miss == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t)); @@ -73,6 +75,8 @@ int _alpm_depmiss_isin(pmdepmissing_t *needle, alpm_list_t *haystack) { alpm_list_t *i; + ALPM_LOG_FUNC; + for(i = haystack; i; i = i->next) { pmdepmissing_t *miss = i->data; if(!memcmp(needle, miss, sizeof(pmdepmissing_t)) @@ -108,6 +112,8 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, int mode) int numtargs = 0; int maxscans; + ALPM_LOG_FUNC; + if(targets == NULL) { return(NULL); } @@ -196,6 +202,8 @@ alpm_list_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, pmtranstype_t op, alpm_list_t *baddeps = NULL; pmdepmissing_t *miss = NULL; + ALPM_LOG_FUNC; + if(db == NULL) { return(NULL); } @@ -439,6 +447,8 @@ alpm_list_t *_alpm_removedeps(pmdb_t *db, alpm_list_t *targs) alpm_list_t *i, *j, *k; alpm_list_t *newtargs = targs; + ALPM_LOG_FUNC; + if(db == NULL) { return(newtargs); } @@ -527,6 +537,8 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, alpm_list_t *targ; alpm_list_t *deps = NULL; + ALPM_LOG_FUNC; + if(local == NULL || dbs_sync == NULL || syncpkg == NULL) { return(-1); } @@ -648,6 +660,8 @@ error: const char SYMEXPORT *alpm_dep_get_target(pmdepmissing_t *miss) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(miss != NULL, return(NULL)); @@ -657,6 +671,8 @@ const char SYMEXPORT *alpm_dep_get_target(pmdepmissing_t *miss) pmdeptype_t SYMEXPORT alpm_dep_get_type(pmdepmissing_t *miss) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(miss != NULL, return(-1)); @@ -666,6 +682,8 @@ pmdeptype_t SYMEXPORT alpm_dep_get_type(pmdepmissing_t *miss) pmdepmod_t SYMEXPORT alpm_dep_get_mod(pmdepmissing_t *miss) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(miss != NULL, return(-1)); @@ -675,6 +693,8 @@ pmdepmod_t SYMEXPORT alpm_dep_get_mod(pmdepmissing_t *miss) const char SYMEXPORT *alpm_dep_get_name(pmdepmissing_t *miss) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(miss != NULL, return(NULL)); @@ -684,6 +704,8 @@ const char SYMEXPORT *alpm_dep_get_name(pmdepmissing_t *miss) const char SYMEXPORT *alpm_dep_get_version(pmdepmissing_t *miss) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(miss != NULL, return(NULL)); diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c index 922443ed..2068b02a 100644 --- a/lib/libalpm/group.c +++ b/lib/libalpm/group.c @@ -36,6 +36,8 @@ pmgrp_t *_alpm_grp_new() { pmgrp_t* grp; + ALPM_LOG_FUNC; + grp = calloc(1, sizeof(pmgrp_t)); if(grp == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), @@ -50,6 +52,8 @@ void _alpm_grp_free(void *data) { pmgrp_t *grp = data; + ALPM_LOG_FUNC; + if(grp == NULL) { return; } @@ -72,6 +76,8 @@ int _alpm_grp_cmp(const void *g1, const void *g2) const char SYMEXPORT *alpm_grp_get_name(pmgrp_t *grp) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(grp != NULL, return(NULL)); @@ -80,6 +86,8 @@ const char SYMEXPORT *alpm_grp_get_name(pmgrp_t *grp) alpm_list_t SYMEXPORT *alpm_grp_get_packages(pmgrp_t *grp) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(grp != NULL, return(NULL)); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index a8563a17..140fe328 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -85,6 +85,8 @@ pmhandle_t *_alpm_handle_new() int _alpm_handle_free(pmhandle_t *handle) { + ALPM_LOG_FUNC; + ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); /* close logfiles */ @@ -166,6 +168,8 @@ void alpm_option_set_cachedir(const char *cachedir) void alpm_option_set_logfile(const char *logfile) { + ALPM_LOG_FUNC; + if(handle->logfile) { FREE(handle->logfile); if(handle->logfd) { diff --git a/lib/libalpm/log.h b/lib/libalpm/log.h index 471f4b79..eb0b718d 100644 --- a/lib/libalpm/log.h +++ b/lib/libalpm/log.h @@ -25,6 +25,13 @@ #define LOG_STR_LEN 1024 +#ifdef PACMAN_DEBUG +/* Log funtion entry points if debugging is enabled */ +#define ALPM_LOG_FUNC _alpm_log(PM_LOG_FUNCTION, "Enter %s", __func__) +#else +#define ALPM_LOG_FUNC +#endif + void _alpm_log(pmloglevel_t flag, char *fmt, ...); #endif /* _ALPM_LOG_H */ diff --git a/lib/libalpm/md5driver.c b/lib/libalpm/md5driver.c index 2cd950ef..2effa5f7 100644 --- a/lib/libalpm/md5driver.c +++ b/lib/libalpm/md5driver.c @@ -23,6 +23,8 @@ documentation and/or software. #include <stdio.h> #include <string.h> #include <libintl.h> +#include "alpm.h" +#include "log.h" #include "util.h" #include "md5.h" @@ -43,6 +45,8 @@ char* _alpm_MDFile(char *filename) int len; unsigned char buffer[1024], digest[16]; + ALPM_LOG_FUNC; + if((file = fopen(filename, "rb")) == NULL) { printf (_("%s can't be opened\n"), filename); } else { diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 5a0106cf..e92ba571 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -44,6 +44,8 @@ pmpkg_t *_alpm_pkg_new(const char *name, const char *version) { pmpkg_t* pkg; + ALPM_LOG_FUNC; + if((pkg = calloc(1,sizeof(pmpkg_t))) == NULL) { RET_ERR(PM_ERR_MEMORY, NULL); } @@ -66,6 +68,8 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg) { pmpkg_t* newpkg; + ALPM_LOG_FUNC; + if((newpkg = calloc(1, sizeof(pmpkg_t))) == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmpkg_t)); RET_ERR(PM_ERR_MEMORY, NULL); @@ -93,6 +97,8 @@ void _alpm_pkg_free(void *data) { pmpkg_t *pkg = data; + ALPM_LOG_FUNC; + if(pkg == NULL) { return; } @@ -136,6 +142,8 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output) char* key = NULL; int linenum = 0; + ALPM_LOG_FUNC; + if((fp = fopen(descfile, "r")) == NULL) { _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), descfile, strerror(errno)); return(-1); @@ -239,6 +247,8 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile) char *descfile = NULL; int fd = -1; + ALPM_LOG_FUNC; + if(pkgfile == NULL || strlen(pkgfile) == 0) { RET_ERR(PM_ERR_WRONG_ARGS, NULL); } @@ -375,6 +385,8 @@ pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack) { alpm_list_t *lp; + ALPM_LOG_FUNC; + if(needle == NULL || haystack == NULL) { return(NULL); } @@ -394,6 +406,8 @@ int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch) char tmp[PKG_FULLNAME_LEN+7]; char *p, *q; + ALPM_LOG_FUNC; + if(target == NULL) { return(-1); } @@ -441,6 +455,8 @@ int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch) const char *alpm_pkg_get_filename(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -477,6 +493,8 @@ const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -489,6 +507,8 @@ const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -501,6 +521,8 @@ const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_builddate(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -525,6 +547,8 @@ const char SYMEXPORT *alpm_pkg_get_buildtype(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_installdate(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -537,6 +561,8 @@ const char SYMEXPORT *alpm_pkg_get_installdate(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -549,6 +575,8 @@ const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -561,6 +589,8 @@ const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_sha1sum(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -573,6 +603,8 @@ const char SYMEXPORT *alpm_pkg_get_sha1sum(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -585,6 +617,8 @@ const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg) unsigned long SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(pkg != NULL, return(-1)); @@ -597,6 +631,8 @@ unsigned long SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg) unsigned long SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(pkg != NULL, return(-1)); @@ -609,6 +645,8 @@ unsigned long SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg) pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(pkg != NULL, return(-1)); @@ -621,6 +659,8 @@ pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -633,6 +673,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -646,6 +688,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg) /* depends */ alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -658,6 +702,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_removes(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -670,6 +716,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_removes(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_requiredby(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -682,6 +730,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_requiredby(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -694,6 +744,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -706,6 +758,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -718,6 +772,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -731,6 +787,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg) alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(NULL)); ASSERT(pkg != NULL, return(NULL)); @@ -744,6 +802,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg) unsigned short SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(handle != NULL, return(-1)); ASSERT(pkg != NULL, return(-1)); diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c index 0624d057..6ddc894c 100644 --- a/lib/libalpm/provide.c +++ b/lib/libalpm/provide.c @@ -26,6 +26,7 @@ #include "cache.h" #include "alpm_list.h" #include "db.h" +#include "log.h" #include "provide.h" /* return a alpm_list_t of packages in "db" that provide "package" @@ -35,6 +36,8 @@ alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, char *package) alpm_list_t *pkgs = NULL; alpm_list_t *lp; + ALPM_LOG_FUNC; + if(db == NULL || package == NULL || strlen(package) == 0) { return(NULL); } diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 8621db79..85e2043b 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -63,6 +63,8 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) { pmpkg_t *info; + ALPM_LOG_FUNC; + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -97,6 +99,8 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data) { alpm_list_t *lp; + ALPM_LOG_FUNC; + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); @@ -171,6 +175,8 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ, char line[PATH_MAX+1]; char *checksum = _alpm_needbackup(lp->data, info->backup); + ALPM_LOG_FUNC; + if ( *position != 0 ) { percent = (double)*position / filenum; } if ( checksum ) { @@ -240,6 +246,8 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db) pmpkg_t *info; alpm_list_t *targ, *lp; + ALPM_LOG_FUNC; + ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c index bfff9fdf..f998b1e8 100644 --- a/lib/libalpm/server.c +++ b/lib/libalpm/server.c @@ -43,6 +43,8 @@ pmserver_t *_alpm_server_new(const char *url) struct url *u; pmserver_t *server; + ALPM_LOG_FUNC; + server = (pmserver_t *)malloc(sizeof(pmserver_t)); if(server == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmserver_t)); @@ -78,6 +80,8 @@ void _alpm_server_free(void *data) { pmserver_t *server = data; + ALPM_LOG_FUNC; + if(server == NULL) { return; } @@ -96,6 +100,7 @@ void _alpm_server_free(void *data) */ int _alpm_downloadfiles(alpm_list_t *servers, const char *localpath, alpm_list_t *files) { + ALPM_LOG_FUNC; return(_alpm_downloadfiles_forreal(servers, localpath, files, NULL, NULL)); } @@ -121,6 +126,8 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath, alpm_list_t *complete = NULL; alpm_list_t *i; + ALPM_LOG_FUNC; + if(files == NULL) { return(0); } @@ -324,6 +331,8 @@ char *_alpm_fetch_pkgurl(char *target) struct stat st; struct url *s_url; + ALPM_LOG_FUNC; + s_url = downloadParseURL(target); if(!s_url) { _alpm_log(PM_LOG_ERROR, _("url '%s' is invalid, ignoring"), target); diff --git a/lib/libalpm/sha1.c b/lib/libalpm/sha1.c index a2caa72b..cf1831ea 100644 --- a/lib/libalpm/sha1.c +++ b/lib/libalpm/sha1.c @@ -27,6 +27,8 @@ #endif #include <libintl.h> +#include "alpm.h" +#include "log.h" #include "util.h" #include "sha1.h" @@ -390,6 +392,8 @@ char* _alpm_SHAFile(char *filename) { unsigned char buffer[1024], digest[20]; char *ret; + ALPM_LOG_FUNC; + if((file = fopen(filename, "rb")) == NULL) { fprintf(stderr, _("%s can't be opened\n"), filename); } else { diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index a3e8e1fd..763a2087 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -59,6 +59,8 @@ pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data) { pmsyncpkg_t *sync; + ALPM_LOG_FUNC; + if((sync = (pmsyncpkg_t *)malloc(sizeof(pmsyncpkg_t))) == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmsyncpkg_t)); return(NULL); @@ -75,6 +77,8 @@ void _alpm_sync_free(void *data) { pmsyncpkg_t *sync = data; + ALPM_LOG_FUNC; + if(sync == NULL) { return; } @@ -96,6 +100,8 @@ static pmsyncpkg_t *find_pkginsync(char *needle, alpm_list_t *haystack) pmsyncpkg_t *sync = NULL; int found = 0; + ALPM_LOG_FUNC; + for(i = haystack; i && !found; i = i->next) { sync = i->data; if(sync && !strcmp(sync->pkg->name, needle)) { @@ -112,6 +118,9 @@ static pmsyncpkg_t *find_pkginsync(char *needle, alpm_list_t *haystack) static int istoonew(pmpkg_t *pkg) { time_t t; + + ALPM_LOG_FUNC; + if (!handle->upgradedelay) return 0; time(&t); @@ -126,6 +135,8 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local, { alpm_list_t *i, *j, *k; + ALPM_LOG_FUNC; + /* check for "recommended" package replacements */ _alpm_log(PM_LOG_FLOW1, _("checking for package replacements")); for(i = dbs_sync; i; i = i->next) { @@ -191,6 +202,8 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s { alpm_list_t *i, *j; + ALPM_LOG_FUNC; + /* check for "recommended" package replacements */ _alpm_log(PM_LOG_FLOW1, _("checking for package replacements")); if( find_replacements(trans, db_local, dbs_sync) == 0 ) { @@ -281,6 +294,8 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy pmsyncpkg_t *sync; int cmp, repo_found = 0; + ALPM_LOG_FUNC; + ASSERT(db_local != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(name != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -403,6 +418,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync alpm_list_t *i, *j, *k, *l; int ret = 0; + ALPM_LOG_FUNC; + ASSERT(db_local != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); @@ -788,6 +805,8 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) char ldir[PATH_MAX]; int varcache = 1; + ALPM_LOG_FUNC; + ASSERT(db_local != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 601373d7..12035408 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -43,6 +43,8 @@ pmtrans_t *_alpm_trans_new() { pmtrans_t *trans; + ALPM_LOG_FUNC; + if((trans = (pmtrans_t *)malloc(sizeof(pmtrans_t))) == NULL) { _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmtrans_t)); return(NULL); @@ -65,6 +67,8 @@ void _alpm_trans_free(void *data) { pmtrans_t *trans = data; + ALPM_LOG_FUNC; + if(trans == NULL) { return; } @@ -89,6 +93,8 @@ 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) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); @@ -104,6 +110,8 @@ int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags, int _alpm_trans_sysupgrade(pmtrans_t *trans) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); @@ -112,6 +120,8 @@ int _alpm_trans_sysupgrade(pmtrans_t *trans) int _alpm_trans_addtarget(pmtrans_t *trans, char *target) { + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(target != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); @@ -151,6 +161,8 @@ int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data) { *data = NULL; + ALPM_LOG_FUNC; + /* Sanity checks */ ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); @@ -188,6 +200,8 @@ int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data) int _alpm_trans_commit(pmtrans_t *trans, alpm_list_t **data) { + ALPM_LOG_FUNC; + if(data!=NULL) *data = NULL; diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 29d3ad56..e9d0cbe0 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -266,6 +266,8 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn) struct archive_entry *entry; char expath[PATH_MAX]; + ALPM_LOG_FUNC; + if((_archive = archive_read_new()) == NULL) RET_ERR(PM_ERR_LIBARCHIVE_ERROR, -1); @@ -422,6 +424,8 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha pid_t pid; int retval = 0; + ALPM_LOG_FUNC; + if(stat(installfn, &buf)) { /* not found */ return(0); @@ -569,6 +573,8 @@ int _alpm_check_freespace(pmtrans_t *trans, alpm_list_t **data) alpm_list_t *i; long long pkgsize=0, freespace; + ALPM_LOG_FUNC; + for(i = trans->packages; i; i = i->next) { if(trans->type == PM_TRANS_TYPE_SYNC) { diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c index dffdf03d..0cc9e78c 100644 --- a/lib/libalpm/versioncmp.c +++ b/lib/libalpm/versioncmp.c @@ -158,6 +158,8 @@ int SYMEXPORT alpm_versioncmp(const char *a, const char *b) int is1num, is2num; int rc; + ALPM_LOG_FUNC; + if(!strcmp(a,b)) { return(0); } @@ -247,6 +249,8 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) { int equal = 0; + ALPM_LOG_FUNC; + if(strcmp(pkg->name, dep->name) == 0 || alpm_list_find_str(pkg->provides, dep->name)) { if(dep->mod == PM_DEP_MOD_ANY) { |