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 @@
"ext/file-attributes/file-attributes.asd"
"ext/fiveam/fiveam.asd"
"ext/flexi-streams/flexi-streams.asd"
"ext/form-fiddle/form-fiddle.asd"
"ext/global-vars/global-vars.asd"
"ext/hunchentoot/hunchentoot.asd"
"ext/ieee-floats/ieee-floats.asd"
......@@ -112,6 +113,7 @@
"ext/named-readtables/named-readtables.asd"
"ext/nibbles/nibbles.asd"
"ext/osicat/osicat.asd"
"ext/parachute/parachute.asd"
"ext/parse-declarations/parse-declarations-1.0.asd"
"ext/parse-float/parse-float.asd"
"ext/parse-number/parse-number.asd"
......
......@@ -289,3 +289,9 @@
[submodule "ext/trivial-macroexpand-all"]
path = ext/trivial-macroexpand-all
url = https://github.com/cbaggers/trivial-macroexpand-all.git
[submodule "ext/parachute"]
path = ext/parachute
url = https://github.com/Shinmera/parachute
[submodule "ext/form-fiddle"]
path = ext/form-fiddle
url = https://github.com/Shinmera/form-fiddle
......@@ -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
:components
((:file "package")
(:file "utils")
(:file "suite")
(:file "quicklisp-bundle")
(:file "global-context")
(:file "tests")))
Subproject commit e0c23599dbb8cff3e83e012f3d86d0764188ad18
Subproject commit 86563473dc23fb1277d35a3ad2c911a6c8e5b0da
;;; -*- mode: common-lisp; -*-
("quicklisp"
: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)"
"--quit")
: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)
(clpm-client:sync)
;; 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))
t))
(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
#:fiveam))
(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/"))
(finishes
(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)"
"--quit")
: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
(asdf:system-relative-pathname
:clpm
(concatenate 'string "test/configs/"
(string-downcase config-dir)
"/"))))
*clpm-env*))
;; 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") "")))
(unwind-protect
(progn
(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")
(uiop:native-namestring
(asdf:system-relative-pathname
:clpm
(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))
,@body)
: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."
(loop
: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))
:do
(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)))
(unwind-protect
(funcall thunk dir)
(uiop:delete-directory-tree dir :validate t))))
(defmacro with-temporary-directory ((var &rest args
&key prefix
directory)
&body body)
(declare (ignore prefix directory))
`(call-with-temporary-directory
(lambda (,var)
,@body)
,@args))
#+sbcl
(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)))
#-sbcl
(defun posix-environment-alist ()
"Returns an alist representing the environemnt variables."
(error "Not implemented"))
#+sbcl
(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
process."
(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)))
env))))
#+ccl
(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.
"0.4.1"
"0.4.2"
Markdown is supported
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