| 1 |
#!/usr/bin/gosh |
| 2 |
;; |
| 3 |
;; Scoop manifest ganerator |
| 4 |
;; |
| 5 |
;; Usage: |
| 6 |
;; $ gosh make-scoop-manifasto.scm --version="version number" --msi64="64bit MSI file" --msi32="32bit MSI file" > gauche.json |
| 7 |
;; |
| 8 |
;; |
| 9 |
;; NB: Output JSON file uses commpressed format. Use JSON pretty printer for |
| 10 |
;; human-readable form. |
| 11 |
;; $ emacs --batch --file=gauche.json --load=json \ |
| 12 |
;; --funcall=json-pretty-print-buffer \ |
| 13 |
;; --funcall=save-buffer |
| 14 |
;; |
| 15 |
|
| 16 |
(use gauche.parseopt) |
| 17 |
(use rfc.json) |
| 18 |
(use rfc.sha) |
| 19 |
(use text.tr) |
| 20 |
|
| 21 |
(define (hex-digest-file file) |
| 22 |
(with-input-from-file |
| 23 |
file |
| 24 |
(lambda () |
| 25 |
(digest-hexify (sha256-digest))))) |
| 26 |
|
| 27 |
(define (print-manifesto version msi64 msi32) |
| 28 |
(let ((underscoreVersion (string-tr version "." "_")) |
| 29 |
(hash64 (hex-digest-file msi64)) |
| 30 |
(hash32 (hex-digest-file msi32))) |
| 31 |
|
| 32 |
(construct-json |
| 33 |
`( |
| 34 |
("version" . ,version) |
| 35 |
("description" . "Scheme Scripting Engine") |
| 36 |
("homepage" . "https://practical-scheme.net/gauche/") |
| 37 |
("license" . "BSD-3-Clause") |
| 38 |
|
| 39 |
("architecture" . |
| 40 |
(("64bit" . |
| 41 |
(("url" . ,#"https://github.com/shirok/Gauche/releases/download/release~|underscoreVersion|/Gauche-mingw-~|version|-64bit.msi") |
| 42 |
("hash" . ,hash64))) |
| 43 |
("32bit" . |
| 44 |
(("url" . ,#"https://github.com/shirok/Gauche/releases/download/release~|underscoreVersion|/Gauche-mingw-~|version|-32bit.msi") |
| 45 |
("hash" . ,hash32))))) |
| 46 |
|
| 47 |
("extract_dir" . "Gauche") |
| 48 |
("bin" . |
| 49 |
#("bin\\gauche-cesconv.exe" |
| 50 |
"bin\\gauche-config.exe" |
| 51 |
"bin\\gauche-install.exe" |
| 52 |
"bin\\gauche-package.exe" |
| 53 |
"bin\\gosh.exe" |
| 54 |
"bin\\gosh-noconsole.exe")) |
| 55 |
|
| 56 |
("shortcuts" . |
| 57 |
#( |
| 58 |
#("bin\\gosh.exe" "Gosh") |
| 59 |
)) |
| 60 |
|
| 61 |
("checkver" . |
| 62 |
(("github" . "https://github.com/shirok/Gauche") |
| 63 |
("regex" . "mingw-([\\d.]+)-\\d+bit\\.msi"))) |
| 64 |
|
| 65 |
("autoupdate" . |
| 66 |
(("architecture" . |
| 67 |
(("64bit" . |
| 68 |
(("url" . "https://github.com/shirok/Gauche/releases/download/release$underscoreVersion/Gauche-mingw-$version-64bit.msi"))) |
| 69 |
("32bit" . |
| 70 |
(("url" . "https://github.com/shirok/Gauche/releases/download/release$underscoreVersion/Gauche-mingw-$version-32bit.msi"))))))) |
| 71 |
)) |
| 72 |
)) |
| 73 |
|
| 74 |
(define (main args) |
| 75 |
(let-args (cdr args) |
| 76 |
((version "version=s") |
| 77 |
(msi64 "msi64=s") |
| 78 |
(msi32 "msi32=s")) |
| 79 |
|
| 80 |
(if (not (and version msi64 msi32)) |
| 81 |
(error "Required option (version,msi64,msi32) is missing")) |
| 82 |
|
| 83 |
(print-manifesto version msi64 msi32) |
| 84 |
) |
| 85 |
0) |