Hi all,

I've cloned tankfeeder's repository at Bitbucket and installed small
pil-application that checks http://software-lab.de/picoLisp.tgz for changes and commits to the repo.
Repository address is https://bitbucket.org/mmamkin/picolisp
I plan to maintain it while I have VPS :).

Also we could install there some auto building scripts to provide fresh
deb-package. I would appreciate any ideas and help

Source code is listed below. Comments are welcome

Best regards,
Mansur Mamkin

# Example of 'app' user crontab entry:
# 10 0,6,12,18 * * * ./pil pilrepo/main.l -updaterepo -bye \
# 2>&1 >> log/pilrepo
#
# Setup:
# 1) clone your remote hg repository into ~/pilrepo/picoLisp/
# 2) provide SSH key to remote repository

(setq
     *Root "pilrepo/"
     *Repo (pack *Root "picoLisp/")
     *TgzUrl "http://software-lab.de/picoLisp.tgz";
     *Tgz (pack *Root "picoLisp.tgz")
     *Curl (list 'curl '-z *Tgz '-o *Tgz '-w "%{http_code}" '--silent
*TgzUrl) )

(de updaterepo ()
     (and
        (_download)
        (_extract)
        (_commit)
        (_push) ) )

# TODO: email me
(de _alert ()
     NIL )

(de log @
     (out NIL
        (prinl (stamp) " PID: " *Pid " [INFO] " (pass text)) ) )

(de logerr @
     (out NIL
        (prinl (stamp) " PID: " *Pid  " [ERROR] " (pass text)) ) )

(de _download ()
     (log "Downloading @1..." *TgzUrl)
     (case (in *Curl (read))
        (200 (log "200 OK [@2 bytes]" (car (info Tgz))) T)
        (304 (log "304 Not modified") NIL)
        (T (logerr "@1 download failed" @) (_alert) NIL) ) )

(de _extract ()
     (ifn (call 'tar '-x '-z '-C *Root '-f *Tgz)
        (nil (logerr "'@1' extraction failed" *Tgz))
        T ) )

(de _commit ()
     (load (pack *Repo "src64/version.l"))
     (let Msg (glue "." *Version)
        (if (call 'hg 'commit '--cwd *Repo '-A '-m Msg)
           (t (log "hg commit -m '@1'" Msg))
           (nil (logerr "hg commit -m '@1' failed" Msg)) ) ) )

(de _push ()
     (if (call 'hg '--cwd *Repo 'push)
        (t (log "hg push succeeded"))
        (nil (logerr "hg push failed")) ) )
# vi:et:ts=3:sw=3
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to