[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Emacs lisp file to strip a debian Packages file

Here is a minimal little emacs lisp utility, perhaps a time saver?
It will make a list from a Packages file.  

Alan Davis

;;; deb-strip-Packages.el   
;;; Alan E. Davis   adavis@saba.kuentos.guam.net
;;; Fri Mar  8 23:59:06 1996
;;; No warrantee accompanies this program.
;;; May be freely distributed subject to the restrictions of the 
;;; GNU Public License. 
;;; This program is not part of GNU Emacs.
;;; This program simply converts a Debian GNU/Linux Packages file to 
;;; an alphabetical list of packages and paths/filenames on ftp.debian.org.
;;; This works ok with a Debian Packages file of the format that is current in 
;;; early March 1996.
;;; To sort by directory name, "sort +0.20".

(defun deb-strip-Packages ()
  "Strip out a list of packages from a debian Packages file.
 Run over a buffer containing a debian Packages file, this function will return 
an alphabetical list with the directory and filename in the archive.  

The resulting list can be alphabetized  by section (directory) by running 
this command:  C-u M-x shell-command-on-region: sort +0.20." 
  (goto-char (point-min))
  (re-search-forward "^Package: \\(.*\\)" nil t)
      (replace-match "\\1" )
      (indent-to-column 23 2)
      (let ((place))
	(setq place (point))
	(search-forward "i386/" nil t)
	(delete-region place (point))
	(beginning-of-line 2)
	(setq place (point))
	(re-search-forward "^$" nil t)
	(beginning-of-line 2)
	(delete-region place (point))
	(re-search-forward "^Package: \\(.*\\)" nil t))))

Reply to: