Hi, The deployment of binaries produced by chicken has come up on IRC a number of times over the past weeks and I have a requirement for it myself.
Here I present my findings and partially finished solution. I'm familiar with the -deploy option to chicken-install and the -deploy and -deployed options to csc. My experiments suggest that they seem insufficient to deploy an application that consists of multiple binaries and that depends on eggs which themselves have dependencies. Specifically: chicken-install -deploy This does not install dependencies for the egg. It does not provide libchicken.* chicken-install -i This does not provide a libchicken.* csc -deploy I couldn't work out how to specify the directory. The default is the name of the binary. It does provide libchicken.* csc -deployed Links the binary as expected. Does not provide libchicken.* I worked with Mario on IRC and we came up with the method in the attached files. chicken-deploy-eggs This is based on Mario chicken-update-eggs script. I currently use it in --dry-run mode in order to extract its proposed command line as I need to complement that with CHICKEN_REPOSITORY and LD_LIBRARY_PRELOAD exports in order for it to work properly but the script itself has requirements on eggs such as http-client that may not be in the target deployment. I've currently hardcoded /usr/local/chicken-4.7.0 into the source so you may have to modify that for your own environment. deploy.sh This is the method that we came up with plus some extra bits particular to how my project is arranged. It doesn't have any command line arguments yet: the user has to tweak the definitions at the top of the file. It doesn't currently do any error checking: it just assumes everything succeeds and plows on thru'. The general algorithm is to create a fresh CHICKEN_REPOSITORY and install the eggs there with chicken-install in its regular mode. This will cause all the dependencies to be dragged in. Then, create another fresh CHICKEN_REPOSITORY and inject the appropriate libchicken.* files. Rebuild the eggs from the first repo into the second repo using the chicken-deploy-eggs script. Finally, build the application binaries with the -deployed flag and then copy them into the repo. The socket egg won't install into the second repo without setting LD_LIBRARY_PRELOAD. The attached scripts have not been particularly well tested. They're a work in progress and the aim is to invite comments and get suggestions for things I may have overlooked. How do other people deploy their applications? Eggifying them insufficient to make them easily deployable. Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0x7EBA75FF
(use posix utils srfi-1 http-client) (define henrietta-uri (make-parameter "http://code.call-cc.org/cgi-bin/henrietta.cgi")) (define (list-remote-eggs) (with-input-from-request (string-append (henrietta-uri) "?list=1") #f read-file)) (define (chicken-tool prefix tool) (let ((tool-file (make-pathname (list prefix "bin") tool (and (eq? (software-type) 'windows) "exe")))) (unless (file-exists? tool-file) (print "Could not find " tool-file ". Aborting")) tool-file)) (define (list-local-eggs prefix) (map (compose string->symbol pathname-file) (glob (make-pathname (list prefix "lib" "chicken" (number->string (##sys#fudge 42))) "*" "setup-info")))) (define egg? (let ((remote-eggs #f)) (lambda (module) (unless remote-eggs (set! remote-eggs (list-remote-eggs))) (and (memq module remote-eggs) #t)))) (define (install-eggs! chicken-prefix to-prefix eggs #!key dry-run?) (let ((chicken-install (chicken-tool chicken-prefix "chicken-install"))) (handle-exceptions exn (begin (print "Error installing eggs. Aborting.") (exit 1)) ((if dry-run? print system*) (string-append chicken-install " -deploy -prefix " to-prefix " " (string-intersperse (map symbol->string eggs))))))) (define (eggs-to-install installed-stuff) (filter egg? installed-stuff)) (define (usage #!optional exit-code) (print "Usage: " (pathname-strip-directory (program-name)) " [ --dry-run ] <from prefix> <to prefix>\n\n" "<from prefix> is the chicken installation prefix where " "to get the egg list to install into <to prefix>.\n\n" "Example:\n\n" " $ chicken-update-eggs /usr/local/chicken-4.7.0 /usr/local/chicken-4.7.4\n\n" "would install all eggs from /usr/local/chicken-4.7.0 into /usr/local/chicken-4.7.4\n\n" "--dry-run (optional) only shows what is to be executed without actually executing it.\n\n" "This program can also be used to update all eggs if you give it the same values for " "<from prefix> and <to prefix>.") (when exit-code (exit exit-code))) (let ((args (command-line-arguments))) (when (or (null? args) (null? (cdr args))) (usage 1)) (when (or (member "-h" args) (member "-help" args) (member "--help" args)) (usage 0)) (let ((from-prefix (last (butlast args))) (to-prefix (last args)) (dry-run? (and (member "--dry-run" args) #t))) (install-eggs! "/usr/local/chicken-4.7.0" to-prefix (eggs-to-install (list-local-eggs from-prefix)) dry-run?: dry-run?)))
deploy.sh
Description: application/shellscript
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users