Package: debian-el Version: 33.5 Severity: wishlist File: /usr/share/emacs/site-lisp/debian-el/debian-bug.el
Sometimes I need to write a bug report for a host that doesn't have Emacs or an MTA. It would be nice to run reportbug over SSH, and I've written a patch to do so:
--- /usr/share/emacs/site-lisp/debian-el/debian-bug.el 2010-05-08 00:02:49.000000000 +0100 +++ /home/tms/lisp/debian-bug.el 2010-05-25 13:13:56.000000000 +0100 @@ -336,6 +336,8 @@ ;; debian-bug-find-bts-address ;; debian-bug-bts-mail ;; Patch debian-bug-prefill-report to use them +;; V1.75 25Map2010 Toby Speight <t.m.speight...@cantab.net> +;; Support bug reporting of remote host over ssh ;;---------------------------------------------------------------------------- ;;; Todo (Peter's list): @@ -584,6 +586,10 @@ "Buffer local alist of open bug numbers (and description) for this package.") (make-variable-buffer-local 'debian-bug-open-alist) +(defvar debian-bug-remote-host nil + "The host for which we're writing a bug report. +Nil for local host (default)") + (defalias 'report-debian-bug 'debian-bug) ;;; Functions: @@ -639,12 +645,17 @@ ("other") ("rmail")) debian-bug-packages-obarray)) +(defun debian-bug-call-process (program &optional infile buffer display &rest args) + (if debian-bug-remote-host + (apply 'call-process "ssh" infile buffer display debian-bug-remote-host program args) + (apply 'call-process program infile buffer display args))) + (defun debian-bug-check-for-program (program) "Check if PROGRAM is installed on the system. Done by calling `executable-find' or the external \"which\" utility." (if (fboundp 'executable-find) (executable-find program) - (zerop (call-process "which" nil nil nil program)))) + (zerop (debian-bug-call-process "which" nil nil nil program)))) (defun debian-bug-helper-program () "Return helper program found on system. @@ -664,7 +675,7 @@ doesn't exist, nil is returned." (let ((case-fold-search t)) (with-temp-buffer - (call-process "dpkg" nil '(t nil) nil "-s" package) + (debian-bug-call-process "dpkg" nil '(t nil) nil "-s" package) (goto-char (point-min)) (if (re-search-forward (concat "^" field " *: *\\(.+\\)$") nil t) @@ -721,13 +732,13 @@ ((and (eq (debian-bug-helper-program) 'bug) (intern-soft package debian-bug-packages-obarray)) (save-excursion - (call-process "bug" nil '(t t) nil "-p" "-s" "" "-S" severity package)) + (debian-bug-call-process "bug" nil '(t t) nil "-p" "-s" "" "-S" severity package)) (forward-line 4)) ;; reportbug ((eq (debian-bug-helper-program) 'reportbug) (save-excursion - (call-process "reportbug" nil '(t t) nil + (debian-bug-call-process "reportbug" nil '(t t) nil "--template" "-T" "none" "-s" "none" "-S" "normal" "-b" "--list-cc=none" "--no-bug-script" "-q" package) @@ -762,7 +773,7 @@ (insert "unknwown\n")) (insert "Kernel Version: ") - (call-process "uname" nil '(t t) nil "-a") + (debian-bug-call-process "uname" nil '(t t) nil "-a") (forward-line -5)))) (defun debian-bug-help-presubj (package) @@ -2326,7 +2337,7 @@ (unwind-protect (progn (condition-case err - (call-process "dlocate" nil '(t nil) nil "-S" expanded-file) + (debian-bug-call-process "dlocate" nil '(t nil) nil "-S" expanded-file) (file-error (message "dlocate not installed..."))) (goto-char (point-min)) @@ -2342,7 +2353,7 @@ package (message "Calling dpkg for the search...") (erase-buffer) - (call-process "dpkg" nil '(t nil) nil "-S" + (debian-bug-call-process "dpkg" nil '(t nil) nil "-S" (expand-file-name filename)) (message "Calling dpkg for the search...done") (goto-char (point-min)) @@ -2396,6 +2407,14 @@ (t (message "Sorry, try that again"))))) +;;;###autoload +(defun debian-bug-other-host (host) + "Submit a Debian bug report." + (interactive "sReport a bug on host: ") + (let ((debian-bug-remote-host host) + (debian-bug-status-file (format "/ssh:%s:%s" host debian-bug-status-file))) + (debian-bug))) + (provide 'debian-bug) ;;; debian-bug.el ends here
It's quite simple-minded, and starts a new SSH connection for each remote command; someone who better understands could probably make it reuse one connection, I think. Another missing feature from my change is that it would be nice to parse remote (tramp) filenames and use them intelligently, but I didn't get motivated enough, so I'm submitting this in the hope that someone (perhaps me, perhaps not) can add it later. -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (900, 'testing'), (900, 'stable'), (400, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32 (SMP w/4 CPU cores; PREEMPT) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages debian-el depends on: ii bzip2 1.0.5-4 high-quality block-sorting file co ii dpkg 1.15.7.1 Debian package management system ii emacs [emacsen] 23.2+1-2 The GNU Emacs editor (metapackage) ii emacs22 [emacsen] 22.3+1-1.2 The GNU Emacs editor ii emacs23 [emacsen] 23.2+1-2 The GNU Emacs editor (with GTK+ us ii file 5.04-2 Determines file type using "magic" ii install-info 4.13a.dfsg.1-5 Manage installed documentation in ii reportbug 4.12.2 reports bugs in the Debian distrib Versions of packages debian-el recommends: ii dlocate 1.02 fast alternative to dpkg -L and dp ii groff-base 1.20.1-10 GNU troff text-formatting system ( ii wget 1.12-2 retrieves files from the web Versions of packages debian-el suggests: pn gnus <none> (no description available) -- no debconf information