Merge branch 'master' of git://factorcode.org/git/factor
commit
d4f37e175f
|
@ -57,8 +57,8 @@ ARTICLE: "delete-move-copy" "Deleting, moving, copying files"
|
||||||
"The operations for moving and copying files come in three flavors:"
|
"The operations for moving and copying files come in three flavors:"
|
||||||
{ $list
|
{ $list
|
||||||
{ "A word named " { $snippet { $emphasis "operation" } } " which takes a source and destination path." }
|
{ "A word named " { $snippet { $emphasis "operation" } } " which takes a source and destination path." }
|
||||||
{ "A word named " { $snippet { $emphasis "operation" } "-to" } " which takes a source path and destination directory. The destination file will be stored in the destination directory and will have the same file name as the source path." }
|
{ "A word named " { $snippet { $emphasis "operation" } "-into" } " which takes a source path and destination directory. The destination file will be stored in the destination directory and will have the same file name as the source path." }
|
||||||
{ "A word named " { $snippet { $emphasis "operation" } "s-to" } " which takes a sequence of source paths and destination directory." }
|
{ "A word named " { $snippet { $emphasis "operation" } "s-into" } " which takes a sequence of source paths and destination directory." }
|
||||||
}
|
}
|
||||||
"Since both of the above lists apply to copying files, that this means that there are a total of six variations on copying a file."
|
"Since both of the above lists apply to copying files, that this means that there are a total of six variations on copying a file."
|
||||||
$nl
|
$nl
|
||||||
|
@ -68,16 +68,16 @@ $nl
|
||||||
{ $subsection delete-tree }
|
{ $subsection delete-tree }
|
||||||
"Moving files:"
|
"Moving files:"
|
||||||
{ $subsection move-file }
|
{ $subsection move-file }
|
||||||
{ $subsection move-file-to }
|
{ $subsection move-file-into }
|
||||||
{ $subsection move-files-to }
|
{ $subsection move-files-into }
|
||||||
"Copying files:"
|
"Copying files:"
|
||||||
{ $subsection copy-file }
|
{ $subsection copy-file }
|
||||||
{ $subsection copy-file-to }
|
{ $subsection copy-file-into }
|
||||||
{ $subsection copy-files-to }
|
{ $subsection copy-files-into }
|
||||||
"Copying directory trees recursively:"
|
"Copying directory trees recursively:"
|
||||||
{ $subsection copy-tree }
|
{ $subsection copy-tree }
|
||||||
{ $subsection copy-tree-to }
|
{ $subsection copy-tree-into }
|
||||||
{ $subsection copy-trees-to }
|
{ $subsection copy-trees-into }
|
||||||
"On most operating systems, files can only be moved within the same file system. To move files between file systems, use " { $link copy-file } " followed by " { $link delete-file } " on the old name." ;
|
"On most operating systems, files can only be moved within the same file system. To move files between file systems, use " { $link copy-file } " followed by " { $link delete-file } " on the old name." ;
|
||||||
|
|
||||||
ARTICLE: "io.files" "Basic file operations"
|
ARTICLE: "io.files" "Basic file operations"
|
||||||
|
@ -267,12 +267,12 @@ HELP: move-file
|
||||||
{ $description "Moves or renames a file." }
|
{ $description "Moves or renames a file." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
||||||
|
|
||||||
HELP: move-file-to
|
HELP: move-file-into
|
||||||
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Moves a file to another directory without renaming it." }
|
{ $description "Moves a file to another directory without renaming it." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
||||||
|
|
||||||
HELP: move-files-to
|
HELP: move-files-into
|
||||||
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Moves a set of files to another directory." }
|
{ $description "Moves a set of files to another directory." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the move operation fails." } ;
|
||||||
|
@ -283,12 +283,12 @@ HELP: copy-file
|
||||||
{ $notes "This operation attempts to preserve the original file's attributes, however not all attributes may be preserved." }
|
{ $notes "This operation attempts to preserve the original file's attributes, however not all attributes may be preserved." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-file-to
|
HELP: copy-file-into
|
||||||
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a file to another directory." }
|
{ $description "Copies a file to another directory." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-files-to
|
HELP: copy-files-into
|
||||||
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a set of files to another directory." }
|
{ $description "Copies a set of files to another directory." }
|
||||||
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
{ $errors "Throws an error if the file does not exist or if the copy operation fails." } ;
|
||||||
|
@ -299,12 +299,12 @@ HELP: copy-tree
|
||||||
{ $notes "This operation attempts to preserve original file attributes, however not all attributes may be preserved." }
|
{ $notes "This operation attempts to preserve original file attributes, however not all attributes may be preserved." }
|
||||||
{ $errors "Throws an error if the copy operation fails." } ;
|
{ $errors "Throws an error if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-tree-to
|
HELP: copy-tree-into
|
||||||
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
{ $values { "from" "a pathname string" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a directory tree to another directory, recursively." }
|
{ $description "Copies a directory tree to another directory, recursively." }
|
||||||
{ $errors "Throws an error if the copy operation fails." } ;
|
{ $errors "Throws an error if the copy operation fails." } ;
|
||||||
|
|
||||||
HELP: copy-trees-to
|
HELP: copy-trees-into
|
||||||
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
{ $values { "files" "a sequence of pathname strings" } { "to" "a directory pathname string" } }
|
||||||
{ $description "Copies a set of directory trees to another directory, recursively." }
|
{ $description "Copies a set of directory trees to another directory, recursively." }
|
||||||
{ $errors "Throws an error if the copy operation fails." } ;
|
{ $errors "Throws an error if the copy operation fails." } ;
|
||||||
|
|
|
@ -137,37 +137,37 @@ HOOK: delete-directory io-backend ( path -- )
|
||||||
! Moving and renaming files
|
! Moving and renaming files
|
||||||
HOOK: move-file io-backend ( from to -- )
|
HOOK: move-file io-backend ( from to -- )
|
||||||
|
|
||||||
: move-file-to ( from to -- )
|
: move-file-into ( from to -- )
|
||||||
to-directory move-file ;
|
to-directory move-file ;
|
||||||
|
|
||||||
: move-files-to ( files to -- )
|
: move-files-into ( files to -- )
|
||||||
[ move-file-to ] curry each ;
|
[ move-file-into ] curry each ;
|
||||||
|
|
||||||
! Copying files
|
! Copying files
|
||||||
HOOK: copy-file io-backend ( from to -- )
|
HOOK: copy-file io-backend ( from to -- )
|
||||||
|
|
||||||
: copy-file-to ( from to -- )
|
: copy-file-into ( from to -- )
|
||||||
to-directory copy-file ;
|
to-directory copy-file ;
|
||||||
|
|
||||||
: copy-files-to ( files to -- )
|
: copy-files-into ( files to -- )
|
||||||
[ copy-file-to ] curry each ;
|
[ copy-file-into ] curry each ;
|
||||||
|
|
||||||
DEFER: copy-tree-to
|
DEFER: copy-tree-into
|
||||||
|
|
||||||
: copy-tree ( from to -- )
|
: copy-tree ( from to -- )
|
||||||
over directory? [
|
over directory? [
|
||||||
>r dup directory swap r> [
|
>r dup directory swap r> [
|
||||||
>r swap first path+ r> copy-tree-to
|
>r swap first path+ r> copy-tree-into
|
||||||
] 2curry each
|
] 2curry each
|
||||||
] [
|
] [
|
||||||
copy-file
|
copy-file
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: copy-tree-to ( from to -- )
|
: copy-tree-into ( from to -- )
|
||||||
to-directory copy-tree ;
|
to-directory copy-tree ;
|
||||||
|
|
||||||
: copy-trees-to ( files to -- )
|
: copy-trees-into ( files to -- )
|
||||||
[ copy-tree-to ] curry each ;
|
[ copy-tree-into ] curry each ;
|
||||||
|
|
||||||
! Special paths
|
! Special paths
|
||||||
: resource-path ( path -- newpath )
|
: resource-path ( path -- newpath )
|
||||||
|
|
|
@ -4,7 +4,12 @@ IN: bootstrap.image.upload
|
||||||
USING: http.client crypto.md5 splitting assocs kernel io.files
|
USING: http.client crypto.md5 splitting assocs kernel io.files
|
||||||
bootstrap.image sequences io namespaces io.launcher math ;
|
bootstrap.image sequences io namespaces io.launcher math ;
|
||||||
|
|
||||||
: destination "slava@factorcode.org:www/images/latest/" ;
|
SYMBOL: upload-images-destination
|
||||||
|
|
||||||
|
: destination ( -- dest )
|
||||||
|
upload-images-destination get
|
||||||
|
"slava@/var/www/factorcode.org/w/images/latest/"
|
||||||
|
or ;
|
||||||
|
|
||||||
: checksums "checksums.txt" temp-file ;
|
: checksums "checksums.txt" temp-file ;
|
||||||
|
|
||||||
|
@ -23,6 +28,8 @@ bootstrap.image sequences io namespaces io.launcher math ;
|
||||||
] { } make try-process ;
|
] { } make try-process ;
|
||||||
|
|
||||||
: new-images ( -- )
|
: new-images ( -- )
|
||||||
make-images compute-checksums upload-images ;
|
"" resource-path
|
||||||
|
[ make-images compute-checksums upload-images ]
|
||||||
|
with-directory ;
|
||||||
|
|
||||||
MAIN: new-images
|
MAIN: new-images
|
||||||
|
|
|
@ -39,29 +39,27 @@ IN: builder
|
||||||
|
|
||||||
: record-git-id ( -- ) git-id "../git-id" [ . ] with-file-writer ;
|
: record-git-id ( -- ) git-id "../git-id" [ . ] with-file-writer ;
|
||||||
|
|
||||||
: make-clean ( -- desc ) { "make" "clean" } ;
|
: do-make-clean ( -- desc ) { "make" "clean" } try-process ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: target ( -- target ) { os [ cpu "." split ] } to-strings "-" join ;
|
! : target ( -- target ) { os [ cpu "." split ] } to-strings "-" join ;
|
||||||
|
|
||||||
: make-vm ( -- desc )
|
: make-vm ( -- desc )
|
||||||
<process*>
|
<process*>
|
||||||
{ "make" target } to-strings >>arguments
|
{ "make" } >>arguments
|
||||||
"../compile-log" >>stdout
|
"../compile-log" >>stdout
|
||||||
+stdout+ >>stderr
|
+stdout+ >>stderr
|
||||||
>desc ;
|
>desc ;
|
||||||
|
|
||||||
|
: do-make-vm ( -- )
|
||||||
|
make-vm [ "vm compile error" print "../compile-log" cat ] run-or-bail ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: copy-image ( -- )
|
: copy-image ( -- )
|
||||||
"../../factor/" my-boot-image-name append
|
builds "factor" path+ my-boot-image-name path+ ".." copy-file-into
|
||||||
"../" my-boot-image-name append
|
builds "factor" path+ my-boot-image-name path+ "." copy-file-into ;
|
||||||
copy-file
|
|
||||||
|
|
||||||
"../../factor/" my-boot-image-name append
|
|
||||||
my-boot-image-name
|
|
||||||
copy-file ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -77,6 +75,9 @@ IN: builder
|
||||||
20 minutes >>timeout
|
20 minutes >>timeout
|
||||||
>desc ;
|
>desc ;
|
||||||
|
|
||||||
|
: do-bootstrap ( -- )
|
||||||
|
bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail ;
|
||||||
|
|
||||||
: builder-test-cmd ( -- cmd )
|
: builder-test-cmd ( -- cmd )
|
||||||
{ "./factor" "-run=builder.test" } to-strings ;
|
{ "./factor" "-run=builder.test" } to-strings ;
|
||||||
|
|
||||||
|
@ -89,6 +90,9 @@ IN: builder
|
||||||
45 minutes >>timeout
|
45 minutes >>timeout
|
||||||
>desc ;
|
>desc ;
|
||||||
|
|
||||||
|
: do-builder-test ( -- )
|
||||||
|
builder-test [ "Test error" print "../test-log" 100 cat-n ] run-or-bail ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
SYMBOL: build-status
|
SYMBOL: build-status
|
||||||
|
@ -101,8 +105,8 @@ SYMBOL: build-status
|
||||||
|
|
||||||
enter-build-dir
|
enter-build-dir
|
||||||
|
|
||||||
"report" [
|
"report"
|
||||||
|
[
|
||||||
"Build machine: " write host-name print
|
"Build machine: " write host-name print
|
||||||
"CPU: " write cpu print
|
"CPU: " write cpu print
|
||||||
"OS: " write os print
|
"OS: " write os print
|
||||||
|
@ -110,43 +114,37 @@ SYMBOL: build-status
|
||||||
|
|
||||||
git-clone [ "git clone failed" print ] run-or-bail
|
git-clone [ "git clone failed" print ] run-or-bail
|
||||||
|
|
||||||
"factor" cd
|
"factor"
|
||||||
|
[
|
||||||
record-git-id
|
record-git-id
|
||||||
|
do-make-clean
|
||||||
make-clean run-process drop
|
do-make-vm
|
||||||
|
|
||||||
make-vm [ "vm compile error" print "../compile-log" cat ] run-or-bail
|
|
||||||
|
|
||||||
copy-image
|
copy-image
|
||||||
|
do-bootstrap
|
||||||
|
do-builder-test
|
||||||
|
]
|
||||||
|
with-directory
|
||||||
|
|
||||||
bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail
|
"test-log" delete-file
|
||||||
|
|
||||||
builder-test [ "Test error" print "../test-log" 100 cat-n ] run-or-bail
|
"Boot time: " write "boot-time" eval-file milli-seconds>time print
|
||||||
|
"Load time: " write "load-time" eval-file milli-seconds>time print
|
||||||
|
"Test time: " write "test-time" eval-file milli-seconds>time print nl
|
||||||
|
|
||||||
"../test-log" delete-file
|
"Did not pass load-everything: " print "load-everything-vocabs" cat
|
||||||
|
"Did not pass test-all: " print "test-all-vocabs" cat
|
||||||
|
|
||||||
"Boot time: " write "../boot-time" eval-file milli-seconds>time print
|
"Benchmarks: " print "benchmarks" eval-file benchmarks.
|
||||||
"Load time: " write "../load-time" eval-file milli-seconds>time print
|
|
||||||
"Test time: " write "../test-time" eval-file milli-seconds>time print nl
|
|
||||||
|
|
||||||
"Did not pass load-everything: " print "../load-everything-vocabs" cat
|
|
||||||
"Did not pass test-all: " print "../test-all-vocabs" cat
|
|
||||||
|
|
||||||
"Benchmarks: " print
|
|
||||||
"../benchmarks" [ stdio get contents eval ] with-file-reader benchmarks.
|
|
||||||
|
|
||||||
nl
|
nl
|
||||||
|
|
||||||
show-benchmark-deltas
|
show-benchmark-deltas
|
||||||
|
|
||||||
"../benchmarks" "../../benchmarks" copy-file
|
"benchmarks" ".." copy-file-into
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
maybe-release
|
maybe-release
|
||||||
|
]
|
||||||
] with-file-writer
|
with-file-writer
|
||||||
|
|
||||||
build-status on ;
|
build-status on ;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
|
|
||||||
USING: kernel namespaces sequences combinators io.files io.launcher
|
USING: kernel system namespaces sequences splitting combinators
|
||||||
|
io.files io.launcher
|
||||||
bake combinators.cleave builder.common builder.util ;
|
bake combinators.cleave builder.common builder.util ;
|
||||||
|
|
||||||
IN: builder.release
|
IN: builder.release
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: releases ( -- path ) builds "/releases" append dup make-directory ;
|
: releases ( -- path )
|
||||||
|
builds "releases" path+
|
||||||
|
dup exists? not
|
||||||
|
[ dup make-directory ]
|
||||||
|
when ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -34,8 +39,6 @@ IN: builder.release
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
USING: system sequences splitting ;
|
|
||||||
|
|
||||||
: cpu- ( -- cpu ) cpu "." split "-" join ;
|
: cpu- ( -- cpu ) cpu "." split "-" join ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
@ -57,70 +60,46 @@ USING: system sequences splitting ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: move-file ( source destination -- )
|
: windows-archive-cmd ( -- cmd ) { "zip" "-r" archive-name "factor" } ;
|
||||||
swap { "mv" , , } bake run-process drop ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: linux-release ( -- )
|
|
||||||
|
|
||||||
"factor" cd
|
|
||||||
|
|
||||||
{ "rm" "-rf" "Factor.app" } run-process drop
|
|
||||||
|
|
||||||
{ "rm" "-rf" common-files } to-strings run-process drop
|
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
{ "tar" "-cvzf" archive-name "factor" } to-strings run-process drop
|
|
||||||
|
|
||||||
archive-name releases move-file ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: windows-release ( -- )
|
|
||||||
|
|
||||||
"factor" cd
|
|
||||||
|
|
||||||
{ "rm" "-rf" "Factor.app" } run-process drop
|
|
||||||
|
|
||||||
{ "rm" "-rf" common-files } to-strings run-process drop
|
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
{ "zip" "-r" archive-name "factor" } to-strings run-process drop
|
|
||||||
|
|
||||||
archive-name releases move-file ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: macosx-release ( -- )
|
|
||||||
|
|
||||||
"factor" cd
|
|
||||||
|
|
||||||
{ "rm" "-rf" common-files } to-strings run-process drop
|
|
||||||
|
|
||||||
".." cd
|
|
||||||
|
|
||||||
|
: macosx-archive-cmd ( -- cmd )
|
||||||
{ "hdiutil" "create"
|
{ "hdiutil" "create"
|
||||||
"-srcfolder" "factor"
|
"-srcfolder" "factor"
|
||||||
"-fs" "HFS+"
|
"-fs" "HFS+"
|
||||||
"-volname" "factor"
|
"-volname" "factor"
|
||||||
archive-name }
|
archive-name } ;
|
||||||
to-strings run-process drop
|
|
||||||
|
|
||||||
archive-name releases move-file ;
|
: unix-archive-cmd ( -- cmd ) { "tar" "-cvzf" archive-name "factor" } ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: release ( -- )
|
: archive-cmd ( -- cmd )
|
||||||
os
|
|
||||||
{
|
{
|
||||||
{ "linux" [ linux-release ] }
|
{ [ windows? ] [ windows-archive-cmd ] }
|
||||||
{ "winnt" [ windows-release ] }
|
{ [ macosx? ] [ macosx-archive-cmd ] }
|
||||||
{ "macosx" [ macosx-release ] }
|
{ [ unix? ] [ unix-archive-cmd ] }
|
||||||
}
|
}
|
||||||
case ;
|
cond ;
|
||||||
|
|
||||||
|
: make-archive ( -- ) archive-cmd to-strings try-process ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
: remove-common-files ( -- )
|
||||||
|
{ "rm" "-rf" common-files } to-strings try-process ;
|
||||||
|
|
||||||
|
: remove-factor-app ( -- )
|
||||||
|
macosx? not [ { "rm" "-rf" "Factor.app" } try-process ] when ;
|
||||||
|
|
||||||
|
: release ( -- )
|
||||||
|
"factor"
|
||||||
|
[
|
||||||
|
remove-factor-app
|
||||||
|
remove-common-files
|
||||||
|
]
|
||||||
|
with-directory
|
||||||
|
make-archive
|
||||||
|
archive-name releases move-file-into ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
|
||||||
USING: alien alien.c-types arrays calendar.backend
|
USING: alien alien.c-types arrays calendar.backend
|
||||||
kernel structs math unix namespaces ;
|
kernel structs math unix.time namespaces ;
|
||||||
|
|
||||||
IN: calendar.unix
|
IN: calendar.unix
|
||||||
|
|
||||||
TUPLE: unix-calendar ;
|
TUPLE: unix-calendar ;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
USING: io.backend ;
|
||||||
|
IN: io.files.temporary.backend
|
||||||
|
|
||||||
|
HOOK: (temporary-file) io-backend ( path -- stream path )
|
||||||
|
HOOK: temporary-path io-backend ( -- path )
|
|
@ -0,0 +1,32 @@
|
||||||
|
USING: kernel math math.bitfields combinators.lib math.parser
|
||||||
|
random sequences sequences.lib continuations namespaces
|
||||||
|
io.files io.backend io.nonblocking io arrays
|
||||||
|
io.files.temporary.backend system combinators vocabs.loader ;
|
||||||
|
IN: io.files.temporary
|
||||||
|
|
||||||
|
: random-letter ( -- ch ) 26 random { CHAR: a CHAR: A } random + ;
|
||||||
|
|
||||||
|
: random-ch ( -- ch )
|
||||||
|
{ t f } random [ 10 random CHAR: 0 + ] [ random-letter ] if ;
|
||||||
|
|
||||||
|
: random-name ( n -- string ) [ drop random-ch ] "" map-as ;
|
||||||
|
|
||||||
|
: <temporary-file> ( prefix suffix -- path duplex-stream )
|
||||||
|
temporary-path -rot
|
||||||
|
[ 10 random-name swap 3append path+ dup (temporary-file) ] 3curry
|
||||||
|
10 retry ;
|
||||||
|
|
||||||
|
: with-temporary-file ( quot -- path )
|
||||||
|
>r f f <temporary-file> r> with-stream ;
|
||||||
|
|
||||||
|
: temporary-directory ( -- path )
|
||||||
|
[ temporary-path 10 random-name path+ dup make-directory ] 10 retry ;
|
||||||
|
|
||||||
|
: with-temporary-directory ( quot -- )
|
||||||
|
>r temporary-directory r>
|
||||||
|
[ with-directory ] 2keep drop delete-tree ;
|
||||||
|
|
||||||
|
{
|
||||||
|
{ [ unix? ] [ "io.unix.files.temporary" ] }
|
||||||
|
{ [ windows? ] [ "io.windows.files.temporary" ] }
|
||||||
|
} cond require
|
|
@ -1,8 +1,8 @@
|
||||||
! Copyright (C) 2005, 2008 Slava Pestov.
|
! Copyright (C) 2005, 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io.backend io.nonblocking io.unix.backend io.files io
|
USING: io.backend io.nonblocking io.unix.backend io.files io
|
||||||
unix unix.stat kernel math continuations math.bitfields byte-arrays
|
unix unix.stat unix.time kernel math continuations math.bitfields
|
||||||
alien combinators combinators.cleave calendar ;
|
byte-arrays alien combinators combinators.cleave calendar ;
|
||||||
|
|
||||||
IN: io.unix.files
|
IN: io.unix.files
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
USING: io.files.temporary.backend io.nonblocking io.windows
|
||||||
|
kernel system windows.kernel32 ;
|
||||||
|
|
||||||
|
IN: io.windows.files.temporary
|
||||||
|
|
||||||
|
M: windows-io (temporary-file) ( path -- stream )
|
||||||
|
GENERIC_WRITE CREATE_NEW 0 open-file 0 <win32-file> <writer> ;
|
||||||
|
|
||||||
|
M: windows-io temporary-path ( -- path )
|
||||||
|
"TEMP" os-env ;
|
|
@ -1,8 +1,9 @@
|
||||||
USING: kernel system io.files.unique.backend ;
|
USING: kernel system io.files.unique.backend
|
||||||
|
windows.kernel32 io.windows io.nonblocking ;
|
||||||
IN: io.windows.files.unique
|
IN: io.windows.files.unique
|
||||||
|
|
||||||
M: windows-io (make-unique-file) ( path -- stream )
|
M: windows-io (make-unique-file) ( path -- stream )
|
||||||
GENERIC_WRITE CREATE_NEW 0 open-file 0 <writer> ;
|
GENERIC_WRITE CREATE_NEW 0 open-file 0 <win32-file> <writer> ;
|
||||||
|
|
||||||
M: windows-io temporary-path ( -- path )
|
M: windows-io temporary-path ( -- path )
|
||||||
"TEMP" os-env ;
|
"TEMP" os-env ;
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
USING: kernel alien.syntax alien.c-types math ;
|
||||||
|
|
||||||
|
IN: unix.time
|
||||||
|
|
||||||
|
TYPEDEF: uint time_t
|
||||||
|
|
||||||
|
C-STRUCT: tm
|
||||||
|
{ "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?)
|
||||||
|
{ "int" "min" } ! Minutes: 0-59
|
||||||
|
{ "int" "hour" } ! Hours since midnight: 0-23
|
||||||
|
{ "int" "mday" } ! Day of the month: 1-31
|
||||||
|
{ "int" "mon" } ! Months *since* january: 0-11
|
||||||
|
{ "int" "year" } ! Years since 1900
|
||||||
|
{ "int" "wday" } ! Days since Sunday (0-6)
|
||||||
|
{ "int" "yday" } ! Days since Jan. 1: 0-365
|
||||||
|
{ "int" "isdst" } ! +1 Daylight Savings Time, 0 No DST,
|
||||||
|
{ "long" "gmtoff" } ! Seconds: 0-59 (K&R says 0-61?)
|
||||||
|
{ "char*" "zone" } ;
|
||||||
|
|
||||||
|
C-STRUCT: timespec
|
||||||
|
{ "time_t" "sec" }
|
||||||
|
{ "long" "nsec" } ;
|
||||||
|
|
||||||
|
: make-timespec ( ms -- timespec )
|
||||||
|
1000 /mod 1000000 *
|
||||||
|
"timespec" <c-object>
|
||||||
|
[ set-timespec-nsec ] keep
|
||||||
|
[ set-timespec-sec ] keep ;
|
||||||
|
|
||||||
|
FUNCTION: time_t time ( time_t* t ) ;
|
||||||
|
FUNCTION: tm* localtime ( time_t* clock ) ;
|
|
@ -8,32 +8,8 @@ IN: unix
|
||||||
|
|
||||||
TYPEDEF: uint in_addr_t
|
TYPEDEF: uint in_addr_t
|
||||||
TYPEDEF: uint socklen_t
|
TYPEDEF: uint socklen_t
|
||||||
TYPEDEF: uint time_t
|
|
||||||
TYPEDEF: ulong size_t
|
TYPEDEF: ulong size_t
|
||||||
|
|
||||||
C-STRUCT: tm
|
|
||||||
{ "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?)
|
|
||||||
{ "int" "min" } ! Minutes: 0-59
|
|
||||||
{ "int" "hour" } ! Hours since midnight: 0-23
|
|
||||||
{ "int" "mday" } ! Day of the month: 1-31
|
|
||||||
{ "int" "mon" } ! Months *since* january: 0-11
|
|
||||||
{ "int" "year" } ! Years since 1900
|
|
||||||
{ "int" "wday" } ! Days since Sunday (0-6)
|
|
||||||
{ "int" "yday" } ! Days since Jan. 1: 0-365
|
|
||||||
{ "int" "isdst" } ! +1 Daylight Savings Time, 0 No DST,
|
|
||||||
{ "long" "gmtoff" } ! Seconds: 0-59 (K&R says 0-61?)
|
|
||||||
{ "char*" "zone" } ;
|
|
||||||
|
|
||||||
C-STRUCT: timespec
|
|
||||||
{ "time_t" "sec" }
|
|
||||||
{ "long" "nsec" } ;
|
|
||||||
|
|
||||||
: make-timespec ( ms -- timespec )
|
|
||||||
1000 /mod 1000000 *
|
|
||||||
"timespec" <c-object>
|
|
||||||
[ set-timespec-nsec ] keep
|
|
||||||
[ set-timespec-sec ] keep ;
|
|
||||||
|
|
||||||
: PROT_NONE 0 ; inline
|
: PROT_NONE 0 ; inline
|
||||||
: PROT_READ 1 ; inline
|
: PROT_READ 1 ; inline
|
||||||
: PROT_WRITE 2 ; inline
|
: PROT_WRITE 2 ; inline
|
||||||
|
@ -89,7 +65,6 @@ FUNCTION: ushort htons ( ushort n ) ;
|
||||||
FUNCTION: int ioctl ( int fd, ulong request, char* argp ) ;
|
FUNCTION: int ioctl ( int fd, ulong request, char* argp ) ;
|
||||||
FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
|
FUNCTION: int lchown ( char* path, uid_t owner, gid_t group ) ;
|
||||||
FUNCTION: int listen ( int s, int backlog ) ;
|
FUNCTION: int listen ( int s, int backlog ) ;
|
||||||
FUNCTION: tm* localtime ( time_t* clock ) ;
|
|
||||||
FUNCTION: off_t lseek ( int fildes, off_t offset, int whence ) ;
|
FUNCTION: off_t lseek ( int fildes, off_t offset, int whence ) ;
|
||||||
FUNCTION: void* mmap ( void* addr, size_t len, int prot, int flags, int fd, off_t offset ) ;
|
FUNCTION: void* mmap ( void* addr, size_t len, int prot, int flags, int fd, off_t offset ) ;
|
||||||
FUNCTION: int munmap ( void* addr, size_t len ) ;
|
FUNCTION: int munmap ( void* addr, size_t len ) ;
|
||||||
|
@ -117,7 +92,6 @@ FUNCTION: int setuid ( uid_t uid ) ;
|
||||||
FUNCTION: int socket ( int domain, int type, int protocol ) ;
|
FUNCTION: int socket ( int domain, int type, int protocol ) ;
|
||||||
FUNCTION: char* strerror ( int errno ) ;
|
FUNCTION: char* strerror ( int errno ) ;
|
||||||
FUNCTION: int system ( char* command ) ;
|
FUNCTION: int system ( char* command ) ;
|
||||||
FUNCTION: time_t time ( time_t* t ) ;
|
|
||||||
FUNCTION: int unlink ( char* path ) ;
|
FUNCTION: int unlink ( char* path ) ;
|
||||||
FUNCTION: int utimes ( char* path, timeval[2] times ) ;
|
FUNCTION: int utimes ( char* path, timeval[2] times ) ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue