Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgpkg: pacman #899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions pacman/add_force_install_option.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
diff --git a/doc/pacman.8.asciidoc b/doc/pacman.8.asciidoc
index bb20562..ae52b80 100644
--- a/doc/pacman.8.asciidoc
+++ b/doc/pacman.8.asciidoc
@@ -191,6 +191,9 @@ Options
*\--confirm*::
Cancels the effects of a previous '\--noconfirm'.

+*\--force-install*::
+ Remove conflicting packages by default.
+
*\--disable-download-timeout*::
Disable defaults for low speed limit and timeout on downloads. Use this
if you have issues downloading files with proxy and/or security gateway.
diff --git a/scripts/completion/bash_completion.in b/scripts/completion/bash_completion.in
index 1c6cb1e..d9c6729 100644
--- a/scripts/completion/bash_completion.in
+++ b/scripts/completion/bash_completion.in
@@ -117,8 +117,8 @@ _pacman() {
info list needed nodeps assume-installed print refresh recursive search sysupgrade'
'c g i l p s u w y')
upgrade=('asdeps asexplicit needed nodeps assume-installed print recursive' 'p')
- common=('arch cachedir color config confirm dbpath debug gpgdir help hookdir logfile
- noconfirm noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
+ common=('arch cachedir color config confirm dbpath debug force-install gpgdir help hookdir
+ logfile noconfirm noprogressbar noscriptlet quiet root verbose' 'b d h q r v')
core=('database files help query remove sync upgrade version' 'D F Q R S U V h')

for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade'; do
diff --git a/scripts/completion/zsh_completion.in b/scripts/completion/zsh_completion.in
index 5fd8aeb..cb91b1a 100644
--- a/scripts/completion/zsh_completion.in
+++ b/scripts/completion/zsh_completion.in
@@ -30,6 +30,7 @@ _pacman_opts_common=(
'--config[An alternate configuration file]:config file:_files'
'--confirm[Always ask for confirmation]'
'--debug[Display debug messages]'
+ '--force-install[Remove conflicting packages by default]'
'--gpgdir[Set an alternate directory for GnuPG (instead of @sysconfdir@/pacman.d/gnupg)]: :_files -/'
'--hookdir[Set an alternate hook location]: :_files -/'
'--logfile[An alternate log file]:config file:_files'
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 75c74f8..a1c0a48 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -479,16 +479,31 @@ void cb_question(void *ctx, alpm_question_t *question)
/* print conflict only if it contains new information */
if(strcmp(q->conflict->package1, q->conflict->reason->name) == 0
|| strcmp(q->conflict->package2, q->conflict->reason->name) == 0) {
- q->remove = noyes(_("%s and %s are in conflict. Remove %s?"),
- q->conflict->package1,
- q->conflict->package2,
- q->conflict->package2);
+ if (config->force_install) {
+ q->remove = yesno(_("%s and %s are in conflict. Remove %s?"),
+ q->conflict->package1,
+ q->conflict->package2,
+ q->conflict->package2);
+ } else {
+ q->remove = noyes(_("%s and %s are in conflict. Remove %s?"),
+ q->conflict->package1,
+ q->conflict->package2,
+ q->conflict->package2);
+ }
} else {
- q->remove = noyes(_("%s and %s are in conflict (%s). Remove %s?"),
- q->conflict->package1,
- q->conflict->package2,
- q->conflict->reason->name,
- q->conflict->package2);
+ if (config->force_install) {
+ q->remove = yesno(_("%s and %s are in conflict (%s). Remove %s?"),
+ q->conflict->package1,
+ q->conflict->package2,
+ q->conflict->reason->name,
+ q->conflict->package2);
+ } else {
+ q->remove = noyes(_("%s and %s are in conflict (%s). Remove %s?"),
+ q->conflict->package1,
+ q->conflict->package2,
+ q->conflict->reason->name,
+ q->conflict->package2);
+ }
}
}
break;
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 04350d3..1ded614 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -50,6 +50,7 @@ typedef struct __config_t {
unsigned short version;
unsigned short help;
unsigned short noconfirm;
+ unsigned short force_install;
unsigned short noprogressbar;
unsigned short logmask;
unsigned short print;
@@ -157,6 +158,7 @@ enum {
OP_LONG_FLAG_MIN = 1000,
OP_NOCONFIRM,
OP_CONFIRM,
+ OP_FORCE_INSTALL,
OP_CONFIG,
OP_IGNORE,
OP_DEBUG,
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index e398855..f638bbd 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -224,6 +224,7 @@ static void usage(int op, const char * const myname)
addlist(_(" --logfile <path> set an alternate log file\n"));
addlist(_(" --noconfirm do not ask for any confirmation\n"));
addlist(_(" --confirm always ask for confirmation\n"));
+ addlist(_(" --force-install default to remove conflicting packages\n"));
addlist(_(" --disable-download-timeout\n"
" use relaxed timeouts for download\n"));
}
@@ -445,6 +446,9 @@ static int parsearg_global(int opt)
case OP_CONFIRM:
config->noconfirm = 0;
break;
+ case OP_FORCE_INSTALL:
+ config->force_install = 1;
+ break;
case OP_DBPATH:
case 'b':
free(config->dbpath);
@@ -924,6 +928,7 @@ static int parseargs(int argc, char *argv[])
{"downloadonly", no_argument, 0, OP_DOWNLOADONLY},
{"refresh", no_argument, 0, OP_REFRESH},
{"noconfirm", no_argument, 0, OP_NOCONFIRM},
+ {"force-install", no_argument, 0, OP_FORCE_INSTALL},
{"confirm", no_argument, 0, OP_CONFIRM},
{"config", required_argument, 0, OP_CONFIG},
{"ignore", required_argument, 0, OP_IGNORE},
12 changes: 8 additions & 4 deletions pacman/riscv64.patch
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
diff --git PKGBUILD PKGBUILD
index 6a17706..9fd8638 100644
index 6a17706..1ba5041 100644
--- PKGBUILD
+++ PKGBUILD
@@ -21,19 +21,22 @@ options=('strip' 'debug')
@@ -21,19 +21,25 @@ options=('strip' 'debug')
validpgpkeys=('6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD' # Allan McRae <[email protected]>
'B8151B117037781095514CA7BBDFFC92306B1121') # Andrew Gregory (pacman) <[email protected]>
source=(https://sources.archlinux.org/other/pacman/$pkgname-$pkgver.tar.xz{,.sig}
+ makepkg-config.guess.patch
add-flto-to-LDFLAGS-for-clang.patch
pacman.conf
makepkg.conf)
- makepkg.conf)
+ makepkg.conf
+ "add_force_install_option.patch")
sha256sums=('0db61456e56aa49e260e891c0b025be210319e62b15521f29d3e93b00d3bf731'
'SKIP'
+ 'b5aafad7ca54e29f4e01a81e97011169e3344629207cbf1ff6acab8ceeff68c1'
'82ff91b85f4c6ceba19f9330437e2a22aabc966c2b9e2a20a53857f98a42c223'
'606e55f06c297d2b508bc4438890b229a1abaa68b0374a2d7f94c8e7be6792d7'
- 'a47f9732c295a17cfc02463e7404c8e17a99175a09da15b1e42770d6bd571be7')
+ '3ffea881ed34500f94db438996ab023aee01e3bb9e1885bb39e02a8e1a7e7eb2')
+ '3ffea881ed34500f94db438996ab023aee01e3bb9e1885bb39e02a8e1a7e7eb2'
+ 'c5fc3d2f660c1a57766190c907b41391e2cc7162382b64784d865dfae4910374')


prepare() {
cd "$pkgname-$pkgver"
patch -Np1 -i ../add-flto-to-LDFLAGS-for-clang.patch
+ patch -Np0 -i ../makepkg-config.guess.patch
+ patch -Np1 -i"../add_force_install_option.patch"
}

build() {
Expand Down