factor/extra/builder/release/release.factor

144 lines
3.4 KiB
Factor
Raw Normal View History

2008-02-22 18:25:42 -05:00
2008-03-01 04:01:51 -05:00
USING: kernel system namespaces sequences splitting combinators
io io.files io.launcher prettyprint
2008-02-24 22:30:45 -05:00
bake combinators.cleave builder.common builder.util ;
2008-02-22 18:25:42 -05:00
IN: builder.release
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-03-01 04:01:51 -05:00
: releases ( -- path )
builds "releases" append-path
2008-03-01 04:01:51 -05:00
dup exists? not
[ dup make-directory ]
when ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: common-files ( -- seq )
{
"boot.x86.32.image"
"boot.x86.64.image"
2008-03-07 09:52:23 -05:00
"boot.macosx-ppc.image"
2008-03-28 00:18:43 -04:00
"boot.linux-ppc.image"
2008-02-22 18:25:42 -05:00
"vm"
"temp"
"logs"
".git"
".gitignore"
"Makefile"
"unmaintained"
2008-03-28 00:18:43 -04:00
"build-support"
2008-02-22 18:25:42 -05:00
} ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: cpu- ( -- cpu ) cpu unparse "." split "-" join ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: base-name ( -- string )
{ "factor" [ os unparse ] cpu- stamp> } to-strings "-" join ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: extension ( -- extension )
{
{ [ os winnt? ] [ ".zip" ] }
{ [ os macosx? ] [ ".dmg" ] }
{ [ os unix? ] [ ".tar.gz" ] }
2008-02-22 18:25:42 -05:00
}
cond ;
2008-02-22 18:25:42 -05:00
: archive-name ( -- string ) base-name extension append ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-03-01 04:01:51 -05:00
: windows-archive-cmd ( -- cmd ) { "zip" "-r" archive-name "factor" } ;
2008-02-22 18:25:42 -05:00
2008-03-01 04:01:51 -05:00
: macosx-archive-cmd ( -- cmd )
{ "hdiutil" "create"
"-srcfolder" "factor"
"-fs" "HFS+"
"-volname" "factor"
archive-name } ;
2008-02-22 18:25:42 -05:00
2008-03-01 04:01:51 -05:00
: unix-archive-cmd ( -- cmd ) { "tar" "-cvzf" archive-name "factor" } ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-03-01 04:01:51 -05:00
: archive-cmd ( -- cmd )
{
{ [ os windows? ] [ windows-archive-cmd ] }
{ [ os macosx? ] [ macosx-archive-cmd ] }
{ [ os unix? ] [ unix-archive-cmd ] }
2008-03-01 04:01:51 -05:00
}
cond ;
2008-02-22 18:25:42 -05:00
2008-03-01 04:01:51 -05:00
: make-archive ( -- ) archive-cmd to-strings try-process ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2008-03-01 04:01:51 -05:00
: remove-common-files ( -- )
{ "rm" "-rf" common-files } to-strings try-process ;
2008-02-25 19:39:27 -05:00
2008-03-01 04:01:51 -05:00
: remove-factor-app ( -- )
os macosx? not [ { "rm" "-rf" "Factor.app" } try-process ] when ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SYMBOL: upload-to-factorcode
: platform ( -- string ) { [ os unparse ] cpu- } to-strings "-" join ;
: remote-location ( -- dest )
"factorcode.org:/var/www/factorcode.org/newsite/downloads"
platform
append-path ;
: upload ( -- )
{ "scp" archive-name remote-location } to-strings
[ "Error uploading binary to factorcode" print ]
run-or-bail ;
: maybe-upload ( -- )
upload-to-factorcode get
[ upload ]
when ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! : release ( -- )
! "factor"
! [
! remove-factor-app
! remove-common-files
! ]
! with-directory
! make-archive
! archive-name releases move-file-into ;
2008-02-22 18:25:42 -05:00
: release ( -- )
2008-03-01 04:01:51 -05:00
"factor"
[
remove-factor-app
remove-common-files
]
with-directory
make-archive
maybe-upload
2008-03-01 04:01:51 -05:00
archive-name releases move-file-into ;
2008-02-24 22:30:45 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: release? ( -- ? )
{
2008-02-25 23:24:15 -05:00
"./load-everything-vocabs"
"./test-all-vocabs"
2008-02-24 22:30:45 -05:00
}
[ eval-file empty? ]
all? ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: maybe-release ( -- ) release? [ release ] when ;