@@ -2704,7 +2704,8 @@ int alpm_pkg_mtree_close(const alpm_pkg_t *pkg, struct archive *archive);
typedef enum _alpm_transflag_t {
/** Ignore dependency checks. */
ALPM_TRANS_FLAG_NODEPS = 1,
- /* (1 << 1) flag can go here */
+ /** Don't keep backup files when installing packages. */
+ ALPM_TRANS_FLAG_NOKEEP = (1 << 1),
/** Delete files even if they are tagged as backup. */
ALPM_TRANS_FLAG_NOSAVE = (1 << 2),
/** Ignore version numbers when checking dependencies. */
@@ -575,7 +575,9 @@ static int should_skip_file(alpm_handle_t *handle,
{
return _alpm_fnmatch_patterns(handle->noupgrade, path) == 0
|| alpm_list_find_str(handle->trans->skip_remove, path)
- || (newpkg && _alpm_needbackup(path, newpkg)
+ || (!(handle->trans->flags & ALPM_TRANS_FLAG_NOKEEP)
+ && newpkg
+ && _alpm_needbackup(path, newpkg)
&& alpm_filelist_contains(alpm_pkg_get_files(newpkg), path));
}