« men of the cloth | Main | muslimgauze - veiled sisters remix »

new debian packages as an rss feed

I've actually had this running since around the end of last year, but because it's been working without any noticeable problems I completely forgot about it.

If you're keen to keep up with all the new software that people are packaging for Debian GNU/Linux, you might already know about Randolph Chung's auto-generated lists. I'd been reading about Perl's XML::RSS module[1], and it looked like a good opportunity to try it out. I've got a cron job that pulls his latest page once a day, and generates an RSS file of the lot of it. I can then read the RSS feed with Gnus, which lets me do the usual newsy stuff like marking posts as "useful/important, come back and read me later".

The RSS feed itself is available here.

Also, if you're reading it in Gnus, you might find the following code snippet useful. Most of it's for nnrss groups in general, and there's a particular summary line format tweak for the New Debian Packages group :

(when (load "nnrss" t t)
  ;;
  ;; a user-format-string function we use a bit later on
  ;;
  (defun gnus-user-format-function-R (header)
    (let ((descr
           (assq nnrss-description-field (mail-header-extra header))))
      (if descr (cdr descr) "")))
  ;;
  ;; add some new RSS feeds to our list (we still need to subscribe to
  ;; the "nnrss:New Debian Packages" group ourselves, though).
  ;;
  (setq nnrss-group-alist (append nnrss-group-alist
    '(("New Debian Packages"
     "http://polydistortion.net/urls/new-debian-packages.rss"
     "New Debian Packages"))))

  ;;
  ;; consider these two nnrss fields to be "headers", for later on
  ;;
  (add-to-list 'nnmail-extra-headers nnrss-description-field)
  (add-to-list 'nnmail-extra-headers nnrss-url-field)

  ;; from usenet : "The following code may be useful to open an nnrss
  ;; url directly from the summary buffer."
  (defun browse-nnrss-url( arg )
    (interactive "p")
    (let ((url (assq nnrss-url-field
                     (mail-header-extra
                      (gnus-data-header
                       (assq (gnus-summary-article-number)
                             gnus-newsgroup-data))))))
      (if url
          (browse-url (cdr url))
        (gnus-summary-scroll-up arg))))

  ;;
  ;; do some special twiddling when we're reading nnrss groups
  ;; - turn off threading
  ;; - make C-c RET open the RSS item's URL in our browser
  ;; - apply our customized summary line formats
  ;;
  (add-hook 'gnus-summary-mode-hook
            (lambda ()
              (if (string-match "nnrss" gnus-newsgroup-name)
                  (progn
                    (make-local-variable 'gnus-show-threads)
                    (make-local-variable 'gnus-article-sort-functions)
                    (make-local-variable 'gnus-use-adaptive-scoring)
                    (make-local-variable 'gnus-use-scoring)
                    (make-local-variable 'gnus-score-find-score-files-function)
                    (make-local-variable 'gnus-summary-line-format)
                    
                    (define-key gnus-summary-mode-map (kbd "C-c <RET>") 'browse-nnrss-url)

                    (setq gnus-show-threads nil)
                    (setq gnus-article-sort-functions 'gnus-article-sort-by-subject)
                    
                    (setq gnus-use-adaptive-scoring nil)
                    (setq gnus-use-scoring t)
                    (setq gnus-score-find-score-files-function 'gnus-score-find-single)
                    (if (string-match "New Debian Packages" gnus-newsgroup-name)
                        (setq gnus-summary-line-format "%U%R%z%d %I%(%[ %s  ]%) %uR\n")
                      (setq gnus-summary-line-format "%U%R%z%d %I%(%[ %s  ]%)\n"))
                    )))))

(I don't think any of that was my idea, it's a conglomerate of a couple of things I saw in a few different places).

As you might've noticed from the comments, you'll now get the following extra functionality :

  • Hitting C-c RET (that's Ctrl-C then Return, if you don't understand Emacs keybinding conventions) fires the URL in the current article (rss item) off to your preferred browser, assuming you've customized the browse-url appropriately (if not, it'll probably try and start netscape).

  • Since threading and such aren't particularly appropriate for RSS feeds (at least, not so far), they're all turned off.

  • The summary line format's more useful - about the only useful information worth showing in the summary line now is a date and the subject (no author, for instance). As an example, here's a summary buffer looking at The Null Device :

      +01-Jan [ AudioGalaxy from the inside ]
      +01-Jan [ Business at the Speed of Thought ]
      +01-Jan [ Godwin's Law and the Euro ]
      +01-Jan [ RSS feed ]
      +01-Jan [ the Chinese Al-Qaeda? ]
      +01-Jan [ Welcome to 2002, Graham ]
    
  • For the "New Debian Packages" group, we have a different mode-line format again - as well as date and subject (which is just the package name, and hence usually pretty short), we show the one-line description field as well. This usually gives enough information such that we only need to actually open the article if we want to read the full package page on the Debian website. It'll look like this :

      -02-Jun [ dselect ] a user tool to manage Debian packages
    ! -02-Jun [ gimp1.3 ] The GNU Image Manipulation Program, unstable version 1.3
    ! -02-Jun [ gimp1.3-nonfree ] GIF support for the GNU Image Manipulation Program
      -02-Jun [ libgimp1.3 ] Libraries necessary to run the GIMP, version 1.3
      -02-Jun [ libgimp1.3-dev ] Headers and other files for compiling plugins for The GIMP
      -02-Jun [ libgnomeui-doc ] The GNOME 2 libraries (User Interface) - documentation files
    

Footnotes :

[1] yes, yes, Python, I know. If it's any consolation, I did hack up a little Python script that uses the Blogger XML-RPC interface that Movable Type supports, such that I could (if I wanted to) post new entries remotely from the command-line. Basic functionality worked, at which point I lost interest. There's plenty of others about, including one for Emacs. Right now, I still just use MT's web interface, although one of these days I'll sit down and make the Emacs stuff comfortable.

* 09:38 * geek