diff options
author | Aaron Griffin <aaron@archlinux.org> | 2006-11-22 10:03:41 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2006-11-22 10:03:41 +0100 |
commit | 986409f9bd7b84e63352b9ec1f825b0c917627a6 (patch) | |
tree | f74350bb415326724e86408985ea0d43fe93c7b0 /src | |
parent | 54691771831c97c7366bf8ee7c54da3952c22120 (diff) | |
download | pacman-986409f9bd7b84e63352b9ec1f825b0c917627a6.tar.gz pacman-986409f9bd7b84e63352b9ec1f825b0c917627a6.tar.xz |
* 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
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/add.c | 26 | ||||
-rw-r--r-- | src/pacman/deptest.c | 14 | ||||
-rw-r--r-- | src/pacman/package.c | 2 | ||||
-rw-r--r-- | src/pacman/query.c | 11 | ||||
-rw-r--r-- | src/pacman/remove.c | 6 | ||||
-rw-r--r-- | src/pacman/sync.c | 42 | ||||
-rw-r--r-- | src/util/Makefile.am | 1 | ||||
-rw-r--r-- | src/util/vercmp.c | 3 |
8 files changed, 57 insertions, 48 deletions
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[]) |