Commit 6bda1529 authored by Eric Timmons's avatar Eric Timmons
Browse files

Merge branch '44-fix-global-install' into 'main'

Resolve "Condition CLPM/SOURCES/DEFS:SOURCE-MISSING-PROJECT was signalled"

Closes #44

See merge request !14
parents ebf21276 9629d363
Pipeline #5125 passed with stages
in 29 minutes and 5 seconds
......@@ -86,6 +86,7 @@
......@@ -112,6 +113,7 @@
......@@ -289,3 +289,9 @@
[submodule "ext/trivial-macroexpand-all"]
path = ext/trivial-macroexpand-all
url =
[submodule "ext/parachute"]
path = ext/parachute
url =
[submodule "ext/form-fiddle"]
path = ext/form-fiddle
url =
......@@ -123,7 +123,7 @@ with version constraint).
(ref (gethash :install-ref options)))
(clpm:install :projects project-specifiers
:systems system-specifiers
:asds (mapcar #'merge-pathnames asd-files)
:asds (mapcar #'namestring (mapcar #'merge-pathnames asd-files))
:version version-string
:source source-name
:no-deps-p no-deps-p
......@@ -42,7 +42,7 @@ source registry is updated with the results."
:no-resolve ,no-resolve)
`(install :projects ',(ensure-list projects)
:systems ',(ensure-list systems)
:asds ',(mapcar #'merge-pathnames (ensure-list asds))
:asds ',(mapcar #'namestring (mapcar #'merge-pathnames (ensure-list asds)))
:no-deps-p ,no-deps
:context ,context
:save-context-p t
......@@ -6,7 +6,7 @@
(in-package #:clpm-client)
;; If the location of this changes, the asd file must be updated!
(defvar *version* "0.4.1"
(defvar *version* "0.4.2"
"The client's version.")
(defun clpm-client-version ()
......@@ -11,10 +11,12 @@
:description "Tests for CLPM"
:license "BSD-2-Clause"
:pathname "test/"
:depends-on (#:fiveam #:hunchentoot)
:depends-on (#:parachute #:hunchentoot #:alexandria #:clpm-client)
:serial t
((:file "package")
(:file "utils")
(:file "suite")
(:file "quicklisp-bundle")
(:file "global-context")
(:file "tests")))
Subproject commit e0c23599dbb8cff3e83e012f3d86d0764188ad18
Subproject commit 86563473dc23fb1277d35a3ad2c911a6c8e5b0da
;;; -*- mode: common-lisp; -*-
:type :quicklisp
:url "http://localhost:8091/dist/quicklisp-test.txt")
(in-package #:clpm-test)
(para:define-test global-context-editable-install
(uiop:with-current-directory ((asdf:system-relative-pathname :clpm "test/global-context/editable-install/"))
(with-clpm-env (:config-dir :global :data-dir data-dir)
(clpm '("sync" "-VV")
:output :interactive
:error-output :interactive)
(clpm '("install" "-y" "--asd" "test.asd")
:output :interactive
:error-output :interactive)
(clpm '("exec"
"sbcl" "--non-interactive" "--no-userinit" "--no-sysinit"
"--eval" "(require :asdf)"
"--eval" "(asdf:load-system :test)"
:output :interactive
:error-output :interactive))))
(para:define-test global-context-editable-install-with-client
(uiop:with-current-directory ((asdf:system-relative-pathname :clpm "test/global-context/editable-install/"))
(let ((*default-pathname-defaults* (uiop:getcwd)))
(with-clpm-env (:config-dir :global :data-dir data-dir)
;; Ensure alexandria is installed as well.
(flet ((validate (diff)
(para:true (member "alexandria" (clpm-client:context-diff-release-diffs diff)
:test #'equal
:key 'clpm-client:release-diff-project-name))
(clpm-client:install :asds '("test.asd") :validate #'validate))))))
(defpackage test
(:use :common-lisp))
(defsystem "test"
:description "test system"
:depends-on ("alexandria")
:components ((:file "package")
(:file "test")))
(in-package :test)
(defun hello-world ()
(print "Hello World"))
(uiop:define-package #:clpm-test
(:use #:cl
(in-package #:clpm-test)
(cl:defpackage #:clpm-test
(:use #:cl)
(:local-nicknames (#:para #:parachute)
(#:alex #:alexandria)))
(in-package #:clpm-test)
(test (quicklisp-bundle :suite :clpm)
(para:define-test quicklisp-bundle
(uiop:with-current-directory ((asdf:system-relative-pathname :clpm "test/quicklisp-bundle/"))
(uiop:run-program `(,*clpm* "bundle" "install" "-y" "--no-resolve")
:output :interactive
:error-output :interactive)
(uiop:run-program `(,*clpm* "bundle" "exec" "--" "sbcl" "--non-interactive" "--no-userinit" "--no-sysinit" "--eval" "(require :asdf)" "--eval" "(asdf:load-system :quicklisp-bundle)" "--quit")
:output :interactive
:error-output :interactive))))
(with-clpm-env ()
(clpm '("bundle" "install" "-y" "--no-resolve")
:output :interactive
:error-output :interactive)
(clpm '("bundle" "exec"
"sbcl" "--non-interactive" "--no-userinit" "--no-sysinit"
"--eval" "(require :asdf)"
"--eval" "(asdf:load-system :quicklisp-bundle)"
:output :interactive
:error-output :interactive))))
(in-package #:clpm-test)
(def-suite :clpm)
(defvar *clpm* "clpm"
"How to run clpm")
(defvar *clpm-env* nil)
(defun clpm (command &key output error-output)
(apply 'uiop:run-program
(list* *clpm* command)
:output output :error-output error-output
(run-program-augment-env-args *clpm-env*)))
(defun call-with-clpm-env (thunk &key config-dir)
(with-temporary-directory (cache-dir :prefix "clpm-test-cache")
(with-temporary-directory (data-dir :prefix "clpm-test-data")
(let ((*clpm-env* (list (cons "CLPM_DATA_DIR" (uiop:native-namestring data-dir))
(cons "CLPM_CACHE_DIR" (uiop:native-namestring cache-dir))
(cons "CLPM_GROVEL_SANDBOX_TYPE" "nil"))))
(when (keywordp config-dir)
(push (cons "CLPM_CONFIG_DIRS" (uiop:native-namestring
(concatenate 'string "test/configs/"
(string-downcase config-dir)
;; TODO: remove this. Instead of modifying the environment of this
;; process, we should add a set of arguments that let us set any config
;; option via the CLI and teach clpm-client how to use that.
(let ((orig-data-dir (or (uiop:getenvp "CLPM_DATA_DIR") ""))
(orig-cache-dir (or (uiop:getenvp "CLPM_CACHE_DIR") ""))
(orig-config-dirs (or (uiop:getenvp "CLPM_CONFIG_DIRS") ""))
(orig-grovel-sandbox-type (or (uiop:getenvp "CLPM_GROVEL_SANDBOX_TYPE") "")))
(setf (uiop:getenv "CLPM_DATA_DIR") (uiop:native-namestring data-dir)
(uiop:getenv "CLPM_CACHE_DIR") (uiop:native-namestring cache-dir)
(uiop:getenv "CLPM_GROVEL_SANDBOX_TYPE") "nil")
(when (keywordp config-dir)
(setf (uiop:getenv "CLPM_CONFIG_DIRS")
(concatenate 'string "test/configs/"
(string-downcase config-dir)
(funcall thunk :cache-dir cache-dir :data-dir data-dir))
(setf (uiop:getenv "CLPM_DATA_DIR") orig-data-dir
(uiop:getenv "CLPM_CACHE_DIR") orig-cache-dir
(uiop:getenv "CLPM_CONFIG_DIRS") orig-config-dirs
(uiop:getenv "CLPM_GROVEL_SANDBOX_TYPE") orig-grovel-sandbox-type)))))))
(defmacro with-clpm-env ((&key (cache-dir (gensym)) (data-dir (gensym)) config-dir)
&body body)
`(call-with-clpm-env (lambda (&key ((:cache-dir ,cache-dir)) ((:data-dir ,data-dir)))
(declare (ignorable ,cache-dir ,data-dir))
:config-dir ,config-dir))
......@@ -20,4 +20,4 @@
(defun run-tests-with-server (&key (clpm "clpm"))
(let ((*clpm* (namestring clpm)))
(with-server ()
(fiveam:run! :clpm))))
(para:test :clpm-test))))
(in-package #:clpm-test)
(defparameter *mkdtemp-random-bits* (* 8 4))
(defun mkdtemp (prefix &key (directory (uiop:temporary-directory)))
"Make a temporary directory and return its pathname. This is not a secure
implementation, but it is portable."
:for suffix := (random (ash 1 *mkdtemp-random-bits*))
:for name := (format nil "~A~X" prefix suffix)
:for pn := (uiop:ensure-directory-pathname (merge-pathnames name directory))
(multiple-value-bind (pathspec createdp)
(ensure-directories-exist pn :mode #o700 :allow-other-keys t)
(declare (ignore pathspec))
(when createdp
(return pn)))))
(defun call-with-temporary-directory (thunk &key (prefix "clpm-test-")
(directory (uiop:temporary-directory)))
(let ((dir (mkdtemp prefix :directory directory)))
(funcall thunk dir)
(uiop:delete-directory-tree dir :validate t))))
(defmacro with-temporary-directory ((var &rest args
&key prefix
&body body)
(declare (ignore prefix directory))
(lambda (,var)
(defun posix-environment-alist ()
"Returns an alist representing the environment variables."
(let ((out nil))
(dolist (pair-string (sb-ext:posix-environ))
(let* ((pos-of-= (position #\= pair-string))
(name (subseq pair-string 0 pos-of-=))
(value (subseq pair-string (1+ pos-of-=))))
(push (cons name value) out)))
(nreverse out)))
(defun posix-environment-alist ()
"Returns an alist representing the environemnt variables."
(error "Not implemented"))
(defun run-program-augment-env-args (new-env-alist)
"Given an alist of environment variables, return a list of arguments suitable
for ~uiop:{launch/run}-program~ to set the augmented environment for the child
(let ((env (posix-environment-alist)))
(dolist (pair new-env-alist)
(destructuring-bind (name . value) pair
(setf (alex:assoc-value env name :test #'equal) value)))
(list :environment
(mapcar (lambda (c)
(concatenate 'string (car c) "=" (cdr c)))
(defun run-program-augment-env-args (new-env-alist)
(list :env new-env-alist))
#-(or sbcl ccl)
(defun run-program-augment-env-args (new-env-alist)
(error "not implemented"))
......@@ -3,4 +3,4 @@
;;;; This file contains a single string naming the version that is being
;;;; currently worked on. It should be bumped immediately after releasing the
;;;; version. This should not contain any prerelease info.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment