From 5378bc9ea3f17d5352e44c1de8f806456670e34c Mon Sep 17 00:00:00 2001 From: Peter S Galbraith Date: Mon, 21 Nov 2016 13:20:03 -0700 Subject: emacs-goodies-el (36.3) unstable; urgency=high * emacs-goodies-el: - Bug fix: "fails to upgrade/install", thanks to Brent S. Elmer (Closes: #845216). Skip byte-compilation for minibuffer-complete-cycle.el on emacs23. [dgit import package emacs-goodies-el 36.3] --- ChangeLog | 322 ++++++++++++++++++++++++++++++++++++++++++++++ devscripts.el | 178 +++++++++++++++++++++++++ pbuilder-log-view-mode.el | 244 +++++++++++++++++++++++++++++++++++ pbuilder-mode.el | 122 ++++++++++++++++++ 4 files changed, 866 insertions(+) create mode 100755 ChangeLog create mode 100755 devscripts.el create mode 100755 pbuilder-log-view-mode.el create mode 100755 pbuilder-mode.el diff --git a/ChangeLog b/ChangeLog new file mode 100755 index 0000000..b6a5287 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,322 @@ +2005-08-21 Junichi Uekawa + + * pbuilder-mode.el (pbuilder-build, pbuilder-user-mode-linux-build): + add \n after 'start compile' message + +2003-10-18 Junichi Uekawa + + * devscripts.el (debdiff): add new function, debdiff + +2003-10-05 Junichi Uekawa + + * Moved all files to alioth. + +2003-09-27 Junichi Uekawa + + * pbuilder-mode.el (pdebuild-user-mode-linux): set buffer-process-coding-system to dos for user-mode-linux output. + fix bug. + (pbuilder-user-mode-linux-build): fix. + +2003-09-18 Junichi Uekawa + + * readme-debian.el: remove from here, alioth has the latest. + * debian-copyright.el: remove from here, alioth has the latest. + +2003-08-25 Junichi Uekawa + + * readme-debian.el (readme-debian-mode): use write-contents-hooks + instead of write-file-hooks, and do not make-local-variable, but + use the add-hook and LOCAL flag. + +2003-06-25 Junichi Uekawa + + * debian-copyright.el: add patch from PSG for font-lock problem in + Xemacs. + +2003-05-25 Junichi Uekawa + + * readme-debian.el: Applied patch from Peter S Galbraith + +2003-05-21 Junichi Uekawa + + * readme-debian.el: accept patch from Peter S Galbraith + for byte-compilation fixes and many cosmetic fixes. + +2003-05-16 Junichi Uekawa + + * readme-debian.el: defgroup/defcustom. + + * pbuilder-log-view-mode.el (pbuilder-log-view-web-basepath): + renamed from pbuilder-log-web-basepath + Change to defgroup/custom. + + * devscripts.el: defgroup. + + * pbuilder-mode.el (pbuilder-mode): defgroup, + and change to defcustom. + +2003-05-14 Junichi Uekawa + + * debian-copyright.el (debian-copyright): fix typo. + (debian-copyright): include patch from Peter S Galbraith. + +2003-05-12 Junichi Uekawa + + * debian-copyright.el: include patch from Peter S Galbraith , who has rewrote most of debian-copyright.el + +2003-04-02 Junichi Uekawa + + * devscripts.el (debclean): add debclean + +2003-02-10 Junichi Uekawa + + * pbuilder-mode.el (pdebuild-user-mode-linux): new function. + (pdebuild-user-mode-linux-path): new variable. + +2003-01-08 Junichi Uekawa + + * pbuilder-mode.el (debuild-pbuilder): convert debuild-pbuilder + to make-comint. + (pbuilder-user-mode-linux-path, pbuilder-user-mode-linux-build): + support pbuilder-user-mode-linux. + +2003-01-07 Junichi Uekawa + + * devscripts.el (debi): try to use comint for starting up, + so that it can run interactive. + +2002-11-27 Junichi Uekawa + + * readme-debian.el (readme-debian-font-lock-keywords) + (readme-debian-mode): Apply patch from + James LewisMoss to make this thing + work with xemacs, and then revert the patch because that + does not really work with emacs21. + +2002-11-10 Junichi Uekawa + + * pbuilder-mode.el: done checkdoc. + + * devscripts.el (devscripts-mode-gain-root-command): done checkdoc. + + * readme-debian.el: done checkdoc. + + * debian-copyright.el: done checkdoc + +2002-10-30 Junichi Uekawa + + * Makefile (distimage): add COPYING file. + + * pbuilder-mode.el (debuild-pbuilder): use debuild-option-list + + * pbuilder-log-view-mode.el (pbuilder-log-view-internal-garbage-collect-log): check the title as well ? + I will only be able to match via title page. + + * pbuilder-mode.el (debuild-pbuilder): introduce debuild-pbuilder function for running debuild-pbuilder hack. + + * pbuilder-log-view-mode.el (pbuilder-log-view-build-result-alist-mutex): change names + (pbuilder-log-view-build-result-alist): change names from debuild-* + +2002-10-29 Junichi Uekawa + + * pbuilder-log-view-mode.el (pbuilder-log-view-add): use mutex lock + (pbuilder-log-view-lock-mutex): mutex lock implementation + (pbuilder-log-view-internal-function): lock mutex. + (mcharset): require. + (pbuilder-log-view-internal-view-one-log): ran checkdoc, and fixed some text. + (pbuilder-log-view-internal-view-one-log): try and use relative paths now. + (pbuilder-log-view-elserv): publish one base path. + (pbuilder-log-view-internal-function): remove the hack to generate list of + available web pages. + + * pbuilder-mode.el (pdebuild): use pbuilder-log-view-add + (pbuilder-build): ditto + + * pbuilder-log-view-mode.el (pbuilder-log-view-add): new function + + * devscripts.el (debuild): use pbuilder-log-view-add function + +2002-10-28 Junichi Uekawa + + * pbuilder-log-view-mode.el (pbuilder-log-view-internal-function): move the function + location to avoid locking up. + garbage collector needs to lock variables, it seems. + (pbuilder-log-view-internal-garbage-collect-log): reverse the listing. + + * htmlize.el (htmlize-buffer-noninteractive): new hack from upstream. + + * pbuilder-log-view-mode.el (pbuilder-log-view-mode): change to + match filename. + (pbuilder-log-web-basepath): move from pbuilder-mode.el + (pbuilder-log-view-internal-garbage-collect-log): try garbage collection. + (pbuilder-log-view-internal-function): try garbage collecting before start. + (pbuilder-log-view-internal-view-one-log): use htmlize-buffer-noninteractive, provided by 0.68? of htmlize.el + + * pbuilder-mode.el (pbuilder-log-view): require. + + * devscripts.el (pbuilder-log-view): require. + + * pbuilder-log-view-mode.el (pbuilder-log-view): provide pbuilder-log-view + + * Makefile (clean): add clean rule. + + * pbuilder-mode.el: remove things from here. + * pbuilder-log-view-mode.el: new file, move things related to logview mode over here. + + * htmlize.el: modified last night, merging the modified version into the tree + until this thing is fixed upstream. + + * pbuilder-mode.el (pbuilder-log-view-elserv): add description + (pdebuild): fixed typo. + +2002-10-27 Junichi Uekawa + + * pbuilder-mode.el (pbuilder-build): give process information for debuild-results-alist + (pdebuild): ditto. + (pbuilder-log-view-internal-function): change the page to use running-status + of process if it is available. + (pbuilder-log-view-internal-function): running-status and exit-status are now used to + generate information. + (pbuilder-log-view-internal-function): add current time to last-updated string ;) + (pbuilder-log-view-internal-function): reorganized to use with-temp-buffer instead of + a massive string variable + (pbuilder-log-view-internal-view-one-log): set-buffer instead of swith-to-buffer + (pbuilder-log-view-internal-view-one-log): use save-excursion instead of save-window-excursion + (pbuilder-log-view-internal-function): use set-buffer + (pbuilder-log-view-internal-view-one-log): change back to save-window-excursion + (pbuilder-log-view-internal-view-one-log): use a newly hacked htmlize-buffer. + + * devscripts.el (debuild-option-list): add -us and -uc, because there is no + reasonable way (currently) to sign debuilt package inside emacs. + (debuild): add process information as third member of debuild-results-alist + + * pbuilder-mode.el (pbuilder-log-view-internal-view-one-log): use htmlize-buffer. + (pbuilder-log-view-internal-view-one-log): kill the htmlized buffer after sending the info. + (pbuilder-log-view-elserv): require 'htmlize on starting the server, because + logs are htmlized. + (pbuilder-log-view-internal-view-one-log): I don't need the concat of progname here. + +2002-10-26 Junichi Uekawa + + * readme-debian.el (readme-debian-mode-load-hook): add * + (readme-debian-mode-hook): new var. + + * pbuilder-mode.el (pbuilder-path, pdebuild-path) + (pbuilder-log-web-basepath): add * + + * devscripts.el (debuild-option-list): add * + (devscripts-mode-gain-root-command): add * + (devscripts-mode-load-hook): add * + + * debian-copyright.el (debian-copyright-mode-load-hook): add * to + documentation string for customizable value. + +2002-10-25 Junichi Uekawa + + * debian-copyright.el (debian-copyright-mode-version): add version string. + + * devscripts.el (devscripts-mode-version): add version string. + + * pbuilder-mode.el (pbuilder-log-view-function): support charsets. + (pbuilder-log-view-elserv, pbuilder-log-view-internal-function): rename function to add "internal" + (pbuilder-log-view-internal-function) + (pbuilder-log-view-internal-view-one-log): experimental dynamic log generation. + (pbuilder-log-view-internal-function): update to be dynamic. + (pbuilder-log-view-internal-function): provide only the dynamic pages. + (pbuilder-log-view-elserv): add more notes to the program. + (pbuilder-mode-version): add version string. + + * devscripts.el (debuild): use devscripts-internal-get-debian-package-name to record the build log. + + * pbuilder-mode.el (pdebuild): use devscripts-internal-get-debian-package-name instead. + + * devscripts.el (debuild-results-alist): move over to devscripts, + from pbuilder var. + (devscripts-internal-get-debian-package-name): new func to get dirname. + + * pbuilder-mode.el (pbuilder-log-view-function) + (pbuilder-log-web-basepath, pbuilder-log-view-elserv): use pbuilder-log-web-basepath + as a variable to define the path for the build logs. + (pbuilder-build): fix name-getting. + (pbuilder-build): use filename instead of default-directory as identifier. + +2002-10-24 Junichi Uekawa + + * pbuilder-mode.el (pbuilder-results-alist): alist for pbuilder + results. + (pdebuild): get the current package name that is being built, and + set the name. + (pbuilder-build): support adding the build log. + (pbuilder-log-view-function): Implementation of elserv log viewer + for pbuilder session. + + * devscripts.el (debuild-option-list): introduce new option. + (debuild): use the option, with apply command, etc. + + * pbuilder-mode.el (pbuilder-build, pdebuild, pdebuild-path) + (pbuilder-path): define variable to specify pbuilder and pdebuild path. + +2002-10-23 Junichi Uekawa + + * pbuilder-mode.el (pdebuild): new file, new code. + (pbuilder-build): implement. + Use devscripts mode variables. + (pbuilder-build): update, use expand-file-name + + * devscripts.el (debuild): add -i option. I want to make this optional. + +2002-10-20 Junichi Uekawa + + * debian-copyright.el (debian-copyright-mode-load-hook): add + + * readme-debian.el (readme-debian-mode-load-hook): add + + * devscripts.el (devscripts-mode-load-hook): add. + +2002-10-19 Junichi Uekawa + + * debian-copyright.el (debian-copyright-mode): create default. + + * readme-debian.el (readme-debian-mode): add mode map doc. + + * debian-copyright.el (auto-mode-alist): create, modify. + + * devscripts.el: add copyright. + +2002-10-17 Junichi Uekawa + + * readme-debian.el (debian-changelog-mode): require debian-changelog-mode + (readme-debian-mode): provide readme-debian-mode, not readme-debian + (readme-debian-update-timestamp): use variables from debian-changelog mode, + not invent my own. + + * devscripts.el: provide devscripts. + +2002-10-16 Junichi Uekawa + + * readme-debian.el: update copyright. + + * devscripts.el (devscripts-debc-mode-syntax-table): fix. + (debi, debit): change, new debit function. Use devscripts-mode-gain-root-command + (devscripts-mode-gain-root-command): new var. + + * readme-debian.el (readme-debian-mode-syntax-table): fix readme-debian-mode-syntax-table. + + * readme-debian.el (readme-debian-mode): add ^[-=]+$ to highlight + (auto-mode-alist): add README.Debian in /usr/share/doc + + * Makefile (RELEASE): create make rules. + +2002-10-15 Junichi Uekawa + + * readme-debian.el (readme-debian-mode): implemented something un-cool about this... + I've done a README.Debian syntax highlighter + (readme-debian-update-timestamp): create a function to change timestamp. + (readme-debian-mode): and add hook to use that function on file write. + (auto-mode-alist): add reamde-debian-mode to auto-mode-alist. + + * devscripts.el (debc, debi, debuild): import from .emacs of myself. + (devscripts-debc-mode): create a good fontmap, so that things are highlighted properly. + + Copyright GPL. + diff --git a/devscripts.el b/devscripts.el new file mode 100755 index 0000000..4c6e64c --- /dev/null +++ b/devscripts.el @@ -0,0 +1,178 @@ +;; Routines to do devscripts-compatible emacs routines. +;; copyright 2002 Junichi Uekawa. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; readme-debian.el is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with your Debian installation, in /usr/share/common-licenses/GPL +;; If not, write to the Free Software Foundation, 675 Mass Ave, +;; Cambridge, MA 02139, USA. + +(require 'pbuilder-log-view-mode) +(require 'comint) + +(defgroup devscripts nil "devscripts mode" + :group 'tools + :prefix "devscripts-") + + +(defcustom debuild-option-list '("-i" "-uc" "-us") "*Options to give to debuild." + :type '(repeat string) + :group 'devscripts) +(defconst devscripts-mode-version "$Id: devscripts.el,v 1.5 2007-07-13 15:13:30 dancer Exp $" "Version of devscripts mode.") + +(defun devscripts-internal-get-debian-package-name () + "Find the directory with debian/ dir, and get the dir name." + (let* ((looking-dir (expand-file-name (concat default-directory ".")))) + (while (not (file-accessible-directory-p (concat looking-dir "/debian"))) + (progn + (if (string= looking-dir "/") + (error "Cannot find debian dir anywhere")) + (setq looking-dir (expand-file-name (expand-file-name (concat looking-dir "/..")))))) + (file-name-nondirectory looking-dir))) + +(defun debuild () + "Run debuild in the current directory." + (interactive) + (let* ((debuild-buffer (concat "*debuild*" default-directory)) + (debuild-process (concat "debuild-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer debuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (pbuilder-log-view-add package-name debuild-buffer (apply 'start-process debuild-process debuild-buffer "/usr/bin/debuild" debuild-option-list)))) + +(defun debi () + "Run debi in the current directory, to install debian packages generated by previous invocation of debuild." + (interactive) + (let* ((debi-name (concat "debi" default-directory)) + (debi-buffer-name (concat "*" debi-name "*"))) + (make-comint debi-name devscripts-mode-gain-root-command + nil "/usr/bin/debi") + (switch-to-buffer debi-buffer-name))) + +(defun debit () + "Run debit in the current directory, to install debian packages generated by previous invocation of debuild." + (interactive) + (let* ((debit-buffer (concat "*debit*" default-directory)) + (debit-process (concat "debit-process-" default-directory))) + (switch-to-buffer debit-buffer) + (kill-region (point-min) (point-max)) + (compilation-mode) + (start-process debit-process debit-buffer devscripts-mode-gain-root-command "/usr/bin/debit"))) + + +(defun debc () + "Run debc in the current directory, to install debian packages generated by previous invocation of debuild." + (interactive) + (let* ((debc-buffer (concat "*debc*" default-directory)) + (debc-process (concat "debc-process-" default-directory))) + (switch-to-buffer debc-buffer) + (kill-region (point-min) (point-max)) + (devscripts-debc-mode) + (start-process debc-process debc-buffer "/usr/bin/debc"))) + +(defun debclean () + "Run debclean in the current directory, to clean the debian build tree." + (interactive) + (let* ((debclean-buffer (concat "*debclean*" default-directory)) + (debclean-process (concat "debclean-process-" default-directory))) + (switch-to-buffer debclean-buffer) + (kill-region (point-min) (point-max)) + (compilation-mode) + (start-process debclean-process debclean-buffer "/usr/bin/debclean"))) + +(defun debdiff (changes-file-1 changes-file-2) + "Compare contents of CHANGES-FILE-1 and CHANGES-FILE-2." + (interactive "fFirst Changes file: \nfSecond Changes File: ") + (let* ((debdiff-buffer (concat "*debdiff*" default-directory)) + (debdiff-process (concat "debdiff-process-" default-directory))) + (switch-to-buffer debdiff-buffer) + (kill-region (point-min) (point-max)) + (start-process debdiff-process debdiff-buffer "/usr/bin/debdiff" + (expand-file-name changes-file-1) + (expand-file-name changes-file-2)))) + +(defun debdiff-current () + "Compare the contents of .changes file of current version with previous version; +requires access to debian/changelog, and being in debian/ dir." + (interactive) + (let* ((debdiff-buffer (concat "*debdiff*" default-directory)) + (debdiff-process (concat "debdiff-process-" default-directory)) + (debug-on-error t) + newversion oldversion pkgname changes-file-1 changes-file-2) + (find-file "changelog") + (save-excursion + (goto-char (point-min)) + (re-search-forward "^\\(\\S-+\\) +(\\([^:)]*:\\)?\\([^)]*\\))" nil t) + (setq newversion (match-string 3)) + (setq pkgname (match-string 1)) + (re-search-forward "^\\(\\S-+\\) +(\\([^:)]*:\\)?\\([^)]*\\))" nil t) + (setq oldversion (match-string 3))) + (setq changes-file-1 + (car (file-expand-wildcards (concat default-directory "../../" pkgname "_" oldversion "_*.changes")))) + (setq changes-file-2 + (car (file-expand-wildcards (concat default-directory "../../" pkgname "_" newversion "_*.changes")))) + (princ pkgname) + (princ oldversion) + (princ changes-file-1) + (princ changes-file-2) + (switch-to-buffer debdiff-buffer) + (kill-region (point-min) (point-max)) + (insert (concat + "Comparing " + (file-name-nondirectory changes-file-1) " and " + (file-name-nondirectory changes-file-2) "\n")) + (start-process debdiff-process debdiff-buffer "/usr/bin/debdiff" + (expand-file-name changes-file-1) + (expand-file-name changes-file-2)))) + +(defun devscripts-debc-mode () + "Mode to view debc output. +\\{devscripts-debc-mode-map}" + (interactive) + (kill-all-local-variables) + (setq major-mode 'devscripts-debc-mode) + (setq mode-name "debc") + (mapcar 'make-local-variable '(font-lock-defaults)) + (use-local-map devscripts-debc-mode-map) + (set-syntax-table devscripts-debc-mode-syntax-table) + (setq font-lock-defaults + '( + ;keywords start here + (("^[a-z].*deb$" . font-lock-string-face) + ("^ \\([A-Z][-A-Za-z]+:\\)\\(.*\\)$" (1 font-lock-keyword-face) (2 font-lock-warning-face)) + ("^[^ ].*$" . font-lock-comment-face) + ) + nil ;keywords-only + nil ;case-fold + () ;syntax-alist + )) + (run-hooks 'devscripts-debc-mode-hook) +) + +(defvar devscripts-debc-mode-map nil "Keymap for devscripts debc mode.") +(defvar devscripts-debc-mode-syntax-table nil "Syntax table for devscripts debc mode.") +(if devscripts-debc-mode-syntax-table + () ; Do not change the table if it is already set up. + (setq devscripts-debc-mode-syntax-table (make-syntax-table)) + (modify-syntax-entry ?\" ". " devscripts-debc-mode-syntax-table) + (modify-syntax-entry ?\\ ". " devscripts-debc-mode-syntax-table) + (modify-syntax-entry ?' "w " devscripts-debc-mode-syntax-table)) +(defcustom devscripts-mode-gain-root-command "/usr/bin/sudo" "*The command used to gain root for running debi and debit." + :group 'devscripts + :type 'file) +(defcustom devscripts-mode-load-hook nil "*Hooks that are run when devscripts-mode is loaded." + :group 'devscripts + :type 'hook) +(run-hooks 'devscripts-mode-load-hook) +(provide 'devscripts) diff --git a/pbuilder-log-view-mode.el b/pbuilder-log-view-mode.el new file mode 100755 index 0000000..db3db13 --- /dev/null +++ b/pbuilder-log-view-mode.el @@ -0,0 +1,244 @@ +;; Routines to do devscripts-compatible emacs routines. +;; copyright 2002 Junichi Uekawa. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; readme-debian.el is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with your Debian installation, in /usr/share/common-licenses/GPL +;; If not, write to the Free Software Foundation, 675 Mass Ave, +;; Cambridge, MA 02139, USA. + +(require 'mcharset) +(defgroup pbuilder-log-view nil "Pbuilder log view mode" + :group 'tools + :prefix "pbuilder-log-view-") + +(defcustom pbuilder-log-view-web-basepath "/~pbuilder/" "*Elserv path to pbuilder logs." + :type 'string + :group 'pbuilder-log-view) + +(defvar pbuilder-log-view-build-result-alist nil + "Associated list of results of the pbuilder/debuild runs. +They are in (package result-buffer-name process-name(if process exists)) + +When this variable is being accessed, set `pbuilder-log-view-build-result-alist-mutex' to t.") + +(defvar pbuilder-log-view-build-result-alist-mutex nil + "The access-control for `pbuilder-log-view-build-result-alist'. +If someone is accessing that var, it is t") + +;; potential new interface? +(defvar pbuilder-log-view-results-plist nil + "Property list of results of the pbuilder/debuild runs. +:package +:result-buffer-name +:process-name") + +;; mutex lock implementation thanks to TSUCHIYA Masatoshi +(defmacro pbuilder-log-view-lock-mutex (mutex &rest body) + "Try to mutex-lock a variable MUTEX, and run BODY. + +The MUTEX needs to be nil." + `(progn + (while ,mutex + (accept-process-output nil 0 200)) + (setq ,mutex t) + ,@body + (setq ,mutex nil))) + +;; The following code does publishing for elserv. +;; elserv-start, then run pbuilder-log-view-elserv + +(defun pbuilder-log-view-add (package-name buffer-name running-process) + "Add the entry to the log view list. + +\(PACKAGE-NAME, BUFFER-NAME, RUNNING-PROCESS\) will be added to +`pbuilder-log-view-build-result-alist'. + +Argument PACKAGE-NAME is the name of the package." + (pbuilder-log-view-lock-mutex + pbuilder-log-view-build-result-alist-mutex + (add-to-list 'pbuilder-log-view-build-result-alist (list package-name buffer-name running-process)))) + +(defun pbuilder-log-view-internal-garbage-collect-log () + "Remove unneeded entries from the log listing." + (setq pbuilder-log-view-build-result-alist + (let* (new-data current-is-okay) + (dolist (entry pbuilder-log-view-build-result-alist) + (setq current-is-okay t) + (if (get-buffer (cadr entry)) + (dolist (new-data-element new-data) + (if (string= (cadr new-data-element) (cadr entry)) + (setq current-is-okay nil)) + (if (string= (car new-data-element) (car entry)) + (setq current-is-okay nil))) + (setq current-is-okay nil)) + (if current-is-okay + (add-to-list 'new-data entry))) + (reverse new-data)))) + +(defun pbuilder-log-view-internal-view-one-log (result path ppath request) + "View one logfile from buffer. + +Requires a newish htmlize.el +RESULT is the resulting value +PATH is relative path from the published path +PPATH is the published path +REQUEST is the request data." + (let* (logname matching-assoc nowlist charset) + (string-match "/\\?\\(.+\\).html$" path) + (setq logname (match-string 1 path)) + (setq nowlist (assoc logname pbuilder-log-view-build-result-alist)) + (if nowlist + (save-window-excursion + (if (get-buffer (cadr nowlist)) + (progn + (let* ((htmlize-major-mode nil)) + (set-buffer (htmlize-buffer-noninteractive (cadr nowlist)))) + (setq charset (detect-mime-charset-region (point-min)(point-max))) + (elserv-set-result-header + result + (list 'content-type (concat "text/html; charset=" (symbol-name charset)))) + (elserv-set-result-body result + (encode-mime-charset-string (buffer-string) charset)) + (kill-buffer (current-buffer))) + (elserv-set-result-header result (list 'content-type (concat "text/plain"))) + (elserv-set-result-body result "404?"))) + (elserv-set-result-header result (list 'content-type (concat "text/plain"))) + (elserv-set-result-body result "404p")))) + +;; some code sampled from remote.el from elserv sources. +(defun pbuilder-log-view-internal-function (result path ppath request) + "Elserv publish function for pbuilder logs. +RESULT, PATH, PPATH and REQUEST are arguments + +This page presents the list of build logs available from this Emacs session" + (pbuilder-log-view-lock-mutex + pbuilder-log-view-build-result-alist-mutex + (pbuilder-log-view-internal-garbage-collect-log)) + (save-window-excursion + (with-temp-buffer + (elserv-set-result-header result + '(content-type "text/html")) + (insert (concat " + + +List of builds + + + +

List of builds done in the emacs session

+
    +")) + (pbuilder-log-view-lock-mutex + pbuilder-log-view-build-result-alist-mutex + (dolist (nowlist pbuilder-log-view-build-result-alist) + (if (get-buffer (cadr nowlist)) + (let* ((running-status + (if (caddr nowlist) (symbol-name (process-status (caddr nowlist))) + "nil"))) + (insert (concat "
  • " + (car nowlist) + " " + running-status + (if (string= running-status "exit") + (if (= (process-exit-status (caddr nowlist)) 0) + ": Successful build" + ": Build failure") + "") + "
  • \n"))))) + (insert (concat "

Last updated:" + (current-time-string) + "

\n")) + (elserv-set-result-body + result + (buffer-string)))))) + +(defcustom pbuilder-log-view-css " +BODY{ +color: #ffeeee; +background-color: #000055; +} +h1.title{ + margin-top: 0em; + border-color: #99c; + border-width: 0px 9px 4px 0px; + border-style: solid; +} +div.listing{ + margin-top: 0em; + border-color: #99c; + border-width: 0px 0px 4px 9px; + border-style: solid; +} +li.package{ +} +a:link { + color: #ffccff; +} +a:active { + color: #eeeeee; +} +a:hover { + color: #ffffff; + background-color: #5555ff; +} +a:visited { + color: #ddeedd; +} +span.status{ + color: #ffffff; + background-color: #000000; +} +span.buildfail{ + color: #ff3300; + background-color: #000000; +} +span.buildsuccess{ + color: #00aaff; + background-color: #000000; +} +" "*Css-string to be added to pbuilder log listing view html page. +h1.title +div.listing +ul.listing +li.package +a.package +span.status +span.buildfail +span.buildsuccess" + :type 'text + :group 'pbuilder-log-view) + +(defun pbuilder-log-view-elserv () + "Run a elserv session with log view. + +Running this requires elserv. Use elserv, and do `elserv-start' before invoking this command." + (interactive) + (require 'elserv) + (require 'htmlize) + (elserv-publish (elserv-find-process) + pbuilder-log-view-web-basepath + :function 'pbuilder-log-view-internal-function + :description "Build log listing" + ) + (elserv-publish (elserv-find-process) + (concat pbuilder-log-view-web-basepath "query.cgi") + :function 'pbuilder-log-view-internal-view-one-log + :description "Build log database query")) + + +(provide 'pbuilder-log-view-mode) + + diff --git a/pbuilder-mode.el b/pbuilder-mode.el new file mode 100755 index 0000000..c24770a --- /dev/null +++ b/pbuilder-mode.el @@ -0,0 +1,122 @@ +;; Routines to do devscripts-compatible emacs routines. +;; copyright 2002 Junichi Uekawa. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; readme-debian.el is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with your Debian installation, in /usr/share/common-licenses/GPL +;; If not, write to the Free Software Foundation, 675 Mass Ave, +;; Cambridge, MA 02139, USA. + +(require 'devscripts) +(require 'pbuilder-log-view-mode) + +(defgroup pbuilder nil "PBuilder mode" + :group 'tools + :prefix "pbuilder-mode-") + +(defcustom pbuilder-path "/usr/sbin/pbuilder" + "*Path to pbuilder." + :group 'pbuilder + :type 'file) +(defcustom pbuilder-user-mode-linux-path "/usr/bin/pbuilder-user-mode-linux" "*Path to pbuilder-user-mode-linux." + :group 'pbuilder + :type 'file) +(defcustom pdebuild-path "/usr/bin/pdebuild" "*Path to pdebuild." + :group 'pbuilder + :type 'file) +(defcustom pdebuild-user-mode-linux-path "/usr/bin/pdebuild-user-mode-linux" "*Path to pdebuild-user-mode-linux." + :group 'pbuilder + :type 'file) +(defcustom debuild-pbuilder-path "/usr/bin/debuild-pbuilder" "*Path to `debuild-pbuilder'." + :group 'pbuilder + :type 'file) +(defconst pbuilder-mode-version "$Id: pbuilder-mode.el,v 1.3 2007-07-14 09:26:05 dancer Exp $" "Version of pbuilder mode.") + +(defun pdebuild () + "Run pdebuild in the current directory." + (interactive) + (let* ((pdebuild-buffer (concat "*pdebuild*" default-directory)) + (pdebuild-process (concat "pdebuild-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer pdebuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (pbuilder-log-view-add + package-name pdebuild-buffer + (start-process pdebuild-process pdebuild-buffer pdebuild-path)))) + +(defun pdebuild-user-mode-linux () + "Run pdebuild-user-mode-linux in the current directory." + (interactive) + (let* ((pdebuild-buffer (concat "*pdebuild*" default-directory)) + (pdebuild-process (concat "pdebuild-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer pdebuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (pbuilder-log-view-add + package-name pdebuild-buffer + (start-process pdebuild-process pdebuild-buffer pdebuild-user-mode-linux-path)) + (set-buffer-process-coding-system 'dos 'dos))) + +(defun debuild-pbuilder () + "Run `debuild-pbuilder' in the current directory." + (interactive) + + (let* ((pdebuild-name (concat "debuild-pbuilder" default-directory)) + (pdebuild-buffer (concat "*" pdebuild-name "*" )) + (pdebuild-process (concat "debuild-pbuilder-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer pdebuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (pbuilder-log-view-add + package-name + (apply 'make-comint pdebuild-name debuild-pbuilder-path nil + debuild-option-list) + (get-process pdebuild-name)))) + +(defun pbuilder-build (filename) + "Run pbuilder build for a given FILENAME. +Uses `devscripts-mode-gain-root-command' as command to gain root." + (interactive "f.dsc File name: ") + (let* ((pbuilder-buffer (concat "*pbuilder-build*" filename)) + (pbuilder-process (concat "pbuilder-build-process-" filename))) + (switch-to-buffer pbuilder-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (insert "start compile\n") + (pbuilder-log-view-add + (file-name-sans-extension (file-name-nondirectory filename)) pbuilder-buffer + (start-process pbuilder-process pbuilder-buffer devscripts-mode-gain-root-command pbuilder-path "build" (expand-file-name filename))))) + +(defun pbuilder-user-mode-linux-build (filename) + "Run pbuilder-user-mode-linux build for a given FILENAME. " + (interactive "f.dsc File name: ") + (let* ((pbuilder-buffer (concat "*pbuilder-uml-build*" filename)) + (pbuilder-process (concat "pbuilder-uml-build-process-" filename))) + (switch-to-buffer pbuilder-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (insert "start compile\n") + (pbuilder-log-view-add + (file-name-sans-extension (file-name-nondirectory filename)) pbuilder-buffer + (start-process pbuilder-process pbuilder-buffer pbuilder-user-mode-linux-path "build" (expand-file-name filename))) + (set-buffer-process-coding-system 'dos 'dos))) + + + +(provide 'pbuilder-mode) -- cgit v1.2.3 From a40dcfe0bf9f8727e1335a1ab36022acacd046ab Mon Sep 17 00:00:00 2001 From: Julian Gilbey Date: Fri, 23 Mar 2018 00:37:08 +0800 Subject: emacs-goodies-el (36.4) unstable; urgency=medium * Move to salsa.debian.org; update Vcs-Browser and Vcs-Git in debian/control [dgit import package emacs-goodies-el 36.4] --- ChangeLog | 322 ++++++++++++++++++++++++++++++++++++++++++++++ devscripts.el | 178 +++++++++++++++++++++++++ pbuilder-log-view-mode.el | 244 +++++++++++++++++++++++++++++++++++ pbuilder-mode.el | 122 ++++++++++++++++++ 4 files changed, 866 insertions(+) create mode 100755 ChangeLog create mode 100755 devscripts.el create mode 100755 pbuilder-log-view-mode.el create mode 100755 pbuilder-mode.el diff --git a/ChangeLog b/ChangeLog new file mode 100755 index 0000000..b6a5287 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,322 @@ +2005-08-21 Junichi Uekawa + + * pbuilder-mode.el (pbuilder-build, pbuilder-user-mode-linux-build): + add \n after 'start compile' message + +2003-10-18 Junichi Uekawa + + * devscripts.el (debdiff): add new function, debdiff + +2003-10-05 Junichi Uekawa + + * Moved all files to alioth. + +2003-09-27 Junichi Uekawa + + * pbuilder-mode.el (pdebuild-user-mode-linux): set buffer-process-coding-system to dos for user-mode-linux output. + fix bug. + (pbuilder-user-mode-linux-build): fix. + +2003-09-18 Junichi Uekawa + + * readme-debian.el: remove from here, alioth has the latest. + * debian-copyright.el: remove from here, alioth has the latest. + +2003-08-25 Junichi Uekawa + + * readme-debian.el (readme-debian-mode): use write-contents-hooks + instead of write-file-hooks, and do not make-local-variable, but + use the add-hook and LOCAL flag. + +2003-06-25 Junichi Uekawa + + * debian-copyright.el: add patch from PSG for font-lock problem in + Xemacs. + +2003-05-25 Junichi Uekawa + + * readme-debian.el: Applied patch from Peter S Galbraith + +2003-05-21 Junichi Uekawa + + * readme-debian.el: accept patch from Peter S Galbraith + for byte-compilation fixes and many cosmetic fixes. + +2003-05-16 Junichi Uekawa + + * readme-debian.el: defgroup/defcustom. + + * pbuilder-log-view-mode.el (pbuilder-log-view-web-basepath): + renamed from pbuilder-log-web-basepath + Change to defgroup/custom. + + * devscripts.el: defgroup. + + * pbuilder-mode.el (pbuilder-mode): defgroup, + and change to defcustom. + +2003-05-14 Junichi Uekawa + + * debian-copyright.el (debian-copyright): fix typo. + (debian-copyright): include patch from Peter S Galbraith. + +2003-05-12 Junichi Uekawa + + * debian-copyright.el: include patch from Peter S Galbraith , who has rewrote most of debian-copyright.el + +2003-04-02 Junichi Uekawa + + * devscripts.el (debclean): add debclean + +2003-02-10 Junichi Uekawa + + * pbuilder-mode.el (pdebuild-user-mode-linux): new function. + (pdebuild-user-mode-linux-path): new variable. + +2003-01-08 Junichi Uekawa + + * pbuilder-mode.el (debuild-pbuilder): convert debuild-pbuilder + to make-comint. + (pbuilder-user-mode-linux-path, pbuilder-user-mode-linux-build): + support pbuilder-user-mode-linux. + +2003-01-07 Junichi Uekawa + + * devscripts.el (debi): try to use comint for starting up, + so that it can run interactive. + +2002-11-27 Junichi Uekawa + + * readme-debian.el (readme-debian-font-lock-keywords) + (readme-debian-mode): Apply patch from + James LewisMoss to make this thing + work with xemacs, and then revert the patch because that + does not really work with emacs21. + +2002-11-10 Junichi Uekawa + + * pbuilder-mode.el: done checkdoc. + + * devscripts.el (devscripts-mode-gain-root-command): done checkdoc. + + * readme-debian.el: done checkdoc. + + * debian-copyright.el: done checkdoc + +2002-10-30 Junichi Uekawa + + * Makefile (distimage): add COPYING file. + + * pbuilder-mode.el (debuild-pbuilder): use debuild-option-list + + * pbuilder-log-view-mode.el (pbuilder-log-view-internal-garbage-collect-log): check the title as well ? + I will only be able to match via title page. + + * pbuilder-mode.el (debuild-pbuilder): introduce debuild-pbuilder function for running debuild-pbuilder hack. + + * pbuilder-log-view-mode.el (pbuilder-log-view-build-result-alist-mutex): change names + (pbuilder-log-view-build-result-alist): change names from debuild-* + +2002-10-29 Junichi Uekawa + + * pbuilder-log-view-mode.el (pbuilder-log-view-add): use mutex lock + (pbuilder-log-view-lock-mutex): mutex lock implementation + (pbuilder-log-view-internal-function): lock mutex. + (mcharset): require. + (pbuilder-log-view-internal-view-one-log): ran checkdoc, and fixed some text. + (pbuilder-log-view-internal-view-one-log): try and use relative paths now. + (pbuilder-log-view-elserv): publish one base path. + (pbuilder-log-view-internal-function): remove the hack to generate list of + available web pages. + + * pbuilder-mode.el (pdebuild): use pbuilder-log-view-add + (pbuilder-build): ditto + + * pbuilder-log-view-mode.el (pbuilder-log-view-add): new function + + * devscripts.el (debuild): use pbuilder-log-view-add function + +2002-10-28 Junichi Uekawa + + * pbuilder-log-view-mode.el (pbuilder-log-view-internal-function): move the function + location to avoid locking up. + garbage collector needs to lock variables, it seems. + (pbuilder-log-view-internal-garbage-collect-log): reverse the listing. + + * htmlize.el (htmlize-buffer-noninteractive): new hack from upstream. + + * pbuilder-log-view-mode.el (pbuilder-log-view-mode): change to + match filename. + (pbuilder-log-web-basepath): move from pbuilder-mode.el + (pbuilder-log-view-internal-garbage-collect-log): try garbage collection. + (pbuilder-log-view-internal-function): try garbage collecting before start. + (pbuilder-log-view-internal-view-one-log): use htmlize-buffer-noninteractive, provided by 0.68? of htmlize.el + + * pbuilder-mode.el (pbuilder-log-view): require. + + * devscripts.el (pbuilder-log-view): require. + + * pbuilder-log-view-mode.el (pbuilder-log-view): provide pbuilder-log-view + + * Makefile (clean): add clean rule. + + * pbuilder-mode.el: remove things from here. + * pbuilder-log-view-mode.el: new file, move things related to logview mode over here. + + * htmlize.el: modified last night, merging the modified version into the tree + until this thing is fixed upstream. + + * pbuilder-mode.el (pbuilder-log-view-elserv): add description + (pdebuild): fixed typo. + +2002-10-27 Junichi Uekawa + + * pbuilder-mode.el (pbuilder-build): give process information for debuild-results-alist + (pdebuild): ditto. + (pbuilder-log-view-internal-function): change the page to use running-status + of process if it is available. + (pbuilder-log-view-internal-function): running-status and exit-status are now used to + generate information. + (pbuilder-log-view-internal-function): add current time to last-updated string ;) + (pbuilder-log-view-internal-function): reorganized to use with-temp-buffer instead of + a massive string variable + (pbuilder-log-view-internal-view-one-log): set-buffer instead of swith-to-buffer + (pbuilder-log-view-internal-view-one-log): use save-excursion instead of save-window-excursion + (pbuilder-log-view-internal-function): use set-buffer + (pbuilder-log-view-internal-view-one-log): change back to save-window-excursion + (pbuilder-log-view-internal-view-one-log): use a newly hacked htmlize-buffer. + + * devscripts.el (debuild-option-list): add -us and -uc, because there is no + reasonable way (currently) to sign debuilt package inside emacs. + (debuild): add process information as third member of debuild-results-alist + + * pbuilder-mode.el (pbuilder-log-view-internal-view-one-log): use htmlize-buffer. + (pbuilder-log-view-internal-view-one-log): kill the htmlized buffer after sending the info. + (pbuilder-log-view-elserv): require 'htmlize on starting the server, because + logs are htmlized. + (pbuilder-log-view-internal-view-one-log): I don't need the concat of progname here. + +2002-10-26 Junichi Uekawa + + * readme-debian.el (readme-debian-mode-load-hook): add * + (readme-debian-mode-hook): new var. + + * pbuilder-mode.el (pbuilder-path, pdebuild-path) + (pbuilder-log-web-basepath): add * + + * devscripts.el (debuild-option-list): add * + (devscripts-mode-gain-root-command): add * + (devscripts-mode-load-hook): add * + + * debian-copyright.el (debian-copyright-mode-load-hook): add * to + documentation string for customizable value. + +2002-10-25 Junichi Uekawa + + * debian-copyright.el (debian-copyright-mode-version): add version string. + + * devscripts.el (devscripts-mode-version): add version string. + + * pbuilder-mode.el (pbuilder-log-view-function): support charsets. + (pbuilder-log-view-elserv, pbuilder-log-view-internal-function): rename function to add "internal" + (pbuilder-log-view-internal-function) + (pbuilder-log-view-internal-view-one-log): experimental dynamic log generation. + (pbuilder-log-view-internal-function): update to be dynamic. + (pbuilder-log-view-internal-function): provide only the dynamic pages. + (pbuilder-log-view-elserv): add more notes to the program. + (pbuilder-mode-version): add version string. + + * devscripts.el (debuild): use devscripts-internal-get-debian-package-name to record the build log. + + * pbuilder-mode.el (pdebuild): use devscripts-internal-get-debian-package-name instead. + + * devscripts.el (debuild-results-alist): move over to devscripts, + from pbuilder var. + (devscripts-internal-get-debian-package-name): new func to get dirname. + + * pbuilder-mode.el (pbuilder-log-view-function) + (pbuilder-log-web-basepath, pbuilder-log-view-elserv): use pbuilder-log-web-basepath + as a variable to define the path for the build logs. + (pbuilder-build): fix name-getting. + (pbuilder-build): use filename instead of default-directory as identifier. + +2002-10-24 Junichi Uekawa + + * pbuilder-mode.el (pbuilder-results-alist): alist for pbuilder + results. + (pdebuild): get the current package name that is being built, and + set the name. + (pbuilder-build): support adding the build log. + (pbuilder-log-view-function): Implementation of elserv log viewer + for pbuilder session. + + * devscripts.el (debuild-option-list): introduce new option. + (debuild): use the option, with apply command, etc. + + * pbuilder-mode.el (pbuilder-build, pdebuild, pdebuild-path) + (pbuilder-path): define variable to specify pbuilder and pdebuild path. + +2002-10-23 Junichi Uekawa + + * pbuilder-mode.el (pdebuild): new file, new code. + (pbuilder-build): implement. + Use devscripts mode variables. + (pbuilder-build): update, use expand-file-name + + * devscripts.el (debuild): add -i option. I want to make this optional. + +2002-10-20 Junichi Uekawa + + * debian-copyright.el (debian-copyright-mode-load-hook): add + + * readme-debian.el (readme-debian-mode-load-hook): add + + * devscripts.el (devscripts-mode-load-hook): add. + +2002-10-19 Junichi Uekawa + + * debian-copyright.el (debian-copyright-mode): create default. + + * readme-debian.el (readme-debian-mode): add mode map doc. + + * debian-copyright.el (auto-mode-alist): create, modify. + + * devscripts.el: add copyright. + +2002-10-17 Junichi Uekawa + + * readme-debian.el (debian-changelog-mode): require debian-changelog-mode + (readme-debian-mode): provide readme-debian-mode, not readme-debian + (readme-debian-update-timestamp): use variables from debian-changelog mode, + not invent my own. + + * devscripts.el: provide devscripts. + +2002-10-16 Junichi Uekawa + + * readme-debian.el: update copyright. + + * devscripts.el (devscripts-debc-mode-syntax-table): fix. + (debi, debit): change, new debit function. Use devscripts-mode-gain-root-command + (devscripts-mode-gain-root-command): new var. + + * readme-debian.el (readme-debian-mode-syntax-table): fix readme-debian-mode-syntax-table. + + * readme-debian.el (readme-debian-mode): add ^[-=]+$ to highlight + (auto-mode-alist): add README.Debian in /usr/share/doc + + * Makefile (RELEASE): create make rules. + +2002-10-15 Junichi Uekawa + + * readme-debian.el (readme-debian-mode): implemented something un-cool about this... + I've done a README.Debian syntax highlighter + (readme-debian-update-timestamp): create a function to change timestamp. + (readme-debian-mode): and add hook to use that function on file write. + (auto-mode-alist): add reamde-debian-mode to auto-mode-alist. + + * devscripts.el (debc, debi, debuild): import from .emacs of myself. + (devscripts-debc-mode): create a good fontmap, so that things are highlighted properly. + + Copyright GPL. + diff --git a/devscripts.el b/devscripts.el new file mode 100755 index 0000000..4c6e64c --- /dev/null +++ b/devscripts.el @@ -0,0 +1,178 @@ +;; Routines to do devscripts-compatible emacs routines. +;; copyright 2002 Junichi Uekawa. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; readme-debian.el is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with your Debian installation, in /usr/share/common-licenses/GPL +;; If not, write to the Free Software Foundation, 675 Mass Ave, +;; Cambridge, MA 02139, USA. + +(require 'pbuilder-log-view-mode) +(require 'comint) + +(defgroup devscripts nil "devscripts mode" + :group 'tools + :prefix "devscripts-") + + +(defcustom debuild-option-list '("-i" "-uc" "-us") "*Options to give to debuild." + :type '(repeat string) + :group 'devscripts) +(defconst devscripts-mode-version "$Id: devscripts.el,v 1.5 2007-07-13 15:13:30 dancer Exp $" "Version of devscripts mode.") + +(defun devscripts-internal-get-debian-package-name () + "Find the directory with debian/ dir, and get the dir name." + (let* ((looking-dir (expand-file-name (concat default-directory ".")))) + (while (not (file-accessible-directory-p (concat looking-dir "/debian"))) + (progn + (if (string= looking-dir "/") + (error "Cannot find debian dir anywhere")) + (setq looking-dir (expand-file-name (expand-file-name (concat looking-dir "/..")))))) + (file-name-nondirectory looking-dir))) + +(defun debuild () + "Run debuild in the current directory." + (interactive) + (let* ((debuild-buffer (concat "*debuild*" default-directory)) + (debuild-process (concat "debuild-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer debuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (pbuilder-log-view-add package-name debuild-buffer (apply 'start-process debuild-process debuild-buffer "/usr/bin/debuild" debuild-option-list)))) + +(defun debi () + "Run debi in the current directory, to install debian packages generated by previous invocation of debuild." + (interactive) + (let* ((debi-name (concat "debi" default-directory)) + (debi-buffer-name (concat "*" debi-name "*"))) + (make-comint debi-name devscripts-mode-gain-root-command + nil "/usr/bin/debi") + (switch-to-buffer debi-buffer-name))) + +(defun debit () + "Run debit in the current directory, to install debian packages generated by previous invocation of debuild." + (interactive) + (let* ((debit-buffer (concat "*debit*" default-directory)) + (debit-process (concat "debit-process-" default-directory))) + (switch-to-buffer debit-buffer) + (kill-region (point-min) (point-max)) + (compilation-mode) + (start-process debit-process debit-buffer devscripts-mode-gain-root-command "/usr/bin/debit"))) + + +(defun debc () + "Run debc in the current directory, to install debian packages generated by previous invocation of debuild." + (interactive) + (let* ((debc-buffer (concat "*debc*" default-directory)) + (debc-process (concat "debc-process-" default-directory))) + (switch-to-buffer debc-buffer) + (kill-region (point-min) (point-max)) + (devscripts-debc-mode) + (start-process debc-process debc-buffer "/usr/bin/debc"))) + +(defun debclean () + "Run debclean in the current directory, to clean the debian build tree." + (interactive) + (let* ((debclean-buffer (concat "*debclean*" default-directory)) + (debclean-process (concat "debclean-process-" default-directory))) + (switch-to-buffer debclean-buffer) + (kill-region (point-min) (point-max)) + (compilation-mode) + (start-process debclean-process debclean-buffer "/usr/bin/debclean"))) + +(defun debdiff (changes-file-1 changes-file-2) + "Compare contents of CHANGES-FILE-1 and CHANGES-FILE-2." + (interactive "fFirst Changes file: \nfSecond Changes File: ") + (let* ((debdiff-buffer (concat "*debdiff*" default-directory)) + (debdiff-process (concat "debdiff-process-" default-directory))) + (switch-to-buffer debdiff-buffer) + (kill-region (point-min) (point-max)) + (start-process debdiff-process debdiff-buffer "/usr/bin/debdiff" + (expand-file-name changes-file-1) + (expand-file-name changes-file-2)))) + +(defun debdiff-current () + "Compare the contents of .changes file of current version with previous version; +requires access to debian/changelog, and being in debian/ dir." + (interactive) + (let* ((debdiff-buffer (concat "*debdiff*" default-directory)) + (debdiff-process (concat "debdiff-process-" default-directory)) + (debug-on-error t) + newversion oldversion pkgname changes-file-1 changes-file-2) + (find-file "changelog") + (save-excursion + (goto-char (point-min)) + (re-search-forward "^\\(\\S-+\\) +(\\([^:)]*:\\)?\\([^)]*\\))" nil t) + (setq newversion (match-string 3)) + (setq pkgname (match-string 1)) + (re-search-forward "^\\(\\S-+\\) +(\\([^:)]*:\\)?\\([^)]*\\))" nil t) + (setq oldversion (match-string 3))) + (setq changes-file-1 + (car (file-expand-wildcards (concat default-directory "../../" pkgname "_" oldversion "_*.changes")))) + (setq changes-file-2 + (car (file-expand-wildcards (concat default-directory "../../" pkgname "_" newversion "_*.changes")))) + (princ pkgname) + (princ oldversion) + (princ changes-file-1) + (princ changes-file-2) + (switch-to-buffer debdiff-buffer) + (kill-region (point-min) (point-max)) + (insert (concat + "Comparing " + (file-name-nondirectory changes-file-1) " and " + (file-name-nondirectory changes-file-2) "\n")) + (start-process debdiff-process debdiff-buffer "/usr/bin/debdiff" + (expand-file-name changes-file-1) + (expand-file-name changes-file-2)))) + +(defun devscripts-debc-mode () + "Mode to view debc output. +\\{devscripts-debc-mode-map}" + (interactive) + (kill-all-local-variables) + (setq major-mode 'devscripts-debc-mode) + (setq mode-name "debc") + (mapcar 'make-local-variable '(font-lock-defaults)) + (use-local-map devscripts-debc-mode-map) + (set-syntax-table devscripts-debc-mode-syntax-table) + (setq font-lock-defaults + '( + ;keywords start here + (("^[a-z].*deb$" . font-lock-string-face) + ("^ \\([A-Z][-A-Za-z]+:\\)\\(.*\\)$" (1 font-lock-keyword-face) (2 font-lock-warning-face)) + ("^[^ ].*$" . font-lock-comment-face) + ) + nil ;keywords-only + nil ;case-fold + () ;syntax-alist + )) + (run-hooks 'devscripts-debc-mode-hook) +) + +(defvar devscripts-debc-mode-map nil "Keymap for devscripts debc mode.") +(defvar devscripts-debc-mode-syntax-table nil "Syntax table for devscripts debc mode.") +(if devscripts-debc-mode-syntax-table + () ; Do not change the table if it is already set up. + (setq devscripts-debc-mode-syntax-table (make-syntax-table)) + (modify-syntax-entry ?\" ". " devscripts-debc-mode-syntax-table) + (modify-syntax-entry ?\\ ". " devscripts-debc-mode-syntax-table) + (modify-syntax-entry ?' "w " devscripts-debc-mode-syntax-table)) +(defcustom devscripts-mode-gain-root-command "/usr/bin/sudo" "*The command used to gain root for running debi and debit." + :group 'devscripts + :type 'file) +(defcustom devscripts-mode-load-hook nil "*Hooks that are run when devscripts-mode is loaded." + :group 'devscripts + :type 'hook) +(run-hooks 'devscripts-mode-load-hook) +(provide 'devscripts) diff --git a/pbuilder-log-view-mode.el b/pbuilder-log-view-mode.el new file mode 100755 index 0000000..db3db13 --- /dev/null +++ b/pbuilder-log-view-mode.el @@ -0,0 +1,244 @@ +;; Routines to do devscripts-compatible emacs routines. +;; copyright 2002 Junichi Uekawa. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; readme-debian.el is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with your Debian installation, in /usr/share/common-licenses/GPL +;; If not, write to the Free Software Foundation, 675 Mass Ave, +;; Cambridge, MA 02139, USA. + +(require 'mcharset) +(defgroup pbuilder-log-view nil "Pbuilder log view mode" + :group 'tools + :prefix "pbuilder-log-view-") + +(defcustom pbuilder-log-view-web-basepath "/~pbuilder/" "*Elserv path to pbuilder logs." + :type 'string + :group 'pbuilder-log-view) + +(defvar pbuilder-log-view-build-result-alist nil + "Associated list of results of the pbuilder/debuild runs. +They are in (package result-buffer-name process-name(if process exists)) + +When this variable is being accessed, set `pbuilder-log-view-build-result-alist-mutex' to t.") + +(defvar pbuilder-log-view-build-result-alist-mutex nil + "The access-control for `pbuilder-log-view-build-result-alist'. +If someone is accessing that var, it is t") + +;; potential new interface? +(defvar pbuilder-log-view-results-plist nil + "Property list of results of the pbuilder/debuild runs. +:package +:result-buffer-name +:process-name") + +;; mutex lock implementation thanks to TSUCHIYA Masatoshi +(defmacro pbuilder-log-view-lock-mutex (mutex &rest body) + "Try to mutex-lock a variable MUTEX, and run BODY. + +The MUTEX needs to be nil." + `(progn + (while ,mutex + (accept-process-output nil 0 200)) + (setq ,mutex t) + ,@body + (setq ,mutex nil))) + +;; The following code does publishing for elserv. +;; elserv-start, then run pbuilder-log-view-elserv + +(defun pbuilder-log-view-add (package-name buffer-name running-process) + "Add the entry to the log view list. + +\(PACKAGE-NAME, BUFFER-NAME, RUNNING-PROCESS\) will be added to +`pbuilder-log-view-build-result-alist'. + +Argument PACKAGE-NAME is the name of the package." + (pbuilder-log-view-lock-mutex + pbuilder-log-view-build-result-alist-mutex + (add-to-list 'pbuilder-log-view-build-result-alist (list package-name buffer-name running-process)))) + +(defun pbuilder-log-view-internal-garbage-collect-log () + "Remove unneeded entries from the log listing." + (setq pbuilder-log-view-build-result-alist + (let* (new-data current-is-okay) + (dolist (entry pbuilder-log-view-build-result-alist) + (setq current-is-okay t) + (if (get-buffer (cadr entry)) + (dolist (new-data-element new-data) + (if (string= (cadr new-data-element) (cadr entry)) + (setq current-is-okay nil)) + (if (string= (car new-data-element) (car entry)) + (setq current-is-okay nil))) + (setq current-is-okay nil)) + (if current-is-okay + (add-to-list 'new-data entry))) + (reverse new-data)))) + +(defun pbuilder-log-view-internal-view-one-log (result path ppath request) + "View one logfile from buffer. + +Requires a newish htmlize.el +RESULT is the resulting value +PATH is relative path from the published path +PPATH is the published path +REQUEST is the request data." + (let* (logname matching-assoc nowlist charset) + (string-match "/\\?\\(.+\\).html$" path) + (setq logname (match-string 1 path)) + (setq nowlist (assoc logname pbuilder-log-view-build-result-alist)) + (if nowlist + (save-window-excursion + (if (get-buffer (cadr nowlist)) + (progn + (let* ((htmlize-major-mode nil)) + (set-buffer (htmlize-buffer-noninteractive (cadr nowlist)))) + (setq charset (detect-mime-charset-region (point-min)(point-max))) + (elserv-set-result-header + result + (list 'content-type (concat "text/html; charset=" (symbol-name charset)))) + (elserv-set-result-body result + (encode-mime-charset-string (buffer-string) charset)) + (kill-buffer (current-buffer))) + (elserv-set-result-header result (list 'content-type (concat "text/plain"))) + (elserv-set-result-body result "404?"))) + (elserv-set-result-header result (list 'content-type (concat "text/plain"))) + (elserv-set-result-body result "404p")))) + +;; some code sampled from remote.el from elserv sources. +(defun pbuilder-log-view-internal-function (result path ppath request) + "Elserv publish function for pbuilder logs. +RESULT, PATH, PPATH and REQUEST are arguments + +This page presents the list of build logs available from this Emacs session" + (pbuilder-log-view-lock-mutex + pbuilder-log-view-build-result-alist-mutex + (pbuilder-log-view-internal-garbage-collect-log)) + (save-window-excursion + (with-temp-buffer + (elserv-set-result-header result + '(content-type "text/html")) + (insert (concat " + + +List of builds + + + +

List of builds done in the emacs session

+
    +")) + (pbuilder-log-view-lock-mutex + pbuilder-log-view-build-result-alist-mutex + (dolist (nowlist pbuilder-log-view-build-result-alist) + (if (get-buffer (cadr nowlist)) + (let* ((running-status + (if (caddr nowlist) (symbol-name (process-status (caddr nowlist))) + "nil"))) + (insert (concat "
  • " + (car nowlist) + " " + running-status + (if (string= running-status "exit") + (if (= (process-exit-status (caddr nowlist)) 0) + ": Successful build" + ": Build failure") + "") + "
  • \n"))))) + (insert (concat "

Last updated:" + (current-time-string) + "

\n")) + (elserv-set-result-body + result + (buffer-string)))))) + +(defcustom pbuilder-log-view-css " +BODY{ +color: #ffeeee; +background-color: #000055; +} +h1.title{ + margin-top: 0em; + border-color: #99c; + border-width: 0px 9px 4px 0px; + border-style: solid; +} +div.listing{ + margin-top: 0em; + border-color: #99c; + border-width: 0px 0px 4px 9px; + border-style: solid; +} +li.package{ +} +a:link { + color: #ffccff; +} +a:active { + color: #eeeeee; +} +a:hover { + color: #ffffff; + background-color: #5555ff; +} +a:visited { + color: #ddeedd; +} +span.status{ + color: #ffffff; + background-color: #000000; +} +span.buildfail{ + color: #ff3300; + background-color: #000000; +} +span.buildsuccess{ + color: #00aaff; + background-color: #000000; +} +" "*Css-string to be added to pbuilder log listing view html page. +h1.title +div.listing +ul.listing +li.package +a.package +span.status +span.buildfail +span.buildsuccess" + :type 'text + :group 'pbuilder-log-view) + +(defun pbuilder-log-view-elserv () + "Run a elserv session with log view. + +Running this requires elserv. Use elserv, and do `elserv-start' before invoking this command." + (interactive) + (require 'elserv) + (require 'htmlize) + (elserv-publish (elserv-find-process) + pbuilder-log-view-web-basepath + :function 'pbuilder-log-view-internal-function + :description "Build log listing" + ) + (elserv-publish (elserv-find-process) + (concat pbuilder-log-view-web-basepath "query.cgi") + :function 'pbuilder-log-view-internal-view-one-log + :description "Build log database query")) + + +(provide 'pbuilder-log-view-mode) + + diff --git a/pbuilder-mode.el b/pbuilder-mode.el new file mode 100755 index 0000000..c24770a --- /dev/null +++ b/pbuilder-mode.el @@ -0,0 +1,122 @@ +;; Routines to do devscripts-compatible emacs routines. +;; copyright 2002 Junichi Uekawa. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; readme-debian.el is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with your Debian installation, in /usr/share/common-licenses/GPL +;; If not, write to the Free Software Foundation, 675 Mass Ave, +;; Cambridge, MA 02139, USA. + +(require 'devscripts) +(require 'pbuilder-log-view-mode) + +(defgroup pbuilder nil "PBuilder mode" + :group 'tools + :prefix "pbuilder-mode-") + +(defcustom pbuilder-path "/usr/sbin/pbuilder" + "*Path to pbuilder." + :group 'pbuilder + :type 'file) +(defcustom pbuilder-user-mode-linux-path "/usr/bin/pbuilder-user-mode-linux" "*Path to pbuilder-user-mode-linux." + :group 'pbuilder + :type 'file) +(defcustom pdebuild-path "/usr/bin/pdebuild" "*Path to pdebuild." + :group 'pbuilder + :type 'file) +(defcustom pdebuild-user-mode-linux-path "/usr/bin/pdebuild-user-mode-linux" "*Path to pdebuild-user-mode-linux." + :group 'pbuilder + :type 'file) +(defcustom debuild-pbuilder-path "/usr/bin/debuild-pbuilder" "*Path to `debuild-pbuilder'." + :group 'pbuilder + :type 'file) +(defconst pbuilder-mode-version "$Id: pbuilder-mode.el,v 1.3 2007-07-14 09:26:05 dancer Exp $" "Version of pbuilder mode.") + +(defun pdebuild () + "Run pdebuild in the current directory." + (interactive) + (let* ((pdebuild-buffer (concat "*pdebuild*" default-directory)) + (pdebuild-process (concat "pdebuild-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer pdebuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (pbuilder-log-view-add + package-name pdebuild-buffer + (start-process pdebuild-process pdebuild-buffer pdebuild-path)))) + +(defun pdebuild-user-mode-linux () + "Run pdebuild-user-mode-linux in the current directory." + (interactive) + (let* ((pdebuild-buffer (concat "*pdebuild*" default-directory)) + (pdebuild-process (concat "pdebuild-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer pdebuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (pbuilder-log-view-add + package-name pdebuild-buffer + (start-process pdebuild-process pdebuild-buffer pdebuild-user-mode-linux-path)) + (set-buffer-process-coding-system 'dos 'dos))) + +(defun debuild-pbuilder () + "Run `debuild-pbuilder' in the current directory." + (interactive) + + (let* ((pdebuild-name (concat "debuild-pbuilder" default-directory)) + (pdebuild-buffer (concat "*" pdebuild-name "*" )) + (pdebuild-process (concat "debuild-pbuilder-process-" default-directory)) + (package-name (devscripts-internal-get-debian-package-name))) + (switch-to-buffer pdebuild-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (pbuilder-log-view-add + package-name + (apply 'make-comint pdebuild-name debuild-pbuilder-path nil + debuild-option-list) + (get-process pdebuild-name)))) + +(defun pbuilder-build (filename) + "Run pbuilder build for a given FILENAME. +Uses `devscripts-mode-gain-root-command' as command to gain root." + (interactive "f.dsc File name: ") + (let* ((pbuilder-buffer (concat "*pbuilder-build*" filename)) + (pbuilder-process (concat "pbuilder-build-process-" filename))) + (switch-to-buffer pbuilder-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (insert "start compile\n") + (pbuilder-log-view-add + (file-name-sans-extension (file-name-nondirectory filename)) pbuilder-buffer + (start-process pbuilder-process pbuilder-buffer devscripts-mode-gain-root-command pbuilder-path "build" (expand-file-name filename))))) + +(defun pbuilder-user-mode-linux-build (filename) + "Run pbuilder-user-mode-linux build for a given FILENAME. " + (interactive "f.dsc File name: ") + (let* ((pbuilder-buffer (concat "*pbuilder-uml-build*" filename)) + (pbuilder-process (concat "pbuilder-uml-build-process-" filename))) + (switch-to-buffer pbuilder-buffer) + (toggle-read-only 0) + (kill-region (point-min) (point-max)) + (compilation-mode) + (insert "start compile\n") + (pbuilder-log-view-add + (file-name-sans-extension (file-name-nondirectory filename)) pbuilder-buffer + (start-process pbuilder-process pbuilder-buffer pbuilder-user-mode-linux-path "build" (expand-file-name filename))) + (set-buffer-process-coding-system 'dos 'dos))) + + + +(provide 'pbuilder-mode) -- cgit v1.2.3