changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: skel containerfile build

changeset 551: 83b71948b92c
parent 550: 4d34907c69eb
child 552: c2c481ebd7ea
author: Richard Westhaver <ellis@rwest.io>
date: Wed, 17 Jul 2024 21:31:38 -0400
files: lisp/lib/pod/client.lisp lisp/lib/skel/comp/container.lisp lisp/lib/skel/core/proto.lisp
description: skel containerfile build
     1.1--- a/lisp/lib/pod/client.lisp	Tue Jul 16 21:52:09 2024 -0400
     1.2+++ b/lisp/lib/pod/client.lisp	Wed Jul 17 21:31:38 2024 -0400
     1.3@@ -18,7 +18,7 @@
     1.4 (defclass libpod-client (client)
     1.5   ((socket :initarg :socket 
     1.6            :initform (make-instance 'local-socket :type :stream) 
     1.7-           :type socket
     1.8+           :type (or local-socket null)
     1.9            :accessor client-socket)
    1.10    (addr :initarg :addr
    1.11          :initform nil
    1.12@@ -27,6 +27,10 @@
    1.13          :initform *podman-local-user-socket*
    1.14          :accessor client-peer)))
    1.15 
    1.16+(defmethod make-load-form ((self libpod-client) &optional env)
    1.17+  (declare (ignore env))
    1.18+  `(make-instance 'libpod-client :socket nil :addr ,(client-addr self) :peer ,(client-peer self)))
    1.19+
    1.20 ;;; Net Client protocol
    1.21 
    1.22 ;;; Socket Protocol
     2.1--- a/lisp/lib/skel/comp/container.lisp	Tue Jul 16 21:52:09 2024 -0400
     2.2+++ b/lisp/lib/skel/comp/container.lisp	Wed Jul 17 21:31:38 2024 -0400
     2.3@@ -16,7 +16,7 @@
     2.4 
     2.5 (defmethod print-object ((object sk-containerfile) stream)
     2.6   (print-unreadable-object (object stream :type t)
     2.7-    (format stream "~A :ID ~A" (file-namestring (containerfile-path object)) (format-sxhash (id object)))))
     2.8+    (format stream "~A" (file-namestring (containerfile-path object)))))
     2.9 
    2.10 (defmethod sk-convert ((self containerfile))
    2.11   (let ((self (change-class self 'sk-containerfile)))
    2.12@@ -31,3 +31,25 @@
    2.13 
    2.14 (defmethod sk-write-file ((self sk-containerfile) &key path)
    2.15   (serde self (pathname (or path (containerfile-path self)))))
    2.16+
    2.17+(defmethod sk-read-file ((self sk-containerfile) path)
    2.18+  (sk-load-component :containerfile path))
    2.19+
    2.20+(defmethod sk-path ((self sk-containerfile))
    2.21+  (containerfile-path self))
    2.22+
    2.23+(defmethod sk-build ((self sk-containerfile) &key with-client no-cache tag)
    2.24+  (typecase with-client
    2.25+    (null (apply 'pod::run-podman (flatten (concatenate 'list
    2.26+                                                        `("build" "-f"
    2.27+                                                                  ,(sk-path self)
    2.28+                                                                  ,@(when no-cache (list "--no-cache")))
    2.29+                                                        (when tag (list "-t" tag ))))))
    2.30+    ;; iff == t
    2.31+    (boolean
    2.32+     (with-libpod-client (c)
    2.33+       (libpod-request-json c "containers/json")
    2.34+       (nyi! "need to implement containerfile libpod request method")))
    2.35+    ;; else
    2.36+    (t (with-libpod-client (c with-client)
    2.37+         (nyi! "todo")))))
     3.1--- a/lisp/lib/skel/core/proto.lisp	Tue Jul 16 21:52:09 2024 -0400
     3.2+++ b/lisp/lib/skel/core/proto.lisp	Wed Jul 17 21:31:38 2024 -0400
     3.3@@ -2,49 +2,52 @@
     3.4 (in-package :skel/core/proto)
     3.5 
     3.6 (defgeneric sk-run (self)
     3.7-  (:documentation "run the object SELF."))
     3.8+  (:documentation "Run the object SELF."))
     3.9 (defgeneric sk-new (self &rest args &key &allow-other-keys)
    3.10-  (:documentation "create a fresh instance of object SELF."))
    3.11+  (:documentation "Create a fresh instance of object SELF."))
    3.12 (defgeneric sk-save (self)
    3.13-  (:documentation "save object SELF."))
    3.14+  (:documentation "Save object SELF."))
    3.15 (defgeneric sk-tangle (self &rest params &key &allow-other-keys)
    3.16-  (:documentation "tangle object self with params"))
    3.17+  (:documentation "Tangle object self with params"))
    3.18 (defgeneric sk-weave (self)
    3.19-  (:documentation "weave object self with params"))
    3.20+  (:documentation "Weave object self with params"))
    3.21 (defgeneric sk-call (self arg)
    3.22-  (:documentation "call SELF with ARG."))
    3.23+  (:documentation "Call SELF with ARG."))
    3.24 (defgeneric sk-call* (self &rest args)
    3.25-  (:documentation "call SELF with ARGS."))
    3.26+  (:documentation "Call SELF with ARGS."))
    3.27 (defgeneric sk-print (self)
    3.28-  (:documentation "print object SELF."))
    3.29+  (:documentation "Print object SELF."))
    3.30 (defgeneric sk-load (self &key &allow-other-keys)
    3.31-  (:documentation "load or reload object SELF."))
    3.32+  (:documentation "Load or reload object SELF."))
    3.33 (defgeneric sk-load-component (kind form)
    3.34-  (:documentation "load a component of type KIND from provided FORM."))
    3.35+  (:documentation "Load a component of type KIND from provided FORM, producing an SK-COMPONENT
    3.36+type. Usually calls SK-TRANSFORM or SK-CONVERT internally."))
    3.37 (defgeneric sk-compile (self &key &allow-other-keys)
    3.38-  (:documentation "compile object SELF."))
    3.39+  (:documentation "Compile object SELF."))
    3.40+(defgeneric sk-build (self &key &allow-other-keys)
    3.41+  (:documentation "Build a skel-object."))
    3.42 (defgeneric sk-transform (self other &key &allow-other-keys)
    3.43-  (:documentation "transform SELF to object of type OTHER"))
    3.44+  (:documentation "Transform SELF to skel-object of type OTHER."))
    3.45 (defgeneric sk-convert (self)
    3.46-  (:documentation "convert the object SELF."))
    3.47+  (:documentation "Convert the object SELF."))
    3.48 (defgeneric sk-read (self stream)
    3.49-  (:documentation "read and fill SELF with an object from STREAM."))
    3.50+  (:documentation "Read and fill SELF with an object from STREAM."))
    3.51 (defgeneric sk-read-file (self path)
    3.52-  (:documentation "read a PATH from the filesystem with SELF."))
    3.53+  (:documentation "Read a PATH from the filesystem with SELF."))
    3.54 (defgeneric sk-write (self stream)
    3.55-  (:documentation "write object SELF to STREAM."))
    3.56+  (:documentation "Write object SELF to STREAM."))
    3.57 (defgeneric sk-writeln (self stream)
    3.58-  (:documentation "write a line from SELF to STREAM."))
    3.59+  (:documentation "Write a line from SELF to STREAM."))
    3.60 (defgeneric sk-write-string (self)
    3.61-  (:documentation "return a string from SELF."))
    3.62+  (:documentation "Return a string from SELF."))
    3.63 (defgeneric sk-write-file (self &key path &allow-other-keys)
    3.64-  (:documentation "write from SELF to file PATH."))
    3.65+  (:documentation "Write from SELF to file PATH."))
    3.66 (defgeneric sk-install-user-config (self cfg)
    3.67-  (:documentation "populate SELF with configuration object CFG."))
    3.68+  (:documentation "Populate SELF with configuration object CFG."))
    3.69 (defgeneric sk-vc-push (self &key remote &allow-other-keys)
    3.70-  (:documentation "push object SELF upstream using vc."))
    3.71+  (:documentation "Push object SELF upstream using vc."))
    3.72 (defgeneric sk-vc-pull (self &key remote &allow-other-keys)
    3.73-  (:documentation "pull object SELF from upstream using vc."))
    3.74+  (:documentation "Pull object SELF from upstream using vc."))
    3.75 (defgeneric sk-find-rule (name self)
    3.76   (:documentation "Find a rule with the given NAME in SELF."))
    3.77 (defgeneric sk-find-script (name self &key &allow-other-keys)