diff --git a/unmaintained/update/backup/backup.factor b/extra/update/backup/backup.factor similarity index 87% rename from unmaintained/update/backup/backup.factor rename to extra/update/backup/backup.factor index 0dcf853b98..0c7b442ffa 100644 --- a/unmaintained/update/backup/backup.factor +++ b/extra/update/backup/backup.factor @@ -1,5 +1,5 @@ -USING: namespaces debugger io.files bootstrap.image builder.util ; +USING: namespaces debugger io.files bootstrap.image update.util ; IN: update.backup diff --git a/unmaintained/update/latest/latest.factor b/extra/update/latest/latest.factor similarity index 94% rename from unmaintained/update/latest/latest.factor rename to extra/update/latest/latest.factor index df057422f9..7cc2fac853 100644 --- a/unmaintained/update/latest/latest.factor +++ b/extra/update/latest/latest.factor @@ -1,6 +1,6 @@ USING: kernel namespaces system io.files bootstrap.image http.client - builder.util update update.backup ; + update update.backup update.util ; IN: update.latest diff --git a/unmaintained/update/update.factor b/extra/update/update.factor similarity index 94% rename from unmaintained/update/update.factor rename to extra/update/update.factor index 1d25a9792e..c6a5671345 100644 --- a/unmaintained/update/update.factor +++ b/extra/update/update.factor @@ -1,7 +1,9 @@ USING: kernel system sequences io.files io.launcher bootstrap.image http.client - builder.util builder.release.branch ; + update.util ; + + ! builder.util builder.release.branch ; IN: update diff --git a/extra/update/util/util.factor b/extra/update/util/util.factor new file mode 100644 index 0000000000..b638b61528 --- /dev/null +++ b/extra/update/util/util.factor @@ -0,0 +1,62 @@ + +USING: kernel classes strings quotations words math math.parser arrays + combinators.cleave + accessors + system prettyprint splitting + sequences combinators sequences.deep + io + io.launcher + io.encodings.utf8 + calendar + calendar.format ; + +IN: update.util + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +DEFER: to-strings + +: to-string ( obj -- str ) + dup class + { + { \ string [ ] } + { \ quotation [ call ] } + { \ word [ execute ] } + { \ fixnum [ number>string ] } + { \ array [ to-strings concat ] } + } + case ; + +: to-strings ( seq -- str ) + dup [ string? ] all? + [ ] + [ [ to-string ] map flatten ] + if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: cpu- ( -- cpu ) cpu unparse "." split "-" join ; + +: platform ( -- string ) { [ os unparse ] cpu- } to-strings "-" join ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: branch-name ( -- string ) "clean-" platform append ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: gnu-make ( -- string ) + os { freebsd openbsd netbsd } member? [ "gmake" ] [ "make" ] if ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: git-id ( -- id ) + { "git" "show" } utf8 [ readln ] with-input-stream + " " split second ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: datestamp ( -- string ) + now + { year>> month>> day>> hour>> minute>> } + [ pad-00 ] map "-" join ;