Skip to content

Commit

Permalink
Merge pull request #1587 from clasp-developers/tarball
Browse files Browse the repository at this point in the history
Add archive function for koga
  • Loading branch information
yitzchak authored May 20, 2024
2 parents 95198e5 + c81dac1 commit 4b14861
Show file tree
Hide file tree
Showing 17 changed files with 80 additions and 31 deletions.
1 change: 0 additions & 1 deletion include/clasp/mps

This file was deleted.

6 changes: 5 additions & 1 deletion koga
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,8 @@
(:tree ,(uiop:getcwd))
:inherit-configuration))
(asdf:load-system :koga)
(apply #'uiop:symbol-call "KOGA" (if help "HELP" "SETUP") initargs))
(apply #'uiop:symbol-call "KOGA"
(cond (help "HELP")
((getf initargs :archive) "ARCHIVE")
(t "SETUP"))
initargs))
1 change: 0 additions & 1 deletion src/asttooling/include

This file was deleted.

1 change: 0 additions & 1 deletion src/clbind/include

This file was deleted.

1 change: 0 additions & 1 deletion src/core/include

This file was deleted.

1 change: 0 additions & 1 deletion src/gctools/include

This file was deleted.

41 changes: 41 additions & 0 deletions src/koga/archive.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
(in-package #:koga)

(defun read-file-form (path &optional tag)
(if tag
(read-from-string (run-program-capture (format nil "git show ~a:~a" tag path)))
(uiop:read-file-form path)))

(defun archive (&rest initargs
&key archive extensions tag
&allow-other-keys)
(declare (ignore initargs))
(let* ((prefix (format nil "clasp-~a/"
(getf (read-file-form #P"version.sexp" tag) :version)))
(tar-name (concatenate 'string (if (stringp archive) archive "archive") ".tar"))
(gz-name (concatenate 'string tar-name ".gz")))
(uiop:delete-file-if-exists tar-name)
(uiop:delete-file-if-exists gz-name)
(message nil "Creating main archive...")
(run-program (format nil "git archive --output=~a --prefix=~a --format=tar ~a"
tar-name prefix (or tag "HEAD")))
(uiop:call-with-temporary-file
(lambda (temp-path)
(loop for source in (read-file-form #P"repos.sexp" tag)
for name = (getf source :name)
for directory = (getf source :directory)
for extension = (getf source :extension)
when (or (not extension)
(member extension extensions))
do (message nil "Creating ~(~a~) archive..." name)
(run-program (format nil "git archive --output=~a --format=tar --prefix=~a~a ~a"
temp-path prefix directory
(if tag
(or (getf source :branch)
(getf source :commit))
"HEAD"))
:directory directory)
(run-program (format nil "tar --concatenate --file ~a ~a"
tar-name temp-path))))
:want-stream-p nil)
(message nil "Compressing archive...")
(run-program (format nil "gzip ~a" tar-name))))
20 changes: 11 additions & 9 deletions src/koga/koga.asd
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
(asdf:defsystem #:koga
(asdf:defsystem "koga"
:description "A lisp based metabuilder for Clasp."
:depends-on (#:alexandria
#:asdf-groveler
#:clasp-scraper
#:closer-mop
#:ninja
#:shasht
#:trivial-features)
:depends-on ("alexandria"
"asdf-groveler"
"clasp-scraper"
"closer-mop"
"ninja"
"shasht"
"trivial-features")
:serial t
:components ((:file "packages")
(:file "utilities")
(:file "header")
Expand All @@ -19,4 +20,5 @@
(:file "scripts")
(:file "config-header")
(:file "ninja")
(:file "compile-commands")))
(:file "compile-commands")
(:file "archive")))
3 changes: 2 additions & 1 deletion src/koga/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
(:use #:common-lisp)
(:nicknames #:k)
(:documentation "A lisp based metabuilder for Clasp.")
(:export #:configure
(:export #:archive
#:configure
#:*extensions*
#:framework
#:help
Expand Down
15 changes: 12 additions & 3 deletions src/koga/scripts.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@

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

(defmethod print-prologue (configuration (name (eql :snapshot-clasp)) output-stream)
(format output-stream "(load #P\"sys:src;lisp;kernel;clasp-builder.lisp\")
(setq core::*number-of-jobs* ~a)
(setq core::*number-of-jobs*
(if (ext:getenv \"CLASP_BUILD_JOBS\")
(parse-integer (ext:getenv \"CLASP_BUILD_JOBS\"))
~a))
(defvar *system* (core:load-clasp :reproducible ~s
:name (elt core:*command-line-arguments* 1)
:position (parse-integer (elt core:*command-line-arguments* 2))
Expand All @@ -103,7 +109,10 @@
(defmethod print-prologue (configuration (name (eql :compile-clasp)) output-stream)
(format output-stream "(setq cmp:*default-output-type* ~s)
(load #P\"sys:src;lisp;kernel;clasp-builder.lisp\")
(setq core::*number-of-jobs* ~a)
(setq core::*number-of-jobs*
(if (ext:getenv \"CLASP_BUILD_JOBS\")
(parse-integer (ext:getenv \"CLASP_BUILD_JOBS\"))
~a))
(core:load-and-compile-clasp :reproducible ~s :system-sort ~s
:name (elt core:*command-line-arguments* 0)
:position (parse-integer (elt core:*command-line-arguments* 1))
Expand Down
6 changes: 3 additions & 3 deletions src/koga/units.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
:required t))))

(defmethod configure-unit (configuration (unit (eql :dis)))
"Find the llvm0dis binary."
"Find the llvm-dis binary."
(with-accessors ((dis dis)
(llvm-bindir llvm-bindir))
configuration
(message :emph "Configuring ar")
(message :emph "Configuring llvm-dis")
(setf dis (configure-program "dis"
(or dis (merge-pathnames #P"llvm-dis" llvm-bindir))
:required t))))
Expand Down Expand Up @@ -303,7 +303,7 @@ has not been set."
(defmethod configure-unit (configuration (unit (eql :reproducible)))
"Configure for a reproducible build."
(when (reproducible-build configuration)
(message :emph "Configuring reducible build")
(message :emph "Configuring reproducible build")
(append-cflags configuration
(format nil "-ffile-prefix-map=..=~a"
(normalize-directory (root :install-share))))
Expand Down
2 changes: 1 addition & 1 deletion src/lisp/regression-tests/extensions.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

(test-true
run-program-hello-world
(let* ((stream (ext:run-program "/bin/bash" (list "-c" "echo hello world")))
(let* ((stream (ext:run-program "/bin/sh" (list "-c" "echo hello world")))
(output (read-line stream)))
(close stream)
(string= output "hello world")))
1 change: 0 additions & 1 deletion src/llvmo/include

This file was deleted.

1 change: 0 additions & 1 deletion src/mpip/include

This file was deleted.

9 changes: 5 additions & 4 deletions src/scraper/code-generator.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,10 +1449,11 @@ static void* OBJ_DEALLOCATOR_table[] = {~%")
(let ((sorted-header-list (sort header-list #'string<)))
(with-output-to-string (sout)
(loop for header in sorted-header-list
do (format sout "#include \"~a\"~%"
(if (uiop:absolute-pathname-p header)
(merge-pathnames (enough-namestring header *clasp-sys*) *clasp-code*)
header))))))))
do (format sout "#include <~a>~%"
(uiop:enough-pathname (truename (if (uiop:absolute-pathname-p header)
(merge-pathnames (enough-namestring header *clasp-sys*) *clasp-code*)
header))
(truename #P"../include/")))))))))

(defun generate-code
(packages-to-create normal-functions setf-functions symbols classes gc-managed-types enums
Expand Down
1 change: 0 additions & 1 deletion src/serveEvent/include

This file was deleted.

1 change: 0 additions & 1 deletion src/sockets/include

This file was deleted.

0 comments on commit 4b14861

Please sign in to comment.