From e8a3e3d81a4aee62db24f66b71c01d8a996d41d5 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 28 Dec 2014 21:28:59 +1000 Subject: Integrate testdb into pacman The functionality of testdb is now available in pacman. pacman -Dk will check the local database for consistency, and pacman -Dkk will check the sync databases. Note that unlike testdb, you can not specify individual sync databases to check as sync databases act as a whole and not individually. A single database can be checked using an alternative pacman.conf file. Signed-off-by: Allan McRae --- src/pacman/pacman.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/pacman/pacman.c') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 6f05c68c..792c9946 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -169,6 +169,7 @@ static void usage(int op, const char * const myname) printf("%s:\n", str_opt); addlist(_(" --asdeps mark packages as non-explicitly installed\n")); addlist(_(" --asexplicit mark packages as explicitly installed\n")); + addlist(_(" -k, --check test local database for validity (-kk for sync databases)\n")); } else if(op == PM_OP_DEPTEST) { printf("%s: %s {-T --deptest} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg); printf("%s:\n", str_opt); @@ -484,9 +485,18 @@ static int parsearg_global(int opt) static int parsearg_database(int opt) { switch(opt) { - case OP_ASDEPS: config->flags |= ALPM_TRANS_FLAG_ALLDEPS; break; - case OP_ASEXPLICIT: config->flags |= ALPM_TRANS_FLAG_ALLEXPLICIT; break; - default: return 1; + case OP_ASDEPS: + config->flags |= ALPM_TRANS_FLAG_ALLDEPS; + break; + case OP_ASEXPLICIT: + config->flags |= ALPM_TRANS_FLAG_ALLEXPLICIT; + break; + case OP_CHECK: + case 'k': + (config->op_q_check)++; + break; + default: + return 1; } return 0; } @@ -496,6 +506,13 @@ static void checkargs_database(void) invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLDEPS && config->flags & ALPM_TRANS_FLAG_ALLEXPLICIT, "--asdeps", "--asexplicit"); + + if(config->op_q_check) { + invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLDEPS, + "--asdeps", "--check"); + invalid_opt(config->flags & ALPM_TRANS_FLAG_ALLEXPLICIT, + "--asexplicit", "--check"); + } } static int parsearg_query(int opt) -- cgit v1.2.3-24-g4f1b