alpm: add ALPM_TRANS_FLAG_NOKEEP
this flag prevents backup files from being kept on package installation. This is useful for resetting a package's config files back to their original state. Implements FS#59908 although with it's own flag name instead of reusing nosave. This allows nokeep to optionally create a pacnew that you can then choose to disable by also setting nosave. --- I actually very dislike NOKEEP but it was the best I could come up with I would have prefered overwrite or nosave but they are taken. Better names are welcome.
This commit is contained in:
parent
39c3cbdf56
commit
0c701af590
2 changed files with 5 additions and 2 deletions
|
@ -2704,7 +2704,8 @@ int alpm_pkg_mtree_close(const alpm_pkg_t *pkg, struct archive *archive);
|
||||||
typedef enum _alpm_transflag_t {
|
typedef enum _alpm_transflag_t {
|
||||||
/** Ignore dependency checks. */
|
/** Ignore dependency checks. */
|
||||||
ALPM_TRANS_FLAG_NODEPS = 1,
|
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. */
|
/** Delete files even if they are tagged as backup. */
|
||||||
ALPM_TRANS_FLAG_NOSAVE = (1 << 2),
|
ALPM_TRANS_FLAG_NOSAVE = (1 << 2),
|
||||||
/** Ignore version numbers when checking dependencies. */
|
/** 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
|
return _alpm_fnmatch_patterns(handle->noupgrade, path) == 0
|
||||||
|| alpm_list_find_str(handle->trans->skip_remove, path)
|
|| 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));
|
&& alpm_filelist_contains(alpm_pkg_get_files(newpkg), path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue