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
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 "." split "-" join ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: base-name ( -- string ) { "factor" os cpu- stamp> } to-strings "-" join ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: extension ( -- extension )
os
{
{ "linux" [ ".tar.gz" ] }
{ "winnt" [ ".zip" ] }
{ "macosx" [ ".dmg" ] }
}
case ;
: 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 )
{
{ [ windows? ] [ windows-archive-cmd ] }
{ [ macosx? ] [ macosx-archive-cmd ] }
{ [ unix? ] [ unix-archive-cmd ] }
}
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 ( -- )
macosx? not [ { "rm" "-rf" "Factor.app" } try-process ] when ;
2008-02-22 18:25:42 -05:00
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SYMBOL: upload-to-factorcode
: platform ( -- string ) { os 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 ;