diff options
author | Allan McRae <allan@archlinux.org> | 2014-12-28 19:08:59 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-01-02 21:44:58 +1000 |
commit | 194dea2de10c3507608e4f826c66802671a719a8 (patch) | |
tree | 913f7fe91de668299fe4406e6b020591af08b95f /src | |
parent | fafcbdeb8c7af439f2f3b85fa82f27b1dd4a3f79 (diff) | |
download | pacman-194dea2de10c3507608e4f826c66802671a719a8.tar.xz |
Split install reason changing into its own function
Prepare for other functions to be added to the --database option.
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/database.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/pacman/database.c b/src/pacman/database.c index e858e0c8..dac0ab1d 100644 --- a/src/pacman/database.c +++ b/src/pacman/database.c @@ -35,11 +35,12 @@ * * @return 0 on success, 1 on failure */ -int pacman_database(alpm_list_t *targets) +static int change_install_reason(alpm_list_t *targets) { alpm_list_t *i; alpm_db_t *db_local; - int retval = 0; + int ret = 0; + alpm_pkgreason_t reason; if(targets == NULL) { @@ -68,7 +69,7 @@ int pacman_database(alpm_list_t *targets) if(!pkg || alpm_pkg_set_reason(pkg, reason)) { pm_printf(ALPM_LOG_ERROR, _("could not set install reason for package %s (%s)\n"), pkgname, alpm_strerror(alpm_errno(config->handle))); - retval = 1; + ret = 1; } else { if(reason == ALPM_PKG_REASON_DEPEND) { printf(_("%s: install reason has been set to 'installed as dependency'\n"), pkgname); @@ -82,7 +83,20 @@ int pacman_database(alpm_list_t *targets) if(trans_release() == -1) { return 1; } - return retval; + return ret; +} + + +int pacman_database(alpm_list_t *targets) +{ + int ret = 0; + + if(config->flags & (ALPM_TRANS_FLAG_ALLDEPS | ALPM_TRANS_FLAG_ALLEXPLICIT)) { + ret = change_install_reason(targets); + return ret; + } + + return ret; } /* vim: set noet: */ |