summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pacman/deptest.c46
-rw-r--r--src/pacman/pacman.c7
-rw-r--r--src/pacman/util.c31
-rw-r--r--src/util/testdb.c8
4 files changed, 37 insertions, 55 deletions
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 2481c0b6..2feca5c4 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -31,53 +31,23 @@
#include "util.h"
#include "conf.h"
-/* TODO: This should use _alpm_checkdeps() */
int pacman_deptest(alpm_list_t *targets)
{
- int retval = 0;
alpm_list_t *i;
- if(targets == NULL) {
+ alpm_list_t *deps = alpm_deptest(alpm_option_get_localdb(), targets);
+ if(deps == NULL) {
return(0);
}
- for(i = targets; i; i = alpm_list_next(i)) {
- int found = 0;
- pmpkg_t *pkg;
- pmdepend_t *dep;
- const char *target;
- alpm_list_t *j, *provides;
+ for(i = deps; i; i = alpm_list_next(i)) {
+ const char *dep;
- target = alpm_list_getdata(i);
- dep = alpm_splitdep(target);
-
- pkg = alpm_db_get_pkg(alpm_option_get_localdb(),
- alpm_dep_get_name(dep));
- if(pkg && alpm_depcmp(pkg, dep)) {
- found = 1;
- } else {
- /* not found, can we find anything that provides this in the local DB? */
- provides = alpm_db_whatprovides(alpm_option_get_localdb(),
- alpm_dep_get_name(dep));
- for(j = provides; j; j = alpm_list_next(j)) {
- pmpkg_t *pkg;
- pkg = alpm_list_getdata(j);
-
- if(pkg && alpm_depcmp(pkg, dep)) {
- found = 1;
- break;
- }
- }
- alpm_list_free(provides);
- }
-
- if(!found) {
- printf("%s\n", target);
- retval = 127;
- }
- free(dep);
+ dep = alpm_list_getdata(i);
+ printf("%s\n", dep);
}
- return(retval);
+ alpm_list_free(deps);
+ return(127);
}
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 27130254..61e0042a 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -79,6 +79,7 @@ static void usage(int op, const char * const myname)
printf("%s: %s {-A --add} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
printf("%s:\n", str_opt);
printf(_(" --asdeps install packages as non-explicitly installed\n"));
+ printf(_(" --asexplicit install packages as explicitly installed\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_REMOVE) {
@@ -93,6 +94,7 @@ static void usage(int op, const char * const myname)
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
printf("%s:\n", str_opt);
printf(_(" --asdeps install packages as non-explicitly installed\n"));
+ printf(_(" --asexplicit install packages as explicitly installed\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
printf(_(" -f, --force force install, overwrite conflicting files\n"));
} else if(op == PM_OP_QUERY) {
@@ -115,6 +117,7 @@ static void usage(int op, const char * const myname)
printf("%s: %s {-S --sync} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
printf("%s:\n", str_opt);
printf(_(" --asdeps install packages as non-explicitly installed\n"));
+ printf(_(" --asexplicit install packages as explicitly installed\n"));
printf(_(" -c, --clean remove old packages from cache directory (-cc for all)\n"));
printf(_(" -d, --nodeps skip dependency checks\n"));
printf(_(" -e, --dependsonly install dependencies only\n"));
@@ -341,6 +344,7 @@ static int parseargs(int argc, char *argv[])
{"logfile", required_argument, 0, 1009},
{"ignoregroup", required_argument, 0, 1010},
{"needed", no_argument, 0, 1011},
+ {"asexplicit", no_argument, 0, 1012},
{0, 0, 0, 0}
};
@@ -412,6 +416,9 @@ static int parseargs(int argc, char *argv[])
FREELIST(list);
break;
case 1011: config->flags |= PM_TRANS_FLAG_NEEDED; break;
+ case 1012:
+ config->flags |= PM_TRANS_FLAG_ALLEXPLICIT;
+ break;
case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
case 'Q': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_QUERY); break;
case 'R': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_REMOVE); break;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 20f4c072..2dae832f 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -222,6 +222,10 @@ void indentprint(const char *str, int indent)
const char *p = str;
int cidx = indent;
+ if(!p) {
+ return;
+ }
+
while(*p) {
if(*p == ' ') {
const char *next = NULL;
@@ -433,20 +437,17 @@ void display_targets(const alpm_list_t *syncpkgs, pmdb_t *db_local)
pmsyncpkg_t *sync = alpm_list_getdata(i);
pmpkg_t *pkg = alpm_sync_get_pkg(sync);
- /* If this sync record is a replacement, the data member contains
- * a list of packages to be removed due to the package that is being
- * installed. */
- if(alpm_sync_get_type(sync) == PM_SYNC_TYPE_REPLACE) {
- alpm_list_t *to_replace = alpm_sync_get_data(sync);
+ /* The removes member contains a list of packages to be removed
+ * due to the package that is being installed. */
+ alpm_list_t *to_replace = alpm_sync_get_removes(sync);
- for(j = to_replace; j; j = alpm_list_next(j)) {
- pmpkg_t *rp = alpm_list_getdata(j);
- const char *name = alpm_pkg_get_name(rp);
+ for(j = to_replace; j; j = alpm_list_next(j)) {
+ pmpkg_t *rp = alpm_list_getdata(j);
+ const char *name = alpm_pkg_get_name(rp);
- if(!alpm_list_find_str(to_remove, name)) {
- rsize += alpm_pkg_get_isize(rp);
- to_remove = alpm_list_add(to_remove, strdup(name));
- }
+ if(!alpm_list_find_str(to_remove, name)) {
+ rsize += alpm_pkg_get_isize(rp);
+ to_remove = alpm_list_add(to_remove, strdup(name));
}
}
@@ -489,11 +490,7 @@ void display_targets(const alpm_list_t *syncpkgs, pmdb_t *db_local)
printf("\n");
printf(_("Total Download Size: %.2f MB\n"), mbdlsize);
-
- /* TODO because all pkgs don't include isize, this is a crude hack */
- if(mbisize > mbdlsize) {
- printf(_("Total Installed Size: %.2f MB\n"), mbisize);
- }
+ printf(_("Total Installed Size: %.2f MB\n"), mbisize);
FREELIST(targets);
}
diff --git a/src/util/testdb.c b/src/util/testdb.c
index 122a3fb5..f354ecab 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -147,6 +147,14 @@ int main(int argc, char **argv)
free(depstring);
}
+ /* check conflicts */
+ data = alpm_checkdbconflicts(db);
+ for(i = data; i; i = i->next) {
+ pmconflict_t *conflict = alpm_list_getdata(i);
+ printf("%s conflicts with %s\n", alpm_conflict_get_package1(conflict),
+ alpm_conflict_get_package2(conflict));
+ }
+
cleanup(retval);
}