[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/system-packages ea7fa7b 049/117: Add an option to bypas
From: |
Stefan Monnier |
Subject: |
[elpa] externals/system-packages ea7fa7b 049/117: Add an option to bypass user confirmation of package manager action |
Date: |
Fri, 14 Dec 2018 17:02:07 -0500 (EST) |
branch: externals/system-packages
commit ea7fa7b01d3caaff21575437dcb4ae7e13e88770
Author: Alex Branham <address@hidden>
Commit: Alex Branham <address@hidden>
Add an option to bypass user confirmation of package manager action
Closes #14
---
system-packages.el | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/system-packages.el b/system-packages.el
index 2e04630..573680f 100644
--- a/system-packages.el
+++ b/system-packages.el
@@ -66,7 +66,8 @@
(remove-orphaned . nil)
(list-installed-packages . "brew list --installed")
(list-installed-packages-all . "brew list")
- (list-dependencies-of . "brew deps")))
+ (list-dependencies-of . "brew deps")
+ (noconfirm . nil)))
(port .
((default-sudo . t)
(install . "port install")
@@ -83,7 +84,8 @@
(remove-orphaned . "port uninstall leaves")
(list-installed-packages . "port installed")
(list-installed-packages-all . "port installed")
- (list-dependencies-of . "port deps")))
+ (list-dependencies-of . "port deps")
+ (noconfirm . nil)))
;; Arch-based systems
(pacaur .
((default-sudo . nil)
@@ -101,7 +103,8 @@
(remove-orphaned . "pacaur -Rns $(pacman -Qtdq)")
(list-installed-packages . "pacaur -Qe")
(list-installed-packages-all . "pacaur -Q")
- (list-dependencies-of . "pacaur -Qi")))
+ (list-dependencies-of . "pacaur -Qi")
+ (noconfirm . "--noconfirm")))
(pacman .
((default-sudo . t)
(install . "pacman -S")
@@ -118,7 +121,8 @@
(remove-orphaned . "pacman -Rns $(pacman -Qtdq)")
(list-installed-packages . "pacman -Qe")
(list-installed-packages-all . "pacman -Q")
- (list-dependencies-of . "pacman -Qi")))
+ (list-dependencies-of . "pacman -Qi")
+ (noconfirm . "--noconfirm")))
;; Debian (and Ubuntu) based systems
(apt .
((default-sudo . t)
@@ -136,7 +140,8 @@
(remove-orphaned . "apt autoremove")
(list-installed-packages . nil)
(list-installed-packages-all . nil)
- (list-dependencies-of . "apt-cache deps")))
+ (list-dependencies-of . "apt-cache deps")
+ (noconfirm . "-y")))
(aptitude .
((default-sudo . t)
(install . "aptitude install")
@@ -153,7 +158,8 @@
(remove-orphaned . nil) ; aptitude does this automatically
(list-installed-packages . "aptitude search '~i!~M'")
(list-installed-packages-all . "aptitude search '~i!~M'")
- (list-dependencies-of . "apt-cache deps")))
+ (list-dependencies-of . "apt-cache deps")
+ (noconfirm . "-y")))
;; Gentoo
(emerge .
((default-sudo . t)
@@ -171,7 +177,8 @@
(remove-orphaned . "emerge --depclean")
(list-installed-packages . nil)
(list-installed-packages-all . nil)
- (list-dependencies-of . "emerge -ep")))
+ (list-dependencies-of . "emerge -ep")
+ (noconfirm . nil)))
;; openSUSE
(zypper .
((default-sudo . t)
@@ -189,7 +196,8 @@
(remove-orphaned . "zypper rm -u")
(list-installed-packages . nil)
(list-installed-packages-all . nil)
- (list-dependencies-of . "zypper info --requires")))
+ (list-dependencies-of . "zypper info --requires")
+ (noconfirm . nil)))
;; Fedora
(dnf .
((default-sudo . t)
@@ -207,7 +215,8 @@
(remove-orphaned . "dnf autoremove")
(list-installed-packages . "dnf list --installed")
(list-installed-packages-all . nil)
- (list-dependencies-of . "rpm -qR")))
+ (list-dependencies-of . "rpm -qR")
+ (noconfirm . nil)))
;; Void
;; xbps is the name of the package manager, but that doesn't appear as an
;; executable, so let's just call it xbps-install:
@@ -227,7 +236,8 @@
(remove-orphaned . "dnf autoremove")
(list-installed-packages . "xbps-query -l ")
(list-installed-packages-all . "xbps-query -l ")
- (list-dependencies-of . "xbps-query -x")))))
+ (list-dependencies-of . "xbps-query -x")
+ (noconfirm . nil)))))
(defcustom system-packages-packagemanager
(cl-loop for (name . prop) in system-packages-supported-package-managers
@@ -250,6 +260,10 @@ default."
Tries to be smart for selecting the default."
:group 'system-packages)
+(defcustom system-packages-noconfirm nil
+ "If non-nil, bypass prompts asking the user to confirm package upgrades."
+ :group 'system-packages
+ :type 'boolean)
(defun system-packages--run-command (action &optional pack args)
"Run a command that affects system packages.
@@ -263,7 +277,11 @@ ARGS gets passed to the command and is useful for passing
options
to the package manager."
(let ((command
(cdr (assoc action (cdr (assoc system-packages-packagemanager
-
system-packages-supported-package-managers))))))
+
system-packages-supported-package-managers)))))
+ (noconfirm (when system-packages-noconfirm
+ (cdr (assoc 'noconfirm
+ (cdr (assoc system-packages-packagemanager
+
system-packages-supported-package-managers)))))))
(unless command
(error (format "%S not supported in %S" action
system-packages-packagemanager)))
(unless (listp command)
@@ -272,6 +290,7 @@ to the package manager."
(setq command (mapcar (lambda (part) (concat "sudo " part)) command)))
(setq command (mapconcat 'identity command " && "))
(setq command (mapconcat 'identity (list command pack) " "))
+ (setq args (concat args noconfirm))
(when args
(setq command (concat command args)))
(async-shell-command command "*system-packages*")))
- [elpa] externals/system-packages b394c04 034/117: Adds support for openSUSE zypper and Gentoo emerge, (continued)
- [elpa] externals/system-packages b394c04 034/117: Adds support for openSUSE zypper and Gentoo emerge, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 5124f57 038/117: add lexical-binding t, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages ccc2a6b 041/117: Add support for xbps, used by void linux, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 2bf16c6 054/117: README: mention that xbps is supported, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages bace616 001/117: Initial commit, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages ebfb6f9 037/117: Fix typo, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 15ba684 043/117: Add Macports, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages ae993f9 040/117: Prefer apt to aptitude, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 5058542 048/117: Adds :group to defcustom, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 5010fb4 058/117: Fix spacing in some variable names, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages ea7fa7b 049/117: Add an option to bypass user confirmation of package manager action,
Stefan Monnier <=
- [elpa] externals/system-packages bc30966 050/117: Update readme, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages feaf28c 059/117: Remove unneeded version line, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages ba902ce 071/117: Mention helm-system-packages in commentary and README, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 2e9c031 065/117: Setup travis to error on byte compiler warnings, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 26feaab 074/117: Include bug reference info in .dir-locals, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 874ab8f 046/117: Add directory local variables, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 0534179 014/117: Adds README, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 170f07c 039/117: Update README, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 24eb0b9 032/117: Adds several functions, Stefan Monnier, 2018/12/14
- [elpa] externals/system-packages 1ec26d1 045/117: Add macports, Stefan Monnier, 2018/12/14