summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-24 14:55:32 -0400
committerDave Reisner <d@falconindy.com>2011-06-24 14:55:32 -0400
commit2d32a9a3a348d25d6d0f3d12752399bf7fdf6570 (patch)
treebb330206ea0caa95c9d337a6c5b4b99b6034e756 /src
parent8581694ceb63f4ed2854206b38574599c3d9df28 (diff)
parente06586ceb49a0dc7e59996ae3a1483337d2ada05 (diff)
downloadpacman-2d32a9a3a348d25d6d0f3d12752399bf7fdf6570.tar.xz
Merge branch 'master' of git://projects.archlinux.org/pacman
* 'master' of git://projects.archlinux.org/pacman: pactree: carry a list of databases for dep resolution makepkg: Remove a lone quotation mark makepkg: remove the cleancache option Don't require a transaction for sync DB updates Move locking functions to handle Add a 'valid' flag to the database object Move database 'version' check to registration time Do database signature checking at load time
Diffstat (limited to 'src')
-rw-r--r--src/pacman/conf.c19
-rw-r--r--src/pacman/sync.c7
-rw-r--r--src/pacman/util.c3
-rw-r--r--src/util/cleanupdelta.c2
-rw-r--r--src/util/pactree.c37
-rw-r--r--src/util/testdb.c2
6 files changed, 33 insertions, 37 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 081cdd5e..076e854d 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -449,6 +449,9 @@ static int setup_libalpm(void)
if(!handle) {
pm_printf(PM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"),
alpm_strerror(err));
+ if(err == PM_ERR_DB_VERSION) {
+ pm_printf(PM_LOG_ERROR, _(" try running pacman-db-upgrade\n"));
+ }
return -1;
}
config->handle = handle;
@@ -460,7 +463,7 @@ static int setup_libalpm(void)
ret = alpm_option_set_logfile(handle, config->logfile);
if(ret != 0) {
pm_printf(PM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"),
- config->logfile, alpm_strerror(alpm_errno(config->handle)));
+ config->logfile, alpm_strerror(alpm_errno(handle)));
return ret;
}
@@ -470,7 +473,7 @@ static int setup_libalpm(void)
ret = alpm_option_set_gpgdir(handle, config->gpgdir);
if(ret != 0) {
pm_printf(PM_LOG_ERROR, _("problem setting gpgdir '%s' (%s)\n"),
- config->gpgdir, alpm_strerror(alpm_errno(config->handle)));
+ config->gpgdir, alpm_strerror(alpm_errno(handle)));
return ret;
}
@@ -542,7 +545,7 @@ static int finish_section(struct section_t *section, int parse_options)
}
/* if we are not looking at options sections only, register a db */
- db = alpm_db_register_sync(config->handle, section->name);
+ db = alpm_db_register_sync(config->handle, section->name, section->sigverify);
if(db == NULL) {
pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"),
section->name, alpm_strerror(alpm_errno(config->handle)));
@@ -550,16 +553,6 @@ static int finish_section(struct section_t *section, int parse_options)
goto cleanup;
}
- if(section->sigverify) {
- if(alpm_db_set_pgp_verify(db, section->sigverify)) {
- pm_printf(PM_LOG_ERROR,
- _("could not set verify option for database '%s' (%s)\n"),
- section->name, alpm_strerror(alpm_errno(config->handle)));
- ret = 1;
- goto cleanup;
- }
- }
-
for(i = section->servers; i; i = alpm_list_next(i)) {
char *value = alpm_list_getdata(i);
if(_add_mirror(db, value) != 0) {
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 6c86bd10..f242c827 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -283,10 +283,6 @@ static int sync_synctree(int level, alpm_list_t *syncs)
alpm_list_t *i;
int success = 0, ret;
- if(trans_init(0) == -1) {
- return 0;
- }
-
for(i = syncs; i; i = alpm_list_next(i)) {
pmdb_t *db = alpm_list_getdata(i);
@@ -302,9 +298,6 @@ static int sync_synctree(int level, alpm_list_t *syncs)
}
}
- if(trans_release() == -1) {
- return 0;
- }
/* We should always succeed if at least one DB was upgraded - we may possibly
* fail later with unresolved deps, but that should be rare, and would be
* expected
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 66f127c6..77a7e56c 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -68,9 +68,6 @@ int trans_init(pmtransflag_t flags)
" running, you can remove %s\n"),
alpm_option_get_lockfile(config->handle));
}
- else if(err == PM_ERR_DB_VERSION) {
- fprintf(stderr, _(" try running pacman-db-upgrade\n"));
- }
return -1;
}
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index 98291706..5ee59dbb 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -75,7 +75,7 @@ static void checkdbs(const char *dbpath, alpm_list_t *dbnames) {
for(i = dbnames; i; i = alpm_list_next(i)) {
char *dbname = alpm_list_getdata(i);
snprintf(syncdbpath, PATH_MAX, "%s/sync/%s", dbpath, dbname);
- db = alpm_db_register_sync(handle, dbname);
+ db = alpm_db_register_sync(handle, dbname, PM_PGP_VERIFY_OPTIONAL);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database (%s)\n",
alpm_strerror(alpm_errno(handle)));
diff --git a/src/util/pactree.c b/src/util/pactree.c
index 6b29d935..87bac6d1 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -75,7 +75,6 @@ static struct color_choices no_color = {
/* globals */
pmhandle_t *handle = NULL;
-pmdb_t *db_local;
alpm_list_t *walked = NULL;
alpm_list_t *provisions = NULL;
@@ -241,15 +240,27 @@ static void print_end(void)
}
}
+static pmpkg_t *get_pkg_from_dbs(alpm_list_t *dbs, const char *needle) {
+ alpm_list_t *i;
+ pmpkg_t *ret;
+
+ for(i = dbs; i; i = alpm_list_next(i)) {
+ ret = alpm_db_get_pkg(alpm_list_getdata(i), needle);
+ if(ret) {
+ return ret;
+ }
+ }
+ return NULL;
+}
/**
* walk dependencies in reverse, showing packages which require the target
*/
-static void walk_reverse_deps(pmpkg_t *pkg, int depth)
+static void walk_reverse_deps(alpm_list_t *dblist, pmpkg_t *pkg, int depth)
{
alpm_list_t *required_by, *i;
- if((max_depth >= 0) && (depth == max_depth + 1)) {
+ if(!pkg || ((max_depth >= 0) && (depth == max_depth + 1))) {
return;
}
@@ -267,7 +278,7 @@ static void walk_reverse_deps(pmpkg_t *pkg, int depth)
}
} else {
print(alpm_pkg_get_name(pkg), pkgname, NULL, depth);
- walk_reverse_deps(alpm_db_get_pkg(db_local, pkgname), depth + 1);
+ walk_reverse_deps(dblist, get_pkg_from_dbs(dblist, pkgname), depth + 1);
}
}
@@ -277,7 +288,7 @@ static void walk_reverse_deps(pmpkg_t *pkg, int depth)
/**
* walk dependencies, showing dependencies of the target
*/
-static void walk_deps(pmpkg_t *pkg, int depth)
+static void walk_deps(alpm_list_t *dblist, pmpkg_t *pkg, int depth)
{
alpm_list_t *i;
@@ -289,8 +300,7 @@ static void walk_deps(pmpkg_t *pkg, int depth)
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
pmdepend_t *depend = alpm_list_getdata(i);
- pmpkg_t *provider = alpm_find_satisfier(alpm_db_get_pkgcache(db_local),
- depend->name);
+ pmpkg_t *provider = alpm_find_dbs_satisfier(handle, dblist, depend->name);
if(provider) {
const char *provname = alpm_pkg_get_name(provider);
@@ -303,7 +313,7 @@ static void walk_deps(pmpkg_t *pkg, int depth)
}
} else {
print(alpm_pkg_get_name(pkg), provname, depend->name, depth);
- walk_deps(provider, depth + 1);
+ walk_deps(dblist, provider, depth + 1);
}
} else {
/* unresolvable package */
@@ -318,6 +328,7 @@ int main(int argc, char *argv[])
enum _pmerrno_t err;
const char *target_name;
pmpkg_t *pkg;
+ alpm_list_t *dblist = NULL;
if(parse_options(argc, argv) != 0) {
usage();
@@ -333,12 +344,12 @@ int main(int argc, char *argv[])
goto finish;
}
- db_local = alpm_option_get_localdb(handle);
+ dblist = alpm_list_add(dblist, alpm_option_get_localdb(handle));
/* we only care about the first non option arg for walking */
target_name = argv[optind];
- pkg = alpm_find_satisfier(alpm_db_get_pkgcache(db_local), target_name);
+ pkg = alpm_find_dbs_satisfier(handle, dblist, target_name);
if(!pkg) {
fprintf(stderr, "error: package '%s' not found\n", target_name);
ret = 1;
@@ -348,13 +359,15 @@ int main(int argc, char *argv[])
print_start(alpm_pkg_get_name(pkg), target_name);
if(reverse) {
- walk_reverse_deps(pkg, 1);
+ walk_reverse_deps(dblist, pkg, 1);
} else {
- walk_deps(pkg, 1);
+ walk_deps(dblist, pkg, 1);
}
print_end();
+ alpm_list_free(dblist);
+
finish:
cleanup();
return ret;
diff --git a/src/util/testdb.c b/src/util/testdb.c
index 4937480d..af5007e2 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -151,7 +151,7 @@ static int check_syncdbs(alpm_list_t *dbnames) {
for(i = dbnames; i; i = alpm_list_next(i)) {
char *dbname = alpm_list_getdata(i);
- db = alpm_db_register_sync(handle, dbname);
+ db = alpm_db_register_sync(handle, dbname, PM_PGP_VERIFY_OPTIONAL);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database (%s)\n",
alpm_strerror(alpm_errno(handle)));