Two Guys Arguing

asdf-install innards

Posted in common lisp by youngnh on 08.07.09

asdf-install’s README is good stuff.

For example, I did not know that sbcl has a standalone program for downloading lisp libraries:

sbcl-asdf-install drakma

will do the same thing as the more traditional method of starting sbcl, requiring asdf-install and then installing drakma.

The REAMDE also notes that the arguments to asdf-install may be:

– The name of a cliki page. asdf-install visits that page and finds
the download location from the `:(package)’ tag – usually rendered
as “Download ASDF package from …”

– A URL, which is downloaded directly

– A local tar.gz file, which is installed

If you look at the wiki source of http://www.cliki.net/Drakma, you’ll see a :(package) tag just as described:

:(package "http://weitz.de/files/drakma.tar.gz")

Poking around in the source of asdf-install, you’ll see this:

  
(let ((url
         (if (= (mismatch package-name-or-url "http://") 7)
             package-name-or-url
             (format nil "http://www.cliki.net/~A?download"
                     package-name-or-url))))

Which means that cliki generates a url for a page that ends in “?download”. Here’s the headers returned when requesting that url:

GET /Drakma?download HTTP/1.1
Host: www.cliki.net
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090718 Shiretoko/3.5.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Fri, 07 Aug 2009 13:50:21 GMT

HTTP/1.x 302 Redirected
Date: Fri, 07 Aug 2009 13:58:26 GMT
Server: Araneida/0.84
Connection: close
Content-Type: text/html
Last-Modified: Fri, 07 Aug 2009 13:58:26 GMT
Location: http://weitz.de/files/drakma.tar.gz
Pragma: no-cache
Expires: Fri, 30 Oct 1998 14:19:41 GMT

Redirected to the file named in the :(package) tag.

The pages on cliki are freely editable. This means that it is trivially easy to make a piece of software, add a cliki page for it and anyone with asdf-install could install it, which is a fantastic and democratic way to distribute software.

However, by the same token, this is exactly why you should pay attention to the signatures of packages and download any that don’t match or aren’t trusted to see for yourself what you’re getting before loading and executing it.

See the “Making your package downloadable…” section of this cliki page for more details on how to publish your lisp code for all the world to use:
http://www.cliki.net/asdf-install

About these ads
Tagged with: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.