From 04e8048725441465788a6c76a326ff252c2fd815 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 4 Jul 2014 23:12:01 +0200 Subject: Add --assume-installed option This allows to ignore specific dependencies. Signed-off-by: Florian Pritz --- src/pacman/conf.c | 18 ++++++++++++++++++ src/pacman/conf.h | 4 +++- src/pacman/pacman.c | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 8b298ccf..5028284d 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -134,6 +134,7 @@ int config_free(config_t *oldconfig) FREELIST(oldconfig->holdpkg); FREELIST(oldconfig->ignorepkg); FREELIST(oldconfig->ignoregrp); + FREELIST(oldconfig->assumeinstalled); FREELIST(oldconfig->noupgrade); FREELIST(oldconfig->noextract); free(oldconfig->configfile); @@ -650,6 +651,7 @@ static int setup_libalpm(void) int ret = 0; alpm_errno_t err; alpm_handle_t *handle; + alpm_list_t *i; pm_printf(ALPM_LOG_DEBUG, "setup_libalpm called\n"); @@ -742,6 +744,22 @@ static int setup_libalpm(void) alpm_option_set_noupgrades(handle, config->noupgrade); alpm_option_set_noextracts(handle, config->noextract); + for(i = config->assumeinstalled; i; i = i->next) { + char *entry = i->data; + alpm_depend_t *dep = alpm_dep_from_string(entry); + if(!dep) { + return 1; + } + pm_printf(ALPM_LOG_DEBUG, "parsed assume installed: %s %s\n", dep->name, dep->version); + + ret = alpm_option_add_assumeinstalled(handle, dep); + if(ret) { + pm_printf(ALPM_LOG_ERROR, _("Failed to pass assume installed entry to libalpm")); + alpm_dep_free(dep); + return ret; + } + } + return 0; } diff --git a/src/pacman/conf.h b/src/pacman/conf.h index e8cac509..8aed6d6b 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -101,6 +101,7 @@ typedef struct __config_t { alpm_list_t *holdpkg; alpm_list_t *ignorepkg; alpm_list_t *ignoregrp; + alpm_list_t *assumeinstalled; alpm_list_t *noupgrade; alpm_list_t *noextract; char *xfercommand; @@ -176,7 +177,8 @@ enum { OP_UNNEEDED, OP_VERBOSE, OP_DOWNLOADONLY, - OP_REFRESH + OP_REFRESH, + OP_ASSUMEINSTALLED }; /* clean method */ diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 30bb4528..5cac37ca 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -634,6 +634,9 @@ static int parsearg_trans(int opt) free(config->print_format); config->print_format = strdup(optarg); break; + case OP_ASSUMEINSTALLED: + parsearg_util_addlist(&(config->assumeinstalled)); + break; default: return 1; } @@ -857,6 +860,7 @@ static int parseargs(int argc, char *argv[]) {"noconfirm", no_argument, 0, OP_NOCONFIRM}, {"config", required_argument, 0, OP_CONFIG}, {"ignore", required_argument, 0, OP_IGNORE}, + {"assume-installed", required_argument, 0, OP_ASSUMEINSTALLED}, {"debug", optional_argument, 0, OP_DEBUG}, {"force", no_argument, 0, OP_FORCE}, {"noprogressbar", no_argument, 0, OP_NOPROGRESSBAR}, -- cgit v1.2.3-54-g00ecf