Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-11-22 09:03:41 +0000
committerAaron Griffin <aaron@archlinux.org>2006-11-22 09:03:41 +0000
commit986409f9bd7b84e63352b9ec1f825b0c917627a6 (patch)
treef74350bb415326724e86408985ea0d43fe93c7b0
parent54691771831c97c7366bf8ee7c54da3952c22120 (diff)
* Completed getinfo api changes (pmmissing_t, pmtrans_t, etc)
* Modified some dependancy checking * Changed "performing local database upgrade" message to be more clear * Change 'usize' to 'isize' in database files * Scriptlet output is now sent to pacman's log file * Limited some debugging output to be more clear
-rw-r--r--lib/libalpm/alpm.c73
-rw-r--r--lib/libalpm/alpm.h43
-rw-r--r--lib/libalpm/be_files.c27
-rw-r--r--lib/libalpm/conflict.c37
-rw-r--r--lib/libalpm/deps.c141
-rw-r--r--lib/libalpm/deps.h1
-rw-r--r--lib/libalpm/package.c56
-rw-r--r--lib/libalpm/package.h5
-rw-r--r--lib/libalpm/sync.c19
-rw-r--r--lib/libalpm/trans.c35
-rw-r--r--lib/libalpm/util.c15
-rw-r--r--lib/libalpm/util.h4
-rw-r--r--lib/libalpm/versioncmp.c43
-rw-r--r--lib/libalpm/versioncmp.h4
-rw-r--r--src/pacman/add.c26
-rw-r--r--src/pacman/deptest.c14
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/query.c11
-rw-r--r--src/pacman/remove.c6
-rw-r--r--src/pacman/sync.c42
-rw-r--r--src/util/Makefile.am1
-rw-r--r--src/util/vercmp.c3
22 files changed, 313 insertions, 295 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 49cfd0cd..1bda976c 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -613,34 +613,6 @@ pmlist_t *alpm_db_search(pmdb_t *db)
* @{
*/
-/** Get informations about the transaction.
- * @param parm name of the info to get
- * @return a void* on success (the value), NULL on error
- */
-void *alpm_trans_getinfo(unsigned char parm)
-{
- pmtrans_t *trans;
- void *data;
-
- /* Sanity checks */
- ASSERT(handle != NULL, return(NULL));
- ASSERT(handle->trans != NULL, return(NULL));
-
- trans = handle->trans;
-
- switch(parm) {
- case PM_TRANS_TYPE: data = (void *)(long)trans->type; break;
- case PM_TRANS_FLAGS: data = (void *)(long)trans->flags; break;
- case PM_TRANS_TARGETS: data = trans->targets; break;
- case PM_TRANS_PACKAGES: data = trans->packages; break;
- default:
- data = NULL;
- break;
- }
-
- return(data);
-}
-
/** Initialize the transaction.
* @param type type of the transaction
* @param flags flags of the transaction (like nodeps, etc)
@@ -790,32 +762,6 @@ int alpm_trans_release()
* @brief Functions to get informations about a libalpm dependency
* @{
*/
-
-/** Get informations about a dependency.
- * @param miss dependency pointer
- * @param parm name of the info to get
- * @return a void* on success (the value), NULL on error
- */
-void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm)
-{
- void *data;
-
- /* Sanity checks */
- ASSERT(miss != NULL, return(NULL));
-
- switch(parm) {
- case PM_DEP_TARGET: data = (void *)(long)miss->target; break;
- case PM_DEP_TYPE: data = (void *)(long)miss->type; break;
- case PM_DEP_MOD: data = (void *)(long)miss->depend.mod; break;
- case PM_DEP_NAME: data = miss->depend.name; break;
- case PM_DEP_VERSION: data = miss->depend.version; break;
- default:
- data = NULL;
- break;
- }
-
- return(data);
-}
/** @} */
/** \addtogroup alpm_conflict File Conflicts Functions
@@ -828,25 +774,6 @@ void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm)
* @param parm name of the info to get
* @return a void* on success (the value), NULL on error
*/
-void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm)
-{
- void *data;
-
- /* Sanity checks */
- ASSERT(conflict != NULL, return(NULL));
-
- switch(parm) {
- case PM_CONFLICT_TARGET: data = conflict->target; break;
- case PM_CONFLICT_TYPE: data = (void *)(long)conflict->type; break;
- case PM_CONFLICT_FILE: data = conflict->file; break;
- case PM_CONFLICT_CTARGET: data = conflict->ctarget; break;
- default:
- data = NULL;
- break;
- }
-
- return(data);
-}
/** @} */
/** \addtogroup alpm_log Logging Functions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 3b5126b1..2f35ad6f 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -200,6 +200,7 @@ int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this
int alpm_pkg_vercmp(const char *ver1, const char *ver2);
char *alpm_pkg_name_hasarch(char *pkgname);
+const char *alpm_pkg_get_filename(pmpkg_t *pkg);
const char *alpm_pkg_get_name(pmpkg_t *pkg);
const char *alpm_pkg_get_version(pmpkg_t *pkg);
const char *alpm_pkg_get_desc(pmpkg_t *pkg);
@@ -212,7 +213,7 @@ const char *alpm_pkg_get_md5sum(pmpkg_t *pkg);
const char *alpm_pkg_get_sha1sum(pmpkg_t *pkg);
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
-unsigned long alpm_pkg_get_usize(pmpkg_t *pkg);
+unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
pmlist_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
pmlist_t *alpm_pkg_get_groups(pmpkg_t *pkg);
@@ -331,15 +332,10 @@ typedef void (*alpm_trans_cb_conv)(unsigned char, void *, void *, void *, int *)
/* Transaction Progress callback */
typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
-/* Info parameters */
-enum {
- PM_TRANS_TYPE = 1,
- PM_TRANS_FLAGS,
- PM_TRANS_TARGETS,
- PM_TRANS_PACKAGES
-};
-
-void *alpm_trans_getinfo(unsigned char parm);
+unsigned char alpm_trans_get_type();
+unsigned int alpm_trans_get_flags();
+pmlist_t * alpm_trans_get_targets();
+pmlist_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_sysupgrade(void);
int alpm_trans_addtarget(char *target);
@@ -362,16 +358,12 @@ enum {
PM_DEP_TYPE_REQUIRED,
PM_DEP_TYPE_CONFLICT
};
-/* Info parameters */
-enum {
- PM_DEP_TARGET = 1,
- PM_DEP_TYPE,
- PM_DEP_MOD,
- PM_DEP_NAME,
- PM_DEP_VERSION
-};
-void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm);
+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);
+const char *alpm_dep_get_name(pmdepmissing_t *miss);
+const char *alpm_dep_get_version(pmdepmissing_t *miss);
/*
* File conflicts
@@ -381,15 +373,11 @@ enum {
PM_CONFLICT_TYPE_TARGET = 1,
PM_CONFLICT_TYPE_FILE
};
-/* Info parameters */
-enum {
- PM_CONFLICT_TARGET = 1,
- PM_CONFLICT_TYPE,
- PM_CONFLICT_FILE,
- PM_CONFLICT_CTARGET
-};
-void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm);
+const char *alpm_conflict_get_target(pmconflict_t *conflict);
+unsigned char 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
@@ -398,6 +386,7 @@ void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm);
/* pmlist_t */
pmlist_t *alpm_list_first(pmlist_t *list);
pmlist_t *alpm_list_next(pmlist_t *entry);
+#define alpm_list_data(type, list) (type)alpm_list_getdata((list))
void *alpm_list_getdata(const pmlist_t *entry);
int alpm_list_free(pmlist_t *entry);
int alpm_list_free_outer(pmlist_t *entry);
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 33dd78b5..ccd0b246 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -198,6 +198,10 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
return(-1);
}
+ if(info->infolevel & inforeq) {
+ /* already loaded this info, do nothing */
+ return(0);
+ }
_alpm_log(PM_LOG_FUNCTION, _("loading package data for %s : level=%d"), info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
@@ -223,7 +227,16 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
break;
}
_alpm_strtrim(line);
- if(!strcmp(line, "%DESC%")) {
+ if(!strcmp(line, "%FILENAME%")) {
+ /* filename is _new_ - it provides the real name of the package, on the
+ * server, to allow for us to not tie the name of the actual file to the
+ * data of the package
+ */
+ if(fgets(info->filename, sizeof(info->filename), fp) == NULL) {
+ goto error;
+ }
+ _alpm_strtrim(info->filename);
+ } else if(!strcmp(line, "%DESC%")) {
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
info->desc_localized = _alpm_list_add(info->desc_localized, strdup(line));
}
@@ -305,15 +318,15 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
}
_alpm_strtrim(tmp);
info->size = atol(tmp);
- } else if(!strcmp(line, "%USIZE%")) {
- /* USIZE (uncompressed size) tag only appears in sync repositories,
+ } else if(!strcmp(line, "%ISIZE%")) {
+ /* ISIZE (installed size) tag only appears in sync repositories,
* not the local one. */
char tmp[32];
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
goto error;
}
_alpm_strtrim(tmp);
- info->usize = atol(tmp);
+ info->isize = atol(tmp);
} else if(!strcmp(line, "%SHA1SUM%")) {
/* SHA1SUM tag only appears in sync repositories,
* not the local one. */
@@ -525,9 +538,9 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
fprintf(fp, "%%CSIZE%%\n"
"%ld\n\n", info->size);
}
- if(info->usize) {
- fprintf(fp, "%%USIZE%%\n"
- "%ld\n\n", info->usize);
+ if(info->isize) {
+ fprintf(fp, "%%ISIZE%%\n"
+ "%ld\n\n", info->isize);
}
if(info->sha1sum) {
fprintf(fp, "%%SHA1SUM%%\n"
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 57323c30..c9649e40 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -29,12 +29,14 @@
#include "config.h"
#include <stdlib.h>
+#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <sys/stat.h>
#include <libintl.h>
/* pacman */
+#include "handle.h"
#include "list.h"
#include "trans.h"
#include "util.h"
@@ -353,4 +355,39 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
return(conflicts);
}
+const char *alpm_conflict_get_target(pmconflict_t *conflict)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(conflict != NULL, return(NULL));
+
+ return conflict->target;
+}
+
+unsigned char alpm_conflict_get_type(pmconflict_t *conflict)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(-1));
+ ASSERT(conflict != NULL, return(-1));
+
+ return conflict->type;
+}
+
+const char *alpm_conflict_get_file(pmconflict_t *conflict)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(conflict != NULL, return(NULL));
+
+ return conflict->file;
+}
+
+const char *alpm_conflict_get_ctarget(pmconflict_t *conflict)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(conflict != NULL, return(NULL));
+
+ return conflict->ctarget;
+}
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index cdbec038..9cab8489 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -187,7 +187,6 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
{
pmdepend_t depend;
pmlist_t *i, *j, *k;
- int cmp;
int found = 0;
pmlist_t *baddeps = NULL;
pmdepmissing_t *miss = NULL;
@@ -204,15 +203,16 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
pmpkg_t *tp = i->data;
pmpkg_t *oldpkg;
if(tp == NULL) {
+ _alpm_log(PM_LOG_DEBUG, _("null package found in package list"));
continue;
}
if((oldpkg = _alpm_db_get_pkgfromcache(db, tp->name)) == NULL) {
+ _alpm_log(PM_LOG_DEBUG, _("cannot find package installed '%s'"), tp->name);
continue;
}
_alpm_db_read(db, INFRQ_DEPENDS, oldpkg);
for(j = oldpkg->requiredby; j; j = j->next) {
- char *ver;
pmpkg_t *p;
found = 0;
if((p = _alpm_db_get_pkgfromcache(db, j->data)) == NULL) {
@@ -241,26 +241,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
/* we found an installed package that provides depend.name */
FREELISTPTR(provides);
}
- found = 0;
- if(depend.mod == PM_DEP_MOD_ANY) {
- found = 1;
- } else {
- /* note that we use the version from the NEW package in the check */
- ver = strdup(tp->version);
- if(!index(depend.version,'-')) {
- char *ptr;
- for(ptr = ver; *ptr != '-'; ptr++);
- *ptr = '\0';
- }
- cmp = _alpm_versioncmp(ver, depend.version);
- switch(depend.mod) {
- case PM_DEP_MOD_EQ: found = (cmp == 0); break;
- case PM_DEP_MOD_GE: found = (cmp >= 0); break;
- case PM_DEP_MOD_LE: found = (cmp <= 0); break;
- }
- FREE(ver);
- }
- if(!found) {
+ 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);
if(!_alpm_depmiss_isin(miss, baddeps)) {
@@ -277,6 +258,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
for(i = packages; i; i = i->next) {
pmpkg_t *tp = i->data;
if(tp == NULL) {
+ _alpm_log(PM_LOG_DEBUG, _("null package found in package list"));
continue;
}
@@ -294,29 +276,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
/* check database for literal packages */
for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
- if(!strcmp(p->name, depend.name)) {
- if(depend.mod == PM_DEP_MOD_ANY) {
- /* accept any version */
- found = 1;
- } else {
- char *ver = strdup(p->version);
- /* check for a release in depend.version. if it's
- * missing remove it from p->version as well.
- */
- if(!index(depend.version,'-')) {
- char *ptr;
- for(ptr = ver; *ptr != '-'; ptr++);
- *ptr = '\0';
- }
- cmp = _alpm_versioncmp(ver, depend.version);
- switch(depend.mod) {
- case PM_DEP_MOD_EQ: found = (cmp == 0); break;
- case PM_DEP_MOD_GE: found = (cmp >= 0); break;
- case PM_DEP_MOD_LE: found = (cmp <= 0); break;
- }
- FREE(ver);
- }
- }
+ found = _alpm_depcmp(p, &depend);
}
/* check database for provides matches */
if(!found) {
@@ -340,57 +300,14 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
continue;
}
- if(depend.mod == PM_DEP_MOD_ANY) {
- /* accept any version */
- found = 1;
- } else {
- char *ver = strdup(p->version);
- /* check for a release in depend.version. if it's
- * missing remove it from p->version as well.
- */
- if(!index(depend.version,'-')) {
- char *ptr;
- for(ptr = ver; *ptr != '-'; ptr++);
- *ptr = '\0';
- }
- cmp = _alpm_versioncmp(ver, depend.version);
- switch(depend.mod) {
- case PM_DEP_MOD_EQ: found = (cmp == 0); break;
- case PM_DEP_MOD_GE: found = (cmp >= 0); break;
- case PM_DEP_MOD_LE: found = (cmp <= 0); break;
- }
- FREE(ver);
- }
+ found = _alpm_depcmp(p, &depend);
}
FREELISTPTR(k);
}
/* check other targets */
for(k = packages; k && !found; k = k->next) {
pmpkg_t *p = (pmpkg_t *)k->data;
- /* see if the package names match OR if p provides depend.name */
- if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) {
- if(depend.mod == PM_DEP_MOD_ANY) {
- /* accept any version */
- found = 1;
- } else {
- char *ver = strdup(p->version);
- /* check for a release in depend.version. if it's
- * missing remove it from p->version as well.
- */
- if(!index(depend.version,'-')) {
- char *ptr;
- for(ptr = ver; *ptr != '-'; ptr++);
- *ptr = '\0';
- }
- cmp = _alpm_versioncmp(ver, depend.version);
- switch(depend.mod) {
- case PM_DEP_MOD_EQ: found = (cmp == 0); break;
- case PM_DEP_MOD_GE: found = (cmp >= 0); break;
- case PM_DEP_MOD_LE: found = (cmp <= 0); break;
- }
- FREE(ver);
- }
- }
+ found = _alpm_depcmp(p, &depend);
}
/* else if still not found... */
if(!found) {
@@ -701,4 +618,48 @@ error:
return(-1);
}
+const char *alpm_dep_get_target(pmdepmissing_t *miss)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(miss != NULL, return(NULL));
+
+ return miss->target;
+}
+
+unsigned char alpm_dep_get_type(pmdepmissing_t *miss)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(-1));
+ ASSERT(miss != NULL, return(-1));
+
+ return miss->type;
+}
+
+unsigned char alpm_dep_get_mod(pmdepmissing_t *miss)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(-1));
+ ASSERT(miss != NULL, return(-1));
+
+ return miss->depend.mod;
+}
+
+const char *alpm_dep_get_name(pmdepmissing_t *miss)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(miss != NULL, return(NULL));
+
+ return miss->depend.name;
+}
+
+const char *alpm_dep_get_version(pmdepmissing_t *miss)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(miss != NULL, return(NULL));
+
+ return miss->depend.version;
+}
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index d3269673..72425f56 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -25,6 +25,7 @@
#include "db.h"
#include "sync.h"
+#include "package.h"
#include "alpm.h"
/* Dependency */
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 31867551..52e939d1 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -58,6 +58,7 @@ pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
} else {
pkg->version[0] = '\0';
}
+ pkg->filename[0] = '\0';
pkg->desc[0] = '\0';
pkg->url[0] = '\0';
pkg->license = NULL;
@@ -70,7 +71,7 @@ pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
pkg->sha1sum[0] = '\0';
pkg->arch[0] = '\0';
pkg->size = 0;
- pkg->usize = 0;
+ pkg->isize = 0;
pkg->scriptlet = 0;
pkg->force = 0;
pkg->reason = PM_PKG_REASON_EXPLICIT;
@@ -101,6 +102,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
RET_ERR(PM_ERR_MEMORY, NULL);
}
+ STRNCPY(newpkg->filename, pkg->filename, PKG_FILENAME_LEN);
STRNCPY(newpkg->name, pkg->name, PKG_NAME_LEN);
STRNCPY(newpkg->version, pkg->version, PKG_VERSION_LEN);
STRNCPY(newpkg->desc, pkg->desc, PKG_DESC_LEN);
@@ -113,7 +115,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
STRNCPY(newpkg->sha1sum, pkg->sha1sum, PKG_SHA1SUM_LEN);
STRNCPY(newpkg->arch, pkg->arch, PKG_ARCH_LEN);
newpkg->size = pkg->size;
- newpkg->usize = pkg->usize;
+ newpkg->isize = pkg->isize;
newpkg->force = pkg->force;
newpkg->scriptlet = pkg->scriptlet;
newpkg->reason = pkg->reason;
@@ -244,10 +246,10 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
char tmp[32];
STRNCPY(tmp, ptr, sizeof(tmp));
info->size = atol(ptr);
- } else if(!strcmp(key, "USIZE")) {
+ } else if(!strcmp(key, "ISIZE")) {
char tmp[32];
STRNCPY(tmp, ptr, sizeof(tmp));
- info->usize = atol(ptr);
+ info->isize = atol(ptr);
} else if(!strcmp(key, "DEPEND")) {
info->depends = _alpm_list_add(info->depends, strdup(ptr));
} else if(!strcmp(key, "REMOVE")) {
@@ -437,30 +439,6 @@ pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack)
return(NULL);
}
-char *_alpm_pkg_makefilename(pmpkg_t *pkg)
-{
- char *fname = NULL;
- int len = 0, arch_valid = 0;
-
- len = strlen(pkg->name) + strlen(pkg->version) + strlen(PM_EXT_PKG) + 3;
- if(pkg->arch && strlen(pkg->arch) > 0) {
- arch_valid = 1;
- len += strlen(pkg->arch) + 1;
- }
-
- if((fname = (char *)calloc(len, sizeof(char))) == NULL) {
- RET_ERR(PM_ERR_MEMORY, NULL);
- }
-
- if(arch_valid) {
- snprintf(fname, len-1, "%s-%s-%s" PM_EXT_PKG, pkg->name, pkg->version, pkg->arch);
- } else {
- snprintf(fname, len-1, "%s-%s" PM_EXT_PKG, pkg->name, pkg->version);
- }
-
- return fname;
-}
-
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
{
char tmp[PKG_FULLNAME_LEN+7];
@@ -511,6 +489,24 @@ int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
return(0);
}
+const char *alpm_pkg_get_filename(pmpkg_t *pkg)
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(pkg != NULL, return(NULL));
+
+ if(!strlen(pkg->filename)) {
+ /* construct the file name, it's not in the desc file */
+ if(pkg->arch && strlen(pkg->arch) > 0) {
+ snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s-%s" PM_EXT_PKG, pkg->name, pkg->version, pkg->arch);
+ } else {
+ snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s" PM_EXT_PKG, pkg->name, pkg->version);
+ }
+ }
+
+ return pkg->filename;
+}
+
const char *alpm_pkg_get_name(pmpkg_t *pkg)
{
/* Sanity checks */
@@ -649,7 +645,7 @@ unsigned long alpm_pkg_get_size(pmpkg_t *pkg)
return pkg->size;
}
-unsigned long alpm_pkg_get_usize(pmpkg_t *pkg)
+unsigned long alpm_pkg_get_isize(pmpkg_t *pkg)
{
/* Sanity checks */
ASSERT(handle != NULL, return(-1));
@@ -658,7 +654,7 @@ unsigned long alpm_pkg_get_usize(pmpkg_t *pkg)
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
}
- return pkg->usize;
+ return pkg->isize;
}
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 1b834cb8..0b11ae49 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -37,6 +37,7 @@ enum {
};
/* Packages */
+#define PKG_FILENAME_LEN 512
#define PKG_NAME_LEN 256
#define PKG_VERSION_LEN 64
#define PKG_FULLNAME_LEN (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1
@@ -50,6 +51,7 @@ enum {
#define PKG_ARCH_LEN 32
struct __pmpkg_t {
+ char filename[PKG_FILENAME_LEN];
char name[PKG_NAME_LEN];
char version[PKG_VERSION_LEN];
char desc[PKG_DESC_LEN];
@@ -62,7 +64,7 @@ struct __pmpkg_t {
char sha1sum[PKG_SHA1SUM_LEN];
char arch[PKG_ARCH_LEN];
unsigned long size;
- unsigned long usize;
+ unsigned long isize;
unsigned char scriptlet;
unsigned char force;
time_t date;
@@ -93,7 +95,6 @@ void _alpm_pkg_free(void *data);
int _alpm_pkg_cmp(const void *p1, const void *p2);
pmpkg_t *_alpm_pkg_load(char *pkgfile);
pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack);
-char *_alpm_pkg_makefilename(pmpkg_t *pkg);
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index acc48362..7c251790 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -785,12 +785,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
pmdb_t *dbs = spkg->data;
if(current == dbs) {
- char *fname = NULL;
+ const char *fname = NULL;
char path[PATH_MAX];
- fname = _alpm_pkg_makefilename(spkg);
+ fname = alpm_pkg_get_filename(spkg);
if(trans->flags & PM_TRANS_FLAG_PRINTURIS) {
- EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current), fname);
+ EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current), (char *)fname);
} else {
struct stat buf;
snprintf(path, PATH_MAX, "%s/%s", ldir, fname);
@@ -801,7 +801,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
_alpm_log(PM_LOG_DEBUG, _("%s is already in the cache\n"), fname);
}
}
- FREE(fname);
}
}
@@ -840,11 +839,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
pmpkg_t *spkg = sync->pkg;
- char str[PATH_MAX], *pkgname;
+ char str[PATH_MAX];
+ const char *pkgname;
char *md5sum1, *md5sum2, *sha1sum1, *sha1sum2;
char *ptr=NULL;
- pkgname = _alpm_pkg_makefilename(spkg);
+ pkgname = alpm_pkg_get_filename(spkg);
md5sum1 = spkg->md5sum;
sha1sum1 = spkg->sha1sum;
@@ -877,7 +877,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
doremove=1;
} else {
- QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, pkgname, NULL, NULL, &doremove);
+ QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, (char *)pkgname, NULL, NULL, &doremove);
}
if(doremove) {
char str[PATH_MAX];
@@ -890,7 +890,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
*data = _alpm_list_add(*data, ptr);
retval = 1;
}
- FREE(pkgname);
FREE(md5sum2);
FREE(sha1sum2);
}
@@ -963,10 +962,10 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
pmsyncpkg_t *sync = i->data;
pmpkg_t *spkg = sync->pkg;
- char *fname = NULL;
+ const char *fname = NULL;
char str[PATH_MAX];
- fname = _alpm_pkg_makefilename(spkg);
+ fname = alpm_pkg_get_filename(spkg);
snprintf(str, PATH_MAX, "%s%s/%s", handle->root, handle->cachedir, fname);
if(_alpm_trans_addtarget(tr, str) == -1) {
goto error;
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 55d3cf7c..8def650f 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -226,4 +226,39 @@ int _alpm_trans_commit(pmtrans_t *trans, pmlist_t **data)
return(0);
}
+unsigned char alpm_trans_get_type()
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(-1));
+ ASSERT(handle->trans != NULL, return(-1));
+
+ return handle->trans->type;
+}
+
+unsigned int alpm_trans_get_flags()
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(-1));
+ ASSERT(handle->trans != NULL, return(-1));
+
+ return handle->trans->flags;
+}
+
+pmlist_t * alpm_trans_get_targets()
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(handle->trans != NULL, return(NULL));
+
+ return handle->trans->targets;
+}
+
+pmlist_t * alpm_trans_get_packages()
+{
+ /* Sanity checks */
+ ASSERT(handle != NULL, return(NULL));
+ ASSERT(handle->trans != NULL, return(NULL));
+
+ return handle->trans->packages;
+}
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index cca43117..1610c43f 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -511,13 +511,16 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
if(fgets(line, 1024, pp) == NULL)
break;
/* "START <event desc>" */
- if((strlen(line) > strlen(STARTSTR)) && !strncmp(line, STARTSTR, strlen(STARTSTR))) {
- EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(STARTSTR)), NULL);
+ if((strlen(line) > strlen(SCRIPTLET_START)) && !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) {
+ EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL);
/* "DONE <ret code>" */
- } else if((strlen(line) > strlen(DONESTR)) && !strncmp(line, DONESTR, strlen(DONESTR))) {
- EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(DONESTR))), NULL);
+ } else if((strlen(line) > strlen(SCRIPTLET_DONE)) && !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) {
+ EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))), NULL);
} else {
- EVENT(trans, PM_TRANS_EVT_SCRIPTLET_INFO, _alpm_strtrim(line), NULL);
+ _alpm_strtrim(line);
+ /* log our script output */
+ alpm_logaction(line);
+ EVENT(trans, PM_TRANS_EVT_SCRIPTLET_INFO, line, NULL);
}
}
pclose(pp);
@@ -577,7 +580,7 @@ int _alpm_check_freespace(pmtrans_t *trans, pmlist_t **data)
pmsyncpkg_t *sync = i->data;
if(sync->type != PM_SYNC_TYPE_REPLACE) {
pmpkg_t *pkg = sync->pkg;
- pkgsize += pkg->usize;
+ pkgsize += pkg->isize;
}
}
else
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 37b944cb..978de9e7 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -51,8 +51,8 @@
#define _(s) s
#endif
-#define STARTSTR "START "
-#define DONESTR "DONE "
+#define SCRIPTLET_START "START "
+#define SCRIPTLET_DONE "DONE "
int _alpm_makepath(char *path);
int _alpm_copyfile(char *src, char *dest);
diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c
index 652b7efb..2e406d9e 100644
--- a/lib/libalpm/versioncmp.c
+++ b/lib/libalpm/versioncmp.c
@@ -26,7 +26,12 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
+#include <libintl.h>
/* pacman */
+#include "alpm.h"
+#include "log.h"
+#include "util.h"
+#include "list.h"
#include "versioncmp.h"
#ifndef HAVE_STRVERSCMP
@@ -238,4 +243,42 @@ int _alpm_versioncmp(const char *a, const char *b)
return(*one ? 1 : -1);
}
+int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
+{
+ int equal = 0;
+
+ if(strcmp(pkg->name, dep->name) == 0 || _alpm_list_is_strin(dep->name, pkg->provides)) {
+ if(dep->mod == PM_DEP_MOD_ANY) {
+ equal = 1;
+ } 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;
+ }
+ }
+
+ char *mod = "depends on";
+ switch(dep->mod) {
+ case PM_DEP_MOD_EQ: mod = "=="; break;
+ case PM_DEP_MOD_GE: mod = ">="; break;
+ case PM_DEP_MOD_LE: mod = "<="; break;
+ }
+
+ if(strlen(dep->version) > 0) {
+ _alpm_log(PM_LOG_DEBUG, _("depcmp: %s-%s %s %s-%s => %s"),
+ pkg->name, pkg->version, mod, dep->name, dep->version,
+ (equal ? "match" : "no match"));
+ } else {
+ _alpm_log(PM_LOG_DEBUG, _("depcmp: %s-%s %s %s => %s"),
+ pkg->name, pkg->version, mod, dep->name,
+ (equal ? "match" : "no match"));
+ }
+ }
+
+ return equal;
+}
+
+
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/versioncmp.h b/lib/libalpm/versioncmp.h
index ada2921a..3a64888a 100644
--- a/lib/libalpm/versioncmp.h
+++ b/lib/libalpm/versioncmp.h
@@ -23,7 +23,11 @@
#ifndef _PM_RPMVERCMP_H
#define _PM_RPMVERCMP_H
+#include "deps.h"
+#include "package.h"
+
int _alpm_versioncmp(const char *a, const char *b);
+int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
#endif
diff --git a/src/pacman/add.c b/src/pacman/add.c
index b4d7c3ad..7a7cb80c 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -94,12 +94,12 @@ int pacman_add(list_t *targets)
case PM_ERR_UNSATISFIED_DEPS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
- MSG(NL, _(":: %s: requires %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
- alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
+ 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;
}
MSG(CL, "\n");
}
@@ -108,25 +108,25 @@ int pacman_add(list_t *targets)
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
pmdepmissing_t *miss = alpm_list_getdata(i);
MSG(NL, _(":: %s: conflicts with %s"),
- alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
+ alpm_dep_get_target(miss), alpm_dep_get_name(miss));
}
break;
case PM_ERR_FILE_CONFLICTS:
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
pmconflict_t *conflict = alpm_list_getdata(i);
- switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
+ switch(alpm_conflict_get_type(conflict)) {
case PM_CONFLICT_TYPE_TARGET:
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
config->root,
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
+ alpm_conflict_get_file(conflict),
+ alpm_conflict_get_target(conflict),
+ alpm_conflict_get_ctarget(conflict));
break;
case PM_CONFLICT_TYPE_FILE:
MSG(NL, _("%s: %s%s exists in filesystem"),
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
+ alpm_conflict_get_target(conflict),
config->root,
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
+ alpm_conflict_get_file(conflict));
break;
}
}
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 4caaf3c7..faa9ebda 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -107,15 +107,15 @@ int pacman_deptest(list_t *targets)
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmdepmissing_t *miss = alpm_list_getdata(lp);
if(!config->op_d_resolve) {
- MSG(NL, _("requires: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
+ 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;
}
MSG(CL, "\n");
}
- synctargs = list_add(synctargs, strdup(alpm_dep_getinfo(miss, PM_DEP_NAME)));
+ synctargs = list_add(synctargs, strdup(alpm_dep_get_name(miss)));
}
alpm_list_free(data);
break;
@@ -123,7 +123,7 @@ int pacman_deptest(list_t *targets)
/* we can't auto-resolve conflicts */
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmdepmissing_t *miss = alpm_list_getdata(lp);
- MSG(NL, _("conflict: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
+ MSG(NL, _("conflict: %s"), alpm_dep_get_name(miss));
}
retval = 127;
alpm_list_free(data);
diff --git a/src/pacman/package.c b/src/pacman/package.c
index bf26c5c2..42a9bab2 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -147,7 +147,7 @@ void dump_pkg_sync(pmpkg_t *pkg, char *treename)
pmlist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg));
printf(_("Size (compressed) : %ld\n"), (long)alpm_pkg_get_size(pkg));
- printf(_("Size (uncompressed):%ld\n"), (long)alpm_pkg_get_usize(pkg));
+ printf(_("Size (installed) : %ld\n"), (long)alpm_pkg_get_isize(pkg));
printf(_("Description : "));
indentprint(alpm_pkg_get_desc(pkg), 20);
diff --git a/src/pacman/query.c b/src/pacman/query.c
index e080ddf6..06445e21 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -163,7 +163,8 @@ int pacman_query(list_t *targets)
}
} else {
ERR(NL, _("group \"%s\" was not found\n"), package);
- return(2);
+ /* do not return on query operations - let's just carry on */
+ /*return(2);*/
}
}
continue;
@@ -215,7 +216,9 @@ int pacman_query(list_t *targets)
if(info == NULL) {
/* something weird happened */
ERR(NL, _("package \"%s\" not found\n"), pkgname);
- return(1);
+ /* do not return on query operations - let's just carry on */
+ /*return(1);*/
+ continue;
}
if(config->op_q_foreign) {
int match = 0;
@@ -258,7 +261,9 @@ int pacman_query(list_t *targets)
info = alpm_db_readpkg(db_local, package);
if(info == NULL) {
ERR(NL, _("package \"%s\" not found\n"), package);
- return(2);
+ /* do not return on query operations - let's just carry on */
+ /*return(2);*/
+ continue;
}
/* find a target */
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index ddc22e7e..0e5e3ddf 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -104,8 +104,8 @@ int pacman_remove(list_t *targets)
case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmdepmissing_t *miss = alpm_list_getdata(lp);
- MSG(NL, _(" %s: is required by %s\n"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
- alpm_dep_getinfo(miss, PM_DEP_NAME));
+ MSG(NL, _(" %s is required by %s\n"), alpm_dep_get_target(miss),
+ alpm_dep_get_name(miss));
}
alpm_list_free(data);
break;
@@ -122,7 +122,7 @@ int pacman_remove(list_t *targets)
pmlist_t *lp;
/* list transaction targets */
i = NULL;
- for(lp = alpm_list_first(alpm_trans_getinfo(PM_TRANS_PACKAGES)); lp; lp = alpm_list_next(lp)) {
+ for(lp = alpm_list_first(alpm_trans_get_packages()); lp; lp = alpm_list_next(lp)) {
pmpkg_t *pkg = alpm_list_getdata(lp);
i = list_add(i, strdup(alpm_pkg_get_name(pkg)));
}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index f1f43e56..c2313b4b 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -410,7 +410,7 @@ int pacman_sync(list_t *targets)
}
if(config->op_s_upgrade) {
- MSG(NL, _(":: Starting local database upgrade...\n"));
+ MSG(NL, _(":: Starting full system upgrade...\n"));
alpm_logaction(_("starting full system upgrade"));
if(alpm_trans_sysupgrade() == -1) {
ERR(NL, "%s\n", alpm_strerror(pm_errno));
@@ -424,7 +424,7 @@ int pacman_sync(list_t *targets)
* this can prevent some of the "syntax error" problems users can have
* when sysupgrade'ing with an older version of pacman.
*/
- data = alpm_trans_getinfo(PM_TRANS_PACKAGES);
+ data = alpm_trans_get_packages();
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmsyncpkg_t *sync = alpm_list_getdata(lp);
pmpkg_t *spkg = alpm_sync_get_package(sync);
@@ -535,13 +535,13 @@ int pacman_sync(list_t *targets)
case PM_ERR_UNSATISFIED_DEPS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmdepmissing_t *miss = alpm_list_getdata(lp);
- MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
- (long)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
- alpm_dep_getinfo(miss, PM_DEP_NAME));
- switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
- case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
- case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
- case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
+ 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));
+ 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;
}
MSG(CL, "\n");
}
@@ -551,7 +551,7 @@ int pacman_sync(list_t *targets)
pmdepmissing_t *miss = alpm_list_getdata(lp);
MSG(NL, _(":: %s: conflicts with %s"),
- alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
+ alpm_dep_get_target(miss), alpm_dep_get_name(miss));
}
break;
case PM_ERR_DISK_FULL:
@@ -569,7 +569,7 @@ int pacman_sync(list_t *targets)
goto cleanup;
}
- packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
+ packages = alpm_trans_get_packages();
if(packages == NULL) {
/* nothing to do: just exit without complaining */
MSG(NL," local database is up to date");
@@ -577,12 +577,12 @@ int pacman_sync(list_t *targets)
}
/* list targets and get confirmation */
- if(!((unsigned long)alpm_trans_getinfo(PM_TRANS_FLAGS) & PM_TRANS_FLAG_PRINTURIS)) {
+ if(!(alpm_trans_get_flags() & PM_TRANS_FLAG_PRINTURIS)) {
list_t *list_install = NULL;
list_t *list_remove = NULL;
char *str;
unsigned long totalsize = 0;
- unsigned long totalusize = 0;
+ unsigned long totalisize = 0;
double mb, umb;
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
@@ -605,7 +605,7 @@ int pacman_sync(list_t *targets)
pkgname = alpm_pkg_get_name(pkg);
pkgver = alpm_pkg_get_version(pkg);
totalsize += alpm_pkg_get_size(pkg);
- totalusize += alpm_pkg_get_usize(pkg);
+ totalisize += alpm_pkg_get_isize(pkg);
asprintf(&str, "%s-%s", pkgname, pkgver);
list_install = list_add(list_install, str);
@@ -619,7 +619,7 @@ int pacman_sync(list_t *targets)
FREE(str);
}
mb = (double)(totalsize / 1048576.0);
- umb = (double)(totalusize / 1048576.0);
+ umb = (double)(totalisize / 1048576.0);
/* round up to 0.1 */
if(mb < 0.1) {
mb = 0.1;
@@ -672,19 +672,19 @@ int pacman_sync(list_t *targets)
case PM_ERR_FILE_CONFLICTS:
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
pmconflict_t *conflict = alpm_list_getdata(lp);
- switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
+ switch(alpm_conflict_get_type(conflict)) {
case PM_CONFLICT_TYPE_TARGET:
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
config->root,
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
+ alpm_conflict_get_file(conflict),
+ alpm_conflict_get_target(conflict),
+ alpm_conflict_get_ctarget(conflict));
break;
case PM_CONFLICT_TYPE_FILE:
MSG(NL, _("%s: %s%s exists in filesystem"),
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
+ alpm_conflict_get_target(conflict),
config->root,
- (char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
+ alpm_conflict_get_file(conflict));
break;
}
}
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 29bea83c..7eac8a52 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -3,6 +3,7 @@ bin_PROGRAMS = vercmp
AM_CFLAGS = \
-I$(top_srcdir)/lib/libalpm \
-I$(top_srcdir)/src/pacman
+ $(CFLAGS)
vercmp_SOURCES = vercmp.c
diff --git a/src/util/vercmp.c b/src/util/vercmp.c
index 70a4b044..ff100fd8 100644
--- a/src/util/vercmp.c
+++ b/src/util/vercmp.c
@@ -21,6 +21,9 @@
#include <stdio.h>
#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <limits.h>
#include "versioncmp.h"
int main(int argc, char *argv[])