[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] local metafile use to create an egg
From: |
minh thu |
Subject: |
Re: [Chicken-users] local metafile use to create an egg |
Date: |
Mon, 14 Jan 2008 21:40:54 +0100 |
14 Jan 2008 18:02:15 -0200, Mario Domenech Goulart <address@hidden>:
> Hi minh thu,
>
> On Mon, 14 Jan 2008 15:02:55 +0100 "minh thu" <address@hidden> wrote:
>
> > Currently, I use a makefile to build an egg. Is it possible to create
> > it with the same process .meta file is automatically used when
> > committing in svn (i.e. locally, with no real commit)?
>
> I don't know if I understand what you want. Maybe the script below
> can do the trick. It packs an egg based on the information from the
> meta file found under the given egg directory.
>
> It assumes tar is installed and it doesn't generate the HTML
> documentation from eggdoc or wiki files (just ignores it).
>
> Example of use:
>
> $ csi -s eggify.scm ~/src/chicken-eggs/spiffy/trunk
> spiffy-base.scm
> spiffy.scm
> ssp-handler.scm
> web-scheme-handler.scm
> cgi-handler.scm
> simple-directory-handler.scm
> spiffy.setup
>
> $ cp ~/src/chicken-eggs/spiffy/trunk/spiffy.egg .
>
> $ chicken-setup spiffy.egg
> gzip -d -c ../spiffy.egg | tar xf -
> /usr/local/chicken-2.732/bin/csc -feature compiling-extension -s -O2
> -no-trace spiffy-base.scm
> /usr/local/chicken-2.732/bin/csc -feature compiling-extension -s -O2
> -no-trace ssp-handler.scm
> ...
> rm -fr spiffy.egg-dir
>
>
> ----------------8<------------------------
>
> (use posix (srfi 1))
>
> (define (eggify eggdir)
> (let* ((metafiles (glob (make-pathname eggdir "*" "meta"))))
> (when (null? metafiles)
> (die "Couldn't find any metafile."))
> (let* ((metafile (car metafiles))
> (metadata (handle-exceptions exn
> (die metafile ": syntax error.")
> (with-input-from-file metafile read)))
> (egg (car (alist-ref 'egg metadata)))
> (eggname (pathname-file egg))
> (doc-from-wiki (alist-ref 'doc-from-wiki metadata))
> (eggdoc (alist-ref 'eggdoc metadata))
> (files (alist-ref 'files metadata)))
> (when (or doc-from-wiki eggdoc) ;; ignores documentation
> (set! files (delete (make-pathname #f eggname "html") files)))
> (change-directory eggdir)
> (system (string-append "tar czvf " egg " " (string-intersperse
> files))))))
>
> (define (usage #!optional exit-code)
> (print "Usage: " (program-name) " <egg-dir>")
> (when exit-code
> (exit exit-code)))
>
> (define (die . msg)
> (print (apply conc msg))
> (exit 1))
>
> (let ((args (command-line-arguments)))
> (if (< (length args) 1)
> (usage 1)
> (let ((arg1 (car args)))
> (if (member arg1 '("-h" "--help" "-help"))
> (usage 0)
> (begin
> (unless (file-exists? arg1)
> (die eggdir " does not exist."))
> (eggify arg1))))))
>
> ---------------->8------------------------
>
> Best wishes,
> Mario
>
Gee, I wasn't asking for that much ! You correctly understood,
although I was talking about the code used by the svn hook.
Thanks a lot,
thu