Skip to content

Commit

Permalink
pacman: change default answer of all queries to yes
Browse files Browse the repository at this point in the history
This allows to use pacman completely unattended using the
--noconfirm switch which automatically accepts the default answer.

Fixes #1141
  • Loading branch information
Ede123 committed Feb 12, 2018
1 parent 6b94806 commit deae945
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 4 deletions.
72 changes: 72 additions & 0 deletions pacman/0008-answer-yes-by-default.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From 09ad07d05d61d3c15409eae9297493d633aaeecd Mon Sep 17 00:00:00 2001
From: Eduard Braun <[email protected]>
Date: Sat, 10 Feb 2018 22:39:35 +0100
Subject: [PATCH] Change default answer of all queries to yes

This allows to use pacman completely unattended using the
--noconfirm switch which automatically accepts the default answer.

See https://github.com/Alexpux/MSYS2-packages/issues/1141
---
src/pacman/callback.c | 6 +++---
src/pacman/remove.c | 2 +-
src/pacman/sync.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index c1679e37..cbb01092 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -416,12 +416,12 @@ void cb_question(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->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 (%s). Remove %s?"),
+ q->remove = yesno(_("%s and %s are in conflict (%s). Remove %s?"),
q->conflict->package1,
q->conflict->package2,
q->conflict->reason->name,
@@ -445,7 +445,7 @@ void cb_question(alpm_question_t *question)
count));
list_display(" ", namelist, getcols());
printf("\n");
- q->skip = noyes(_n(
+ q->skip = yesno(_n(
"Do you want to skip the above package for this upgrade?",
"Do you want to skip the above packages for this upgrade?",
count));
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 73b48c36..a25d73af 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -146,7 +146,7 @@ int pacman_remove(alpm_list_t *targets)
holdpkg = 1;
}
}
- if(holdpkg && (noyes(_("HoldPkg was found in target list. Do you want to continue?")) == 0)) {
+ if(holdpkg && (yesno(_("HoldPkg was found in target list. Do you want to continue?")) == 0)) {
retval = 1;
goto cleanup;
}
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 0f41fad9..62749aae 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -194,7 +194,7 @@ static int sync_cleancache(int level)
}
printf(_("removing old packages from cache...\n"));
} else {
- if(!noyes(_("Do you want to remove ALL files from cache?"))) {
+ if(!yesno(_("Do you want to remove ALL files from cache?"))) {
printf("\n");
continue;
}
--
2.16.1.windows.4

12 changes: 8 additions & 4 deletions pacman/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

pkgname=pacman
pkgver=5.0.1
pkgrel=4
pkgrel=5
pkgdesc="A library-based package manager with dependency support (MSYS2 port)"
arch=('i686' 'x86_64')
url="https://www.archlinux.org/pacman/"
Expand Down Expand Up @@ -37,7 +37,8 @@ makedepends=('asciidoc'
'libarchive-devel'
'libcurl-devel'
'libgpgme-devel'
'libsqlite-devel')
'libsqlite-devel'
'libunistring-devel')
provides=('pacman-contrib')
conflicts=('pacman-contrib')
replaces=('pacman-contrib')
Expand All @@ -59,7 +60,8 @@ source=(https://sources.archlinux.org/other/pacman/${pkgname}-${pkgver}.tar.gz{,
"0004-Link-pacman-with-static-libraries.patch"
"0005-Hack-gettext-libalpm-pkg-config-static-link.patch"
"0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch"
"0007-exe-interp-ignore-file-conflict.patch")
"0007-exe-interp-ignore-file-conflict.patch"
"0008-answer-yes-by-default.patch")
sha256sums=('8bd5f407ce8e05c4be8f1c4be4d8dcc8550ea5e494937da5220ea2c23cbb8e04'
'SKIP'
'6024bbf50cc92236b7b437430cb9e4180da91925cdc19a5a7910fe172931cfb6'
Expand All @@ -74,7 +76,8 @@ sha256sums=('8bd5f407ce8e05c4be8f1c4be4d8dcc8550ea5e494937da5220ea2c23cbb8e04'
'1ec59e4262546a4f25432a9194adadd039641f61225c71e56464dc641ae4a299'
'1c71c5f38a408fbc027db164730739e644047706a0ea3f8330ea1666a58e3e91'
'3422115a859547b25babb5181301a0e9a485d6bc5de5169c828d59fd88486952'
'a88d4531283d5b85cde5793c8867bb554fdac7513f948f172c0d64ea0ca544f9')
'a88d4531283d5b85cde5793c8867bb554fdac7513f948f172c0d64ea0ca544f9'
'e4f6e17af19e17e745a9f1c6b8402f5896229062c82167cb61f8e7d29eda716c')

prepare() {
cd ${srcdir}/${pkgname}-${pkgver}
Expand All @@ -86,6 +89,7 @@ prepare() {
patch -p1 -i ${srcdir}/0005-Hack-gettext-libalpm-pkg-config-static-link.patch
patch -p1 -i ${srcdir}/0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch
patch -p1 -i ${srcdir}/0007-exe-interp-ignore-file-conflict.patch
patch -p1 -i ${srcdir}/0008-answer-yes-by-default.patch

autoreconf -fi
}
Expand Down

0 comments on commit deae945

Please sign in to comment.