chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] versions patch


From: Alexej Magura
Subject: [Chicken-users] versions patch
Date: Wed, 12 Aug 2015 04:05:26 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0


Adds the following functions to the `versions' egg:
(define (local egg)
  (irregex-replace
   (format "~%")
   (last
    (string-split
     (call-with-input-pipe
      (string-append "chicken-status " egg)
      read-all)))))

(define (remote egg #!optional url)
  (let ((.url.
     (if url
         url
         "http://chicken.kitten-technologies.co.uk/henrietta.cgi?name=")))
    (version-sort
     (string-split
      (with-input-from-request
       (string-append
    .url.
    (uri-encode-string egg)
    "&listversions=1")
       #f read-all)
      (format "~%")))))

(define (update-available? egg #!optional url)
  (version-newer? (last (remote egg)) (local egg)))

The above functions can/could be used as the basis for a more flexible/powerful means of updating eggs, as in only updating eggs that actually needed to be updated instead of just updating all of them.  The functions depend on the http-client, uri-generic, and versions eggs; they also use the irregex, posix, and utils units. 

If these don't seem like a good fit for versions, then that's okay: so long as these functions get added to some egg, I'll live: I just felt that they'd be out of place in the readline egg. 


Attachment: 0001-adds-local-remote-and-update-available.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]