Use external tool `w3m' for dumping html to plain texts.
[xwl-elisp.git] / generic-apt / generic-apt-apt-get.el
blob602661f8ca31e23c68258e848f2c2c4290431c82
1 ;;; generic-apt-apt-get.el --- apt-get backend
3 ;; Copyright (C) 2008 William Xu
5 ;; Author: William Xu <william.xwl@gmail.com>
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
10 ;; any later version.
12 ;; This program is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20 ;; MA 02110-1301, USA.
22 ;;; Code:
24 (require 'generic-apt)
26 ;; Variables
27 (defvar generic-apt-apt-get-font-lock-keywords
28 `(("^Package:\\(.*\\)"
29 (1 font-lock-function-name-face nil t))
30 ("^Conflicts:"
31 (0 font-lock-warning-face nil t))
32 ("^Description:\\(.*\n\\)"
33 (1 font-lock-function-name-face nil t))
34 (,(concat
35 "^\\("
36 (regexp-opt
37 '("Package" "Priority" "Section" "Installed-Size" "Maintainer"
38 "Architecture" "Version" "Depends" "Suggests" "Filename"
39 "Size" "MD5sum" "Description" "Tag" "Status" "Replaces"
40 "Conffiles" "Source" "Provides" "Pre-Depends" "Recommends"
41 "SHA1" "SHA256" "Enhances" "Config-Version" "Task"))
42 "\\):")
43 (0 font-lock-keyword-face t t))))
45 (defvar generic-apt-apt-get-available-pkgs '())
47 (defvar generic-apt-apt-get-sources-file "/etc/apt/sources.list")
49 ;; Interfaces
50 (defun generic-apt-apt-get-update ()
51 (generic-apt-run-command (list "update")))
53 (defun generic-apt-apt-get-search-by-name (pkg)
54 (generic-apt-run-other-command (list "apt-cache" "search" "-n" pkg)))
56 (defun generic-apt-apt-get-search-by-name (pkg)
57 (generic-apt-run-other-command (list "apt-cache" "search" pkg)))
59 (defun generic-apt-apt-get-show (pkg)
60 (generic-apt-run-other-command (list "apt-cache" "show" pkg)))
62 (defun generic-apt-apt-get-install (pkg)
63 (generic-apt-run-command (list "install" pkg)))
65 (defun generic-apt-apt-get-listfiles (pkg)
66 (generic-apt-run-other-command (list "dpkg" "-L" pkg)))
68 (defun generic-apt-apt-get-upgrade (pkg)
69 (generic-apt-run-command (list "upgrade" pkg)))
71 (defun generic-apt-apt-get-clean ()
72 (generic-apt-run-other-command (list "apt-cache" "clean")))
74 (defun generic-apt-apt-get-remove (pkg)
75 (generic-apt-run-command (list "remove" pkg)))
77 ;; Misc
79 (defun generic-apt-apt-get-update-available-pkgs ()
80 (setq generic-apt-available-pkgs
81 (split-string
82 (generic-apt-run-other-command-to-string "apt-cache pkgnames"))))
84 (provide 'generic-apt-apt-get)
86 ;;; generic-apt-apt-get.el ends here