diff options
author | Dan McGee <dan@archlinux.org> | 2007-05-31 21:48:16 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-06-09 18:58:12 +0200 |
commit | b6f3fe6957d0206485eac98fb2120578b75d0058 (patch) | |
tree | 394e45bb19e23284e23103fbab85aa3035d54b27 /src/pacman/query.c | |
parent | dfc85cb5f516ffbcff557522e9703c5c7d88b047 (diff) | |
download | pacman-b6f3fe6957d0206485eac98fb2120578b75d0058.tar.gz pacman-b6f3fe6957d0206485eac98fb2120578b75d0058.tar.xz |
Implement a -Qt operation in frontend to test the database
After adding a alpm_db_check() operation in the back end, we can call it
in the front end and present a user-friendly interface to it.
Inspired-by: VMiklos <vmiklos@frugalware.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/query.c')
-rw-r--r-- | src/pacman/query.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pacman/query.c b/src/pacman/query.c index 3863572f..6ca45d91 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -257,6 +257,26 @@ int pacman_query(alpm_list_t *targets) return(ret); } + if(config->op_q_test) { + alpm_list_t *testlist; + printf(_("Checking database for consistency...")); + testlist = alpm_db_test(db_local); + if(testlist == NULL) { + printf(_("check complete.\n")); + return(0); + } else { + /* on failure, increment the ret val by 1 for each failure */ + ret = 0; + printf(_("check failed!\n")); + fflush(stdout); + for(i = testlist; i; i = alpm_list_next(i)) { + fprintf(stderr, "%s\n", (char*)alpm_list_getdata(i)); + ret++; + } + return(ret); + } + } + if(config->op_q_foreign) { sync_dbs = alpm_option_get_syncdbs(); |