Changeset 9090 in project


Ignore:
Timestamp:
02/28/08 13:42:00 (12 years ago)
Author:
Ivan Raikov
Message:

Some updates to the Debian egg building stuff,
so that documentation is automatically generated from the wiki.

Location:
chicken/trunk/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/scripts/dpkg-eggs.scm

    r8430 r9090  
    1919(define opts
    2020  `(
    21     ,(args:make-option (eggdir)       (required: "DIR")   
     21    ,(args:make-option (extension-path)       (required: "DIR")   
     22                       (s+ "path to stream-wiki extensions"))
     23    ,(args:make-option (wiki-dir)       (required: "DIR")   
     24                       (s+ "use wiki documentation in directory DIR"))
     25    ,(args:make-option (egg-dir)       (required: "DIR")   
    2226                       (s+ "operate on eggs in directory DIR"))
    2327    ,(args:make-option (output-dir)       (required: "DIR")   
     
    8387          ((file-exists? (s+ release dirsep "debian")) => identity)
    8488          (else #f))))
     89           
     90;; Find wiki documentation for given egg
     91(define (find-wiki-doc name wikidir)
     92  (cond ((file-exists? (s+ wikidir dirsep name)) => identity)
     93        (else #f)))
    8594
    86 (define (build-deb eggdir output-dir path)
     95(define (build-deb eggdir wiki-dir output-dir ext-path path)
    8796  (let* ((name     (pathname-strip-directory path))
    8897         (release  (find-latest-release path))
    8998         (debdir   (find-debian-subdir path release)))
    9099    (if debdir
    91         (let ((start (cwd)))
     100        (let ((start      (cwd))
     101              (build-dir  (s+ output-dir dirsep name))
     102              (doc        (cond ((file-exists? (s+ release dirsep name ".html")) => identity)
     103                                ((and wiki-dir (file-exists? (s+ wiki-dir dirsep name))) => identity)
     104                                (else #f))))
    92105          (message "Release directory is ~a" release)
    93106          (message "debian subdirectory found in ~a" path)
    94           (run (rm -rf ,(s+ output-dir dirsep name)))
    95           (run (cp -R ,release ,(s+ output-dir dirsep name)))
    96           (run (cp -R ,debdir ,(s+ output-dir dirsep name)))
    97           (cd  (s+ output-dir dirsep name))
     107          (run (rm -rf ,build-dir))
     108          (run (cp -R ,release ,build-dir))
     109          (run (cp -R ,debdir ,build-dir))
     110          (if (not (string-suffix? ".html" doc))
     111              (run (csi -s ,(cond ((file-exists? (s+ start "/makehtml.scm")) => identity)
     112                                  (else 'makehtml.scm))
     113                    ,(s+ "--extension-path=" ext-path)
     114                    ,(s+ "--wikipath=" wiki-dir)
     115                    ,(s+ "--only=" name))))
     116          (run (cp ,(s+ "html/" name ".html") ,build-dir))
     117          (cd build-dir)
    98118          (run (chmod a+rx debian/rules))
    99119          (run (,(s+ "EGG_TREE=\"" eggdir "\"") dpkg-buildpackage -us -uc)))
     
    101121
    102122(define (main options operands)
    103   (let ((opt_eggdir  (alist-ref 'eggdir options))
     123  (let ((opt_wikidir   (alist-ref 'wiki-dir options))
     124        (opt_eggdir    (alist-ref 'egg-dir options))
     125        (opt_extpath   (alist-ref 'extension-path options))
    104126        (opt_exclude ((lambda (x) (and x (string-split x ","))) (alist-ref 'exclude options)))
    105127        (opt_output-dir (alist-ref 'output-dir options)))
     
    122144          (message "No egg directories found in ~a" opt_eggdir)
    123145          (message "Found egg directories: ~a" eggdirs))
    124       (for-each (lambda (x) (build-deb opt_eggdir opt_output-dir x))
     146      (for-each (lambda (x) (build-deb opt_eggdir opt_wikidir opt_output-dir opt_extpath x))
    125147                eggdirs))))
    126148
  • chicken/trunk/scripts/makehtml.scm

    r6691 r9090  
    1212(use matchable)
    1313
     14(define s+ string-append)
     15
    1416(define (simple-args #!optional (args (command-line-arguments)) (error error))
    1517  (define (assign var val)
    1618    (##sys#setslot
    17      (string->symbol (string-append "*" var "*"))
     19     (string->symbol (s+ "*" var "*"))
    1820     0
    1921     (if (string? val)
     
    4951(define *pdf* #f)
    5052(define *extension-path* #f)
    51 (define *pages* (directory "manual"))
     53(define *pages* (if (file-exists? "manual") (directory "manual") (list)))
    5254(define *only* #f)
    5355(define *wikipath* "~/eggs/wiki")
     
    6264        ((string-ci=? lnk +index-page+) "index.html")
    6365        ((any (lambda (f) (string-ci=? f lnk)) *pages*)
    64          (string-append (hyphen (string-downcase lnk)) ".html|" lnk) )
     66         (s+ (hyphen (string-downcase lnk)) ".html|" lnk) )
    6567        ((string-prefix? "http:" lnk) lnk)
    66         (else (string-append "http://galinha.ucpel.tche.br/" lnk) ) ) )
     68        (else (s+ "http://galinha.ucpel.tche.br/" lnk) ) ) )
    6769
    6870(define (convert-page page)
     
    7375         (((s e) (ls le))
    7476          (let ((lnk (substring data ls le)))
    75             (loop
    76              e
    77              (cons
    78               (string-append
    79                (substring data i (+ 2 s))
    80                (clean-link lnk)
    81                "]]")
    82               all) ) ) )
     77            (loop e (cons
     78                (s+ (substring data i (+ 2 s))
     79                    (clean-link lnk)
     80                    "]]")
     81                all) ) ) )
    8382         (_ (reverse (cons (substring data i) all))) ) ) ) ) )
    8483
     
    159158
    160159(define (wiki-pagename pagename)
    161   (make-pathname "manual" pagename) )
     160  (if *only*
     161      (make-pathname *wikipath* pagename)
     162      (make-pathname "manual" pagename) ))
    162163
    163164(define *loaded-extensions* (make-hash-table))
     
    174175         (with-output-to-file po
    175176           (lambda ()
    176              (printf "<html><head><title>CHICKEN User's Manual - ~a</title></head><body>~%" pagename)
     177             (if *only*
     178                 (printf "<html><head><title>~a</title></head><body>~%" pagename)
     179                 (printf "<html><head><title>CHICKEN User's Manual - ~a</title></head><body>~%" pagename))
    177180             (write-stream
    178181              (wiki->html
     
    217220     (load-extensions-from-file *loaded-extensions* f)))
    218221 (glob (conc *extension-path* "/*")) )
    219 (when *pdf*
    220   (chapters-sanity-check))
     222(when *pdf* (chapters-sanity-check))
    221223(wiki-files->html)
    222 (when *pdf*
    223   (html-files->pdf))
     224(when *pdf* (html-files->pdf))
Note: See TracChangeset for help on using the changeset viewer.