Skip to content

Commit 4b14861

Browse files
authored
Merge pull request #1587 from clasp-developers/tarball
Add archive function for koga
2 parents 95198e5 + c81dac1 commit 4b14861

File tree

17 files changed

+80
-31
lines changed

17 files changed

+80
-31
lines changed

include/clasp/mps

Lines changed: 0 additions & 1 deletion
This file was deleted.

koga

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,8 @@
135135
(:tree ,(uiop:getcwd))
136136
:inherit-configuration))
137137
(asdf:load-system :koga)
138-
(apply #'uiop:symbol-call "KOGA" (if help "HELP" "SETUP") initargs))
138+
(apply #'uiop:symbol-call "KOGA"
139+
(cond (help "HELP")
140+
((getf initargs :archive) "ARCHIVE")
141+
(t "SETUP"))
142+
initargs))

src/asttooling/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/clbind/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/core/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/gctools/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/koga/archive.lisp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
(in-package #:koga)
2+
3+
(defun read-file-form (path &optional tag)
4+
(if tag
5+
(read-from-string (run-program-capture (format nil "git show ~a:~a" tag path)))
6+
(uiop:read-file-form path)))
7+
8+
(defun archive (&rest initargs
9+
&key archive extensions tag
10+
&allow-other-keys)
11+
(declare (ignore initargs))
12+
(let* ((prefix (format nil "clasp-~a/"
13+
(getf (read-file-form #P"version.sexp" tag) :version)))
14+
(tar-name (concatenate 'string (if (stringp archive) archive "archive") ".tar"))
15+
(gz-name (concatenate 'string tar-name ".gz")))
16+
(uiop:delete-file-if-exists tar-name)
17+
(uiop:delete-file-if-exists gz-name)
18+
(message nil "Creating main archive...")
19+
(run-program (format nil "git archive --output=~a --prefix=~a --format=tar ~a"
20+
tar-name prefix (or tag "HEAD")))
21+
(uiop:call-with-temporary-file
22+
(lambda (temp-path)
23+
(loop for source in (read-file-form #P"repos.sexp" tag)
24+
for name = (getf source :name)
25+
for directory = (getf source :directory)
26+
for extension = (getf source :extension)
27+
when (or (not extension)
28+
(member extension extensions))
29+
do (message nil "Creating ~(~a~) archive..." name)
30+
(run-program (format nil "git archive --output=~a --format=tar --prefix=~a~a ~a"
31+
temp-path prefix directory
32+
(if tag
33+
(or (getf source :branch)
34+
(getf source :commit))
35+
"HEAD"))
36+
:directory directory)
37+
(run-program (format nil "tar --concatenate --file ~a ~a"
38+
tar-name temp-path))))
39+
:want-stream-p nil)
40+
(message nil "Compressing archive...")
41+
(run-program (format nil "gzip ~a" tar-name))))

src/koga/koga.asd

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
(asdf:defsystem #:koga
1+
(asdf:defsystem "koga"
22
:description "A lisp based metabuilder for Clasp."
3-
:depends-on (#:alexandria
4-
#:asdf-groveler
5-
#:clasp-scraper
6-
#:closer-mop
7-
#:ninja
8-
#:shasht
9-
#:trivial-features)
3+
:depends-on ("alexandria"
4+
"asdf-groveler"
5+
"clasp-scraper"
6+
"closer-mop"
7+
"ninja"
8+
"shasht"
9+
"trivial-features")
10+
:serial t
1011
:components ((:file "packages")
1112
(:file "utilities")
1213
(:file "header")
@@ -19,4 +20,5 @@
1920
(:file "scripts")
2021
(:file "config-header")
2122
(:file "ninja")
22-
(:file "compile-commands")))
23+
(:file "compile-commands")
24+
(:file "archive")))

src/koga/packages.lisp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
(:use #:common-lisp)
33
(:nicknames #:k)
44
(:documentation "A lisp based metabuilder for Clasp.")
5-
(:export #:configure
5+
(:export #:archive
6+
#:configure
67
#:*extensions*
78
#:framework
89
#:help

src/koga/scripts.lisp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@
8181

8282
(defmethod print-prologue (configuration (name (eql :load-clasp)) output-stream)
8383
(format output-stream "(load #P\"sys:src;lisp;kernel;clasp-builder.lisp\")
84-
(setq core::*number-of-jobs* ~a)
84+
(setq core::*number-of-jobs*
85+
(if (ext:getenv \"CLASP_BUILD_JOBS\")
86+
(parse-integer (ext:getenv \"CLASP_BUILD_JOBS\"))
87+
~a))
8588
(defvar *system* (core:load-clasp :reproducible ~s
8689
:name (elt core:*command-line-arguments* 0)
8790
:position (parse-integer (elt core:*command-line-arguments* 1))
@@ -92,7 +95,10 @@
9295

9396
(defmethod print-prologue (configuration (name (eql :snapshot-clasp)) output-stream)
9497
(format output-stream "(load #P\"sys:src;lisp;kernel;clasp-builder.lisp\")
95-
(setq core::*number-of-jobs* ~a)
98+
(setq core::*number-of-jobs*
99+
(if (ext:getenv \"CLASP_BUILD_JOBS\")
100+
(parse-integer (ext:getenv \"CLASP_BUILD_JOBS\"))
101+
~a))
96102
(defvar *system* (core:load-clasp :reproducible ~s
97103
:name (elt core:*command-line-arguments* 1)
98104
:position (parse-integer (elt core:*command-line-arguments* 2))
@@ -103,7 +109,10 @@
103109
(defmethod print-prologue (configuration (name (eql :compile-clasp)) output-stream)
104110
(format output-stream "(setq cmp:*default-output-type* ~s)
105111
(load #P\"sys:src;lisp;kernel;clasp-builder.lisp\")
106-
(setq core::*number-of-jobs* ~a)
112+
(setq core::*number-of-jobs*
113+
(if (ext:getenv \"CLASP_BUILD_JOBS\")
114+
(parse-integer (ext:getenv \"CLASP_BUILD_JOBS\"))
115+
~a))
107116
(core:load-and-compile-clasp :reproducible ~s :system-sort ~s
108117
:name (elt core:*command-line-arguments* 0)
109118
:position (parse-integer (elt core:*command-line-arguments* 1))

src/koga/units.lisp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@
8080
:required t))))
8181

8282
(defmethod configure-unit (configuration (unit (eql :dis)))
83-
"Find the llvm0dis binary."
83+
"Find the llvm-dis binary."
8484
(with-accessors ((dis dis)
8585
(llvm-bindir llvm-bindir))
8686
configuration
87-
(message :emph "Configuring ar")
87+
(message :emph "Configuring llvm-dis")
8888
(setf dis (configure-program "dis"
8989
(or dis (merge-pathnames #P"llvm-dis" llvm-bindir))
9090
:required t))))
@@ -303,7 +303,7 @@ has not been set."
303303
(defmethod configure-unit (configuration (unit (eql :reproducible)))
304304
"Configure for a reproducible build."
305305
(when (reproducible-build configuration)
306-
(message :emph "Configuring reducible build")
306+
(message :emph "Configuring reproducible build")
307307
(append-cflags configuration
308308
(format nil "-ffile-prefix-map=..=~a"
309309
(normalize-directory (root :install-share))))

src/lisp/regression-tests/extensions.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
(test-true
3131
run-program-hello-world
32-
(let* ((stream (ext:run-program "/bin/bash" (list "-c" "echo hello world")))
32+
(let* ((stream (ext:run-program "/bin/sh" (list "-c" "echo hello world")))
3333
(output (read-line stream)))
3434
(close stream)
3535
(string= output "hello world")))

src/llvmo/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/mpip/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/scraper/code-generator.lisp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,10 +1449,11 @@ static void* OBJ_DEALLOCATOR_table[] = {~%")
14491449
(let ((sorted-header-list (sort header-list #'string<)))
14501450
(with-output-to-string (sout)
14511451
(loop for header in sorted-header-list
1452-
do (format sout "#include \"~a\"~%"
1453-
(if (uiop:absolute-pathname-p header)
1454-
(merge-pathnames (enough-namestring header *clasp-sys*) *clasp-code*)
1455-
header))))))))
1452+
do (format sout "#include <~a>~%"
1453+
(uiop:enough-pathname (truename (if (uiop:absolute-pathname-p header)
1454+
(merge-pathnames (enough-namestring header *clasp-sys*) *clasp-code*)
1455+
header))
1456+
(truename #P"../include/")))))))))
14561457

14571458
(defun generate-code
14581459
(packages-to-create normal-functions setf-functions symbols classes gc-managed-types enums

src/serveEvent/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/sockets/include

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)