tools.deploy.backend: rearranging the order of parameters in the deploy process, -run needs to be last
parent
e4e6f34f0e
commit
07dd28c94d
|
@ -0,0 +1,45 @@
|
||||||
|
USING: kernel pcre sequences tools.deploy.backend tools.test ;
|
||||||
|
IN: tools.deploy.backend.tests
|
||||||
|
|
||||||
|
: complete-match? ( str regexp -- ? )
|
||||||
|
"^" "$" surround matches? ;
|
||||||
|
|
||||||
|
{ t } [
|
||||||
|
{ } staging-command-line
|
||||||
|
{
|
||||||
|
"-staging"
|
||||||
|
"-no-user-init"
|
||||||
|
"-pic=0"
|
||||||
|
"-output-image.*"
|
||||||
|
"-include="
|
||||||
|
"-i=boot\\..*"
|
||||||
|
} [ complete-match? ] 2all?
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
{ t } [
|
||||||
|
{ "compiler" } staging-command-line
|
||||||
|
{
|
||||||
|
"-staging"
|
||||||
|
"-no-user-init"
|
||||||
|
"-pic=0"
|
||||||
|
"-output-image=.*"
|
||||||
|
"-include=compiler"
|
||||||
|
"-i=.*"
|
||||||
|
"-resource-path=.*"
|
||||||
|
"-run=tools.deploy.restage"
|
||||||
|
} [ complete-match? ] 2all?
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
{ t } [
|
||||||
|
"image" "hello-world" "manifest.file" { "foob" } deploy-command-line
|
||||||
|
{
|
||||||
|
"-pic=0"
|
||||||
|
"-i=.*foob.*"
|
||||||
|
"-vocab-manifest-out=manifest.file"
|
||||||
|
"-deploy-vocab=hello-world"
|
||||||
|
"-deploy-config=.*hello-world"
|
||||||
|
"-output-image=image"
|
||||||
|
"-resource-path=.*"
|
||||||
|
"-run=tools.deploy.shaker"
|
||||||
|
} [ complete-match? ] 2all?
|
||||||
|
] unit-test
|
|
@ -65,29 +65,28 @@ ERROR: can't-deploy-library-file library ;
|
||||||
"-" join "." my-arch 3append
|
"-" join "." my-arch 3append
|
||||||
"staging." ".image" surround cache-file ;
|
"staging." ".image" surround cache-file ;
|
||||||
|
|
||||||
DEFER: ?make-staging-image
|
|
||||||
|
|
||||||
: staging-command-line ( profile -- flags )
|
: staging-command-line ( profile -- flags )
|
||||||
[
|
[
|
||||||
"-staging" ,
|
[
|
||||||
dup empty? [
|
"-staging" , "-no-user-init" , "-pic=0" ,
|
||||||
"-i=" my-boot-image-name append ,
|
[ staging-image-name "-output-image=" prepend , ]
|
||||||
|
[ " " join "-include=" prepend , ] bi
|
||||||
] [
|
] [
|
||||||
dup but-last ?make-staging-image
|
[ "-i=" my-boot-image-name append , ] [
|
||||||
|
but-last staging-image-name "-i=" prepend ,
|
||||||
"-resource-path=" "" resource-path append ,
|
"-resource-path=" "" resource-path append ,
|
||||||
"-i=" over but-last staging-image-name append ,
|
|
||||||
"-run=tools.deploy.restage" ,
|
"-run=tools.deploy.restage" ,
|
||||||
] if
|
] if-empty
|
||||||
"-output-image=" over staging-image-name append ,
|
] bi
|
||||||
"-include=" swap " " join append ,
|
|
||||||
"-no-user-init" ,
|
|
||||||
"-pic=0" ,
|
|
||||||
] { } make ;
|
] { } make ;
|
||||||
|
|
||||||
: run-factor ( vm flags -- )
|
: run-factor ( vm flags -- )
|
||||||
swap prefix dup . run-with-output ; inline
|
swap prefix dup . run-with-output ; inline
|
||||||
|
|
||||||
|
DEFER: ?make-staging-image
|
||||||
|
|
||||||
: make-staging-image ( profile -- )
|
: make-staging-image ( profile -- )
|
||||||
|
dup [ but-last ?make-staging-image ] unless-empty
|
||||||
vm swap staging-command-line run-factor ;
|
vm swap staging-command-line run-factor ;
|
||||||
|
|
||||||
: ?make-staging-image ( profile -- )
|
: ?make-staging-image ( profile -- )
|
||||||
|
@ -99,20 +98,17 @@ DEFER: ?make-staging-image
|
||||||
[ "deploy-config-" prepend temp-file ] bi
|
[ "deploy-config-" prepend temp-file ] bi
|
||||||
[ utf8 set-file-contents ] keep ;
|
[ utf8 set-file-contents ] keep ;
|
||||||
|
|
||||||
: deploy-command-line ( image vocab manifest-file config -- flags )
|
: deploy-command-line ( image vocab manifest-file profile -- flags )
|
||||||
[
|
[
|
||||||
bootstrap-profile ?make-staging-image
|
"-pic=0" ,
|
||||||
[
|
staging-image-name "-i=" prepend ,
|
||||||
"-i=" bootstrap-profile staging-image-name append ,
|
|
||||||
"-resource-path=" "" resource-path append ,
|
|
||||||
"-run=tools.deploy.shaker" ,
|
|
||||||
"-vocab-manifest-out=" prepend ,
|
"-vocab-manifest-out=" prepend ,
|
||||||
[ "-deploy-vocab=" prepend , ]
|
[ "-deploy-vocab=" prepend , ]
|
||||||
[ make-deploy-config "-deploy-config=" prepend , ] bi
|
[ make-deploy-config "-deploy-config=" prepend , ] bi
|
||||||
"-output-image=" prepend ,
|
"-output-image=" prepend ,
|
||||||
"-pic=0" ,
|
"-resource-path=" "" resource-path append ,
|
||||||
] { } make
|
"-run=tools.deploy.shaker" ,
|
||||||
] with-variables ;
|
] { } make ;
|
||||||
|
|
||||||
: parse-vocab-manifest-file ( path -- vocab-manifest )
|
: parse-vocab-manifest-file ( path -- vocab-manifest )
|
||||||
utf8 file-lines [ "empty vocab manifest!" throw ] [
|
utf8 file-lines [ "empty vocab manifest!" throw ] [
|
||||||
|
@ -123,8 +119,9 @@ DEFER: ?make-staging-image
|
||||||
|
|
||||||
:: make-deploy-image ( vm image vocab config -- manifest )
|
:: make-deploy-image ( vm image vocab config -- manifest )
|
||||||
make-boot-image
|
make-boot-image
|
||||||
|
config [ bootstrap-profile ?make-staging-image ] with-variables
|
||||||
vocab "vocab-manifest-" prepend temp-file :> manifest-file
|
vocab "vocab-manifest-" prepend temp-file :> manifest-file
|
||||||
image vocab manifest-file config deploy-command-line :> flags
|
image vocab manifest-file bootstrap-profile deploy-command-line :> flags
|
||||||
vm flags run-factor
|
vm flags run-factor
|
||||||
manifest-file parse-vocab-manifest-file ;
|
manifest-file parse-vocab-manifest-file ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue