Merge branch 'morganamilo/nokeep' into morganamilo/tip

This commit is contained in:
morganamilo 2021-11-06 23:40:45 +00:00
commit 5c55ef2db5
No known key found for this signature in database
GPG key ID: E48D0A8326DE47C5
5 changed files with 25 additions and 12 deletions

View file

@ -210,6 +210,11 @@ Transaction Options (apply to '-S', '-R' and '-U')
dependencies are installed and there are no package conflicts in the dependencies are installed and there are no package conflicts in the
system. Specify this option twice to skip all dependency checks. system. Specify this option twice to skip all dependency checks.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system, the database is checked to see if the
file should be renamed with a '.pacsave' extension.
*\--assume-installed* <package=version>:: *\--assume-installed* <package=version>::
Add a virtual package "package" with version "version" to the transaction Add a virtual package "package" with version "version" to the transaction
to satisfy dependencies. This allows to disable specific dependency checks to satisfy dependencies. This allows to disable specific dependency checks
@ -269,6 +274,9 @@ Upgrade Options (apply to '-S' and '-U')[[UO]]
*\--needed*:: *\--needed*::
Do not reinstall the targets that are already up-to-date. Do not reinstall the targets that are already up-to-date.
*\--nokeep*::
Overwrite backup files when installing packages.
*\--overwrite* <glob>:: *\--overwrite* <glob>::
Bypass file conflict checks and overwrite conflicting files. If the Bypass file conflict checks and overwrite conflicting files. If the
package that is about to be installed contains files that are already package that is about to be installed contains files that are already
@ -372,11 +380,6 @@ Remove Options (apply to '-R')[[RO]]
or more target packages. This operation is recursive and must be used or more target packages. This operation is recursive and must be used
with care, since it can remove many potentially needed packages. with care, since it can remove many potentially needed packages.
*-n, \--nosave*::
Instructs pacman to ignore file backup designations. Normally, when a
file is removed from the system, the database is checked to see if the
file should be renamed with a '.pacsave' extension.
*-s, \--recursive*:: *-s, \--recursive*::
Remove each target specified including all of their dependencies, provided Remove each target specified including all of their dependencies, provided
that (A) they are not required by other packages; and (B) they were not that (A) they are not required by other packages; and (B) they were not

View file

@ -2747,7 +2747,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. */

View file

@ -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));
} }

View file

@ -169,6 +169,7 @@ enum {
OP_LOGFILE, OP_LOGFILE,
OP_IGNOREGROUP, OP_IGNOREGROUP,
OP_NEEDED, OP_NEEDED,
OP_NOKEEP,
OP_ASEXPLICIT, OP_ASEXPLICIT,
OP_ARCH, OP_ARCH,
OP_PRINTFORMAT, OP_PRINTFORMAT,

View file

@ -123,7 +123,6 @@ static void usage(int op, const char * const myname)
printf("%s: %s {-R --remove} [%s] <%s>\n", str_usg, myname, str_opt, str_pkg); printf("%s: %s {-R --remove} [%s] <%s>\n", str_usg, myname, str_opt, str_pkg);
printf("%s:\n", str_opt); printf("%s:\n", str_opt);
addlist(_(" -c, --cascade remove packages and all packages that depend on them\n")); addlist(_(" -c, --cascade remove packages and all packages that depend on them\n"));
addlist(_(" -n, --nosave remove configuration files\n"));
addlist(_(" -s, --recursive remove unnecessary dependencies\n" addlist(_(" -s, --recursive remove unnecessary dependencies\n"
" (-ss includes explicitly installed dependencies)\n")); " (-ss includes explicitly installed dependencies)\n"));
addlist(_(" -u, --unneeded remove unneeded packages\n")); addlist(_(" -u, --unneeded remove unneeded packages\n"));
@ -164,6 +163,7 @@ static void usage(int op, const char * const myname)
addlist(_(" -y, --refresh download fresh package databases from the server\n" addlist(_(" -y, --refresh download fresh package databases from the server\n"
" (-yy to force a refresh even if up to date)\n")); " (-yy to force a refresh even if up to date)\n"));
addlist(_(" --needed do not reinstall up to date packages\n")); addlist(_(" --needed do not reinstall up to date packages\n"));
addlist(_(" --nokeep overwrite backup files when installing packages\n"));
} else if(op == PM_OP_DATABASE) { } else if(op == PM_OP_DATABASE) {
printf("%s: %s {-D --database} <%s> <%s>\n", str_usg, myname, str_opt, str_pkg); printf("%s: %s {-D --database} <%s> <%s>\n", str_usg, myname, str_opt, str_pkg);
printf("%s:\n", str_opt); printf("%s:\n", str_opt);
@ -199,6 +199,7 @@ static void usage(int op, const char * const myname)
__attribute__((fallthrough)); __attribute__((fallthrough));
case PM_OP_REMOVE: case PM_OP_REMOVE:
addlist(_(" -d, --nodeps skip dependency version checks (-dd to skip all checks)\n")); addlist(_(" -d, --nodeps skip dependency version checks (-dd to skip all checks)\n"));
addlist(_(" -n, --nosave remove configuration files\n"));
addlist(_(" --assume-installed <package=version>\n" addlist(_(" --assume-installed <package=version>\n"
" add a virtual package to satisfy dependencies\n")); " add a virtual package to satisfy dependencies\n"));
addlist(_(" --dbonly only modify database entries, not package files\n")); addlist(_(" --dbonly only modify database entries, not package files\n"));
@ -631,6 +632,11 @@ static int parsearg_trans(int opt)
config->flags |= ALPM_TRANS_FLAG_NODEPVERSION; config->flags |= ALPM_TRANS_FLAG_NODEPVERSION;
} }
break; break;
case OP_NOSAVE:
case 'n':
config->flags |= ALPM_TRANS_FLAG_NOSAVE;
break;
case OP_DBONLY: case OP_DBONLY:
config->flags |= ALPM_TRANS_FLAG_DBONLY; config->flags |= ALPM_TRANS_FLAG_DBONLY;
config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET; config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET;
@ -680,10 +686,6 @@ static int parsearg_remove(int opt)
case 'c': case 'c':
config->flags |= ALPM_TRANS_FLAG_CASCADE; config->flags |= ALPM_TRANS_FLAG_CASCADE;
break; break;
case OP_NOSAVE:
case 'n':
config->flags |= ALPM_TRANS_FLAG_NOSAVE;
break;
case OP_RECURSIVE: case OP_RECURSIVE:
case 's': case 's':
if(config->flags & ALPM_TRANS_FLAG_RECURSE) { if(config->flags & ALPM_TRANS_FLAG_RECURSE) {
@ -731,6 +733,9 @@ static int parsearg_upgrade(int opt)
case OP_NEEDED: case OP_NEEDED:
config->flags |= ALPM_TRANS_FLAG_NEEDED; config->flags |= ALPM_TRANS_FLAG_NEEDED;
break; break;
case OP_NOKEEP:
config->flags |= ALPM_TRANS_FLAG_NOKEEP;
break;
case OP_IGNORE: case OP_IGNORE:
parsearg_util_addlist(&(config->ignorepkg)); parsearg_util_addlist(&(config->ignorepkg));
break; break;
@ -941,6 +946,7 @@ static int parseargs(int argc, char *argv[])
{"logfile", required_argument, 0, OP_LOGFILE}, {"logfile", required_argument, 0, OP_LOGFILE},
{"ignoregroup", required_argument, 0, OP_IGNOREGROUP}, {"ignoregroup", required_argument, 0, OP_IGNOREGROUP},
{"needed", no_argument, 0, OP_NEEDED}, {"needed", no_argument, 0, OP_NEEDED},
{"nokeep", no_argument, 0, OP_NOKEEP},
{"asexplicit", no_argument, 0, OP_ASEXPLICIT}, {"asexplicit", no_argument, 0, OP_ASEXPLICIT},
{"arch", required_argument, 0, OP_ARCH}, {"arch", required_argument, 0, OP_ARCH},
{"print-format", required_argument, 0, OP_PRINTFORMAT}, {"print-format", required_argument, 0, OP_PRINTFORMAT},