Commit 8606f385aef9ff32a4eac366acec7c7494a2d60f

Thomas de Grivel 2022-12-14T00:20:43

repo-local-file

diff --git a/repo.lisp b/repo.lisp
index cb73199..65a6cda 100644
--- a/repo.lisp
+++ b/repo.lisp
@@ -265,6 +265,7 @@
 (defgeneric repo-dir/name (repo))
 (defgeneric repo-head (repo))
 (defgeneric repo-head-default (repo))
+(defgeneric repo-local-file (repo &rest parts))
 (defgeneric repo-package-p (x repo))
 
 (defmethod print-object ((obj repo) stream)
@@ -283,6 +284,12 @@
     (when found
       (namestring found))))
 
+(defun repo-by-url (url)
+  (find url *repos* :key #'repo-url :test #'string=))
+
+(defun repo-by-uri (uri)
+  (find uri *repos* :key #'repo-uri :test #'string=))
+
 (defmethod repo-dir/name ((repo repo))
   (str (repo-dir repo) "/" (repo-name repo)))
 
@@ -291,15 +298,12 @@
       (slot-value repo 'head)
       (repo-head-default repo)))
 
+(defmethod repo-local-file ((repo repo) &rest parts)
+  (str (repo-local-dir repo) "/" parts))
+
 (defmethod repo-package-p (x repo)
   (find x (repo-packages repo) :test #'string-equal))
 
-(defun repo-by-url (url)
-  (find url *repos* :key #'repo-url :test #'string=))
-
-(defun repo-by-uri (uri)
-  (find uri *repos* :key #'repo-uri :test #'string=))
-
 ;; git
 
 (defvar *git*