From 2028d7a5548fb9cae641e45dc6f3a659f3b1839a Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 2 Jun 2017 17:23:34 +0200 Subject: Make it simple to insert into d{s,l}a-needed --- debian.el | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ keybindings.el | 1 + 2 files changed, 49 insertions(+) diff --git a/debian.el b/debian.el index d103451..62fdb59 100644 --- a/debian.el +++ b/debian.el @@ -1,3 +1,5 @@ +(defvar deb_secure_testing_path "~/secure-tesing" "Path to your secure-testing-checkout") + (defun xcpu-deb-open-bts () "Open the bug under the cursor in the debian bts" (interactive) @@ -37,3 +39,49 @@ (browse-url url) )) + +(defun xcpu-deb-dla-insert-pkg-buffer (pkg) + "Insert a package at the right position in the current buffer" + (setq source_re "^[a-z0-9][a-z0-9+-.]+") + (setq more_lines t) + (setq found nil) + + (goto-char 1) + (search-forward "--\n") + + (while more_lines + (setq found_pkg (buffer-substring-no-properties (line-beginning-position) (point))) + (if (string< found_pkg pkg) + (setq more_lines (re-search-forward source_re (point-max) t)) + (progn + (setq more_lines nil) + (setq found t)) + )) + (unless found + (goto-char (point-max))) + + (search-backward "--\n") + (insert (concat "--\n" pkg "\n")) + (backward-char 1) +) + +(defun xcpu-deb-dla-insert-pkg-file (filename) + "Add a package to dla-needed.txt or dsa-needed.txt" + (find-file (expand-file-name + filename + (concat + deb_secure_testing_path "/data"))) + (let ((pkg (read-string "Package: "))) + (xcpu-deb-dla-insert-pkg-buffer pkg) + ) +) + +(defun xcpu-deb-add-dla-needed () + "Add a package to dla-needed.txt" + (interactive) + (xcpu-deb-dla-insert-pkg-file "dla-needed.txt")) + +(defun xcpu-deb-add-dsa-needed () + "Add a package to dsa-needed.txt" + (interactive) + (xcpu-deb-dla-insert-pkg-file "dsa-needed.txt")) diff --git a/keybindings.el b/keybindings.el index 19d612e..ce5d89e 100644 --- a/keybindings.el +++ b/keybindings.el @@ -26,5 +26,6 @@ (global-set-key (kbd "C-, B") 'xcpu-deb-open-bts) (global-set-key (kbd "C-, T") 'xcpu-deb-open-tracker) (global-set-key (kbd "C-, S") 'xcpu-deb-open-security-tracker) +(global-set-key (kbd "C-, L") 'xcpu-deb-add-dla-needed) (global-set-key (kbd "C-< C-<") 'xcpu-thank-ack) -- cgit v1.2.3