Commit 57a0d674012e56e37f3e4a86e66e6af5d90b09e2

Thomas de Grivel 2022-12-04T03:20:19

repo-index.lisp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
diff --git a/install-repo.sh b/install-repo.sh
index 6c4278b..7566fd6 100755
--- a/install-repo.sh
+++ b/install-repo.sh
@@ -2,14 +2,13 @@
 set -e
 
 REPO_DIR=$HOME/common-lisp
-REPO_DIR=/tmp/common-lisp
 
 GITHUB='https://github.com/'
 KMX='https://git.kmx.io/'
 
 # detect gnu make
 
-if which gmake; then
+if which gmake > /dev/null; then
     MAKE=gmake
 else
     MAKE=make
@@ -36,8 +35,8 @@ maybe_clone "${GITHUB}" 'fare' 'asdf'
 # Install Repo from Github
 
 maybe_clone "${KMX}" 'kmx.io' 'repo'
-if ! [ -f "${REPO_DIR}/repo.manifest" ]; then
-    ( cd "${REPO_DIR}" && ln -s kmx.io/repo/repo.manifest; )
+if ! [ -f "${REPO_DIR}/repo-index.lisp" ]; then
+    ( cd "${REPO_DIR}" && ln -s kmx.io/repo/repo-index.lisp; )
 fi
 
 # Configure SBCL
diff --git a/repo-index.lisp b/repo-index.lisp
new file mode 100644
index 0000000..1f39820
--- /dev/null
+++ b/repo-index.lisp
@@ -0,0 +1,197 @@
+;; repo - common interface for version control systems
+;; Copyright 2016-2022 kmx.io <contact@kmx.io>
+;;
+;; Permission is hereby granted to use this software granted
+;; the above copyright notice and this permission paragraph
+;; are included in all copies and substantial portions of this
+;; software.
+;;
+;; THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+;; PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+;; AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+;; THIS SOFTWARE.
+
+(in-package :repo-user)
+
+(git "http://git.kpe.io/cl-base64.git")
+(git "http://git.kpe.io/puri.git")
+(git "https://gitlab.common-lisp.net/alexandria/alexandria.git")
+(git "https://gitlab.common-lisp.net/cl-irregsexp/cl-irregsexp.git")
+(git "https://gitlab.common-lisp.net/cl-smtp/cl-smtp.git")
+(git "https://gitlab.common-lisp.net/cl-utilities/cl-utilities.git")
+(git "https://gitlab.common-lisp.net/metabang-bind/metabang-bind.git")
+(git "https://gitlab.common-lisp.net/rfc2388/rfc2388.git")
+
+(github "3b" "3bmd")
+(github "AccelerationNet" "cl-inflector")
+(github "BnMcGn" "html-entities")
+(github "KDr2" "cl-fastcgi")
+(github "KDr2" "sb-fastcgi")
+(github "adamczykm" "iterate")
+(github "ahefner" "shuffletron")
+(github "binghe" "portable-threads")
+(github "cffi" "cffi")
+(github "chaitanyagupta" "chronicity")
+(github "cl-babel" "babel")
+(github "cl-plus-ssl" "cl-plus-ssl" :packages '("cl+ssl"))
+(github "cosmos72" "stmx")
+(github "didierverna" "clon")
+(github "didierverna" "declt")
+(github "didierverna" "tfm")
+(github "diogoalexandrefranco" "cl-strings")
+(github "dlowe-net" "local-time")
+(github "drdo" "do-urlencode")
+(github "e-user" "cl-heredoc")
+(github "edicl" "chunga")
+(github "edicl" "cl-fad")
+(github "edicl" "cl-interpol")
+(github "edicl" "cl-ppcre")
+(github "edicl" "cl-unicode")
+(github "edicl" "drakma")
+(github "edicl" "flexi-streams")
+(github "edicl" "hunchentoot")
+(github "eugeneia" "cl-qprint")
+(github "fare" "asdf")
+(github "filonenko-mikhail" "cl-portaudio")
+(github "froydnj" "chipz")
+(github "fukamachi" "fast-http")
+(github "fukamachi" "proc-parse")
+(github "fukamachi" "quri")
+(github "fukamachi" "smart-buffer")
+(github "fukamachi" "trivial-utf-8")
+(github "fukamachi" "xsubseq")
+(github "gwkkwg" "trivial-backtrace")
+(github "hankhero" "cl-json")
+(github "jdz" "rfc2388")
+(github "jech" "cl-yacc")
+(github "keithj" "deoxybyte-unix")
+(github "lmj" "global-vars")
+(github "marijnh" "parse-js")
+(github "melisgl" "named-readtables")
+(github "mishoo" "cl-uglify-js")
+(github "nallen05" "rw-ut")
+(github "nallen05" "trivial-email-utf-8")
+(github "next-browser" "next")
+(github "nightfly19" "cl-arrows")
+(github "nikodemus" "esrap")
+(github "orthecreedence" "blackbird")
+(github "orthecreedence" "cl-async" :packages '("cl-async" "cl-async-repl" "cl-async-ssl"))
+(github "orthecreedence" "cl-libuv")
+(github "orthecreedence" "vom")
+(github "orthecreedence" "wookie")
+(github "pcostanza" "closer-mop")
+(github "phmarek" "yason")
+(github "phoe" "safe-read")
+(github "pmai" "md5")
+(github "robert-strandh" "Acclimation")
+(github "robert-strandh" "Awele")
+(github "robert-strandh" "CLIM-demo-adventure")
+(github "robert-strandh" "CLIMatis")
+(github "robert-strandh" "Claire")
+(github "robert-strandh" "Claret")
+(github "robert-strandh" "Classeur")
+(github "robert-strandh" "Climacs")
+(github "robert-strandh" "Climed")
+(github "robert-strandh" "Cloak")
+(github "robert-strandh" "Clobber")
+(github "robert-strandh" "Clordane")
+(github "robert-strandh" "Cluffer-Emacs-compatibility")
+(github "robert-strandh" "Clump")
+(github "robert-strandh" "Cluster")
+(github "robert-strandh" "Compta")
+(github "robert-strandh" "Concrete-Syntax-Tree")
+(github "robert-strandh" "Ducling")
+(github "robert-strandh" "Eclector")
+(github "robert-strandh" "Enamel")
+(github "robert-strandh" "First-Climacs")
+(github "robert-strandh" "Flexichain")
+(github "robert-strandh" "GF-font-viewer")
+(github "robert-strandh" "Gsharp")
+(github "robert-strandh" "Incremental-reader")
+(github "robert-strandh" "McCLIM")
+(github "robert-strandh" "Nomenclatura")
+(github "robert-strandh" "SICL")
+(github "robert-strandh" "Second-Climacs")
+(github "robert-strandh" "Spell")
+(github "robert-strandh" "Stealth-mixin")
+(github "robert-strandh" "Subsequence")
+(github "robert-strandh" "Sudoku")
+(github "robert-strandh" "Text-annotation")
+(github "robert-strandh" "Trans-Clime")
+(github "robert-strandh" "USE-finder")
+(github "robert-strandh" "dpANS-parser")
+(github "rpav" "c2ffi")
+(github "rpav" "cl-autowrap")
+(github "rpav" "fast-io")
+(github "sellout" "external-program")
+(github "sharplispers" "ironclad")
+(github "sharplispers" "nibbles")
+(github "sharplispers" "parse-number")
+(github "sharplispers" "split-sequence")
+(github "sionescu" "bordeaux-threads")
+(github "sionescu" "static-vectors")
+(github "slime" "slime")
+(github "thephoeron" "let-over-lambda")
+(github "tpapp" "ffa")
+(github "trivial-features" "trivial-features")
+(github "trivial-garbage" "trivial-garbage")
+(github "trivial-gray-streams" "trivial-gray-streams")
+(github "usocket" "usocket")
+(github "vii" "teepeedee2")
+(github "vseloved" "cl-redis")
+(github "vseloved" "rutils")
+(github "zkat" "chanl")
+
+(kmx "RailsOnLisp" "bootstrap")
+(kmx "RailsOnLisp" "bordeaux-queue")
+(kmx "RailsOnLisp" "bordeaux-set")
+(kmx "RailsOnLisp" "can")
+(kmx "RailsOnLisp" "font-awesome")
+(kmx "RailsOnLisp" "gravatar")
+(kmx "RailsOnLisp" "rol-assets")
+(kmx "RailsOnLisp" "rol-files")
+(kmx "RailsOnLisp" "rol-log")
+(kmx "RailsOnLisp" "rol-server")
+(kmx "RailsOnLisp" "rol-template")
+(kmx "RailsOnLisp" "rol-uri")
+(kmx "RailsOnLisp" "thot")
+(kmx "cffi-posix" "cffi-dirent")
+(kmx "cffi-posix" "cffi-epoll")
+(kmx "cffi-posix" "cffi-errno")
+(kmx "cffi-posix" "cffi-fcntl")
+(kmx "cffi-posix" "cffi-socket")
+(kmx "cffi-posix" "cffi-stat")
+(kmx "cffi-posix" "cffi-unistd")
+(kmx "cl-remap" "remap")
+(kmx "cl-remap" "uiop-remap")
+(kmx "cl-remap" "unistd-remap")
+(kmx "cl-stream" "babel-stream")
+(kmx "cl-stream" "cl-stream")
+(kmx "cl-stream" "matcher-stream")
+(kmx "cl-stream" "parser-stream")
+(kmx "cl-stream" "token-stream")
+(kmx "cl-stream" "unistd-stdio")
+(kmx "cl-stream" "unistd-stream")
+(kmx "facts-db" "cl-facts")
+(kmx "facts-db" "cl-lessp")
+(kmx "facts-db" "cl-rollback")
+(kmx "idl" "excel-fun.git")
+(kmx "idl" "idl-calc.git")
+(kmx "kmx.io" "cl-debug")
+(kmx "kmx.io" "repo")
+(kmx "lowh" "exec-js")
+(kmx "thodg" "cffi-portaudio")
+(kmx "thodg" "cfg")
+(kmx "thodg" "cl-github-v3")
+(kmx "thodg" "cl-github-v3")
+(kmx "thodg" "cl-unix-cybernetics")
+(kmx "thodg" "css-lexer")
+(kmx "thodg" "css-parser")
+(kmx "thodg" "fb")
+(kmx "thodg" "less-lexer")
+(kmx "thodg" "less-parser")
+(kmx "thodg" "positional")
+(kmx "thodg" "random-sequence")
+(kmx "thodg" "re.git")
+(kmx "thodg" "str")
+(kmx "thodg" "str.git")
diff --git a/repo.lisp b/repo.lisp
index 91f42ea..f11f3b6 100644
--- a/repo.lisp
+++ b/repo.lisp
@@ -23,12 +23,11 @@
            #:github
            #:install
            #:kmx
-           #:manifest
-           #:*manifest*
+           #:index
+           #:*index*
            #:repo
            #:*repo-dir*
            #:*repos*
-           #:svn
            #:update))
 
 (defpackage :repo-user
@@ -423,60 +422,6 @@
           (push repo *repos*)
           repo))))
 
-
-;; subversion command
-
-(defvar *svn*
-  #+unix (or (probe-file "/usr/bin/svn")
-             (probe-file "/usr/local/bin/svn")
-             (first-line (ignore-errors (sh "which svn")))))
-
-(defun $svn (&rest args)
-  (apply 'run-program *svn* args))
-
-;;  subversion repository class
-
-(defclass svn-repo (repo) ())
-
-(defgeneric $svn-checkout (repo))
-(defgeneric $svn-update (repo))
-
-(defmethod $svn-checkout ((repo svn-repo))
-  (let ((local (repo-local-dir repo))
-        (url (repo-url repo)))
-    (when (probe-dir local)
-      (error "svn checkout: not overwriting existing local directory~&~S" local))
-    (let ((parent (dirname local)))
-      (ensure-directories-exist (str parent "/") :verbose t)
-      ($svn "co" url (translate-home local))
-      nil)))
-
-(defmethod $svn-update ((repo svn-repo))
-  (let ((local (repo-local-dir repo)))
-    ($svn "up" (translate-home local))
-    nil))
-
-(defmethod install ((repo svn-repo))
-  (let ((local (repo-local-dir repo)))
-    (unless (probe-dir local)
-      ($svn-checkout repo))
-    (asdf::load-asd (repo-asd repo))))
-
-(defmethod update ((repo svn-repo))
-  (when (probe-dir (repo-local-dir repo))
-    ($svn-update repo)))
-
-(defun svn (url dir/name &rest initargs)
-  (or (repo-by-url url)
-      (let ((repo (apply #'make-instance 'svn-repo
-                         :dir (dirname dir/name)
-                         :name (basename dir/name)
-                         :url url :uri url
-                         :head (basename url)
-                         initargs)))
-        (push repo *repos*)
-        repo)))
-
 ;;  repo uri handler
 
 (defparameter *repo-uri-handlers*
@@ -542,140 +487,140 @@
 (defmethod update ((repos cons))
   (map nil 'update repos))
 
-;;  manifest
+;;  index
 
-(defvar *manifest*)
+(defvar *index*)
 
-(defclass manifest ()
+(defclass index ()
   ((write-date :initarg :write-date
-               :accessor manifest-write-date
+               :accessor index-write-date
                :type rational)
    (dir :initarg :dir
-        :reader manifest-dir
+        :reader index-dir
         :type string)
    (repos :initarg :repos
-          :accessor manifest-repos
+          :accessor index-repos
           :type list)))
 
-(defgeneric manifest-file (manifest))
-(defgeneric reload-manifest (manifest))
-(defgeneric maybe-reload-manifest (manifest))
+(defgeneric index-file (index))
+(defgeneric reload-index (index))
+(defgeneric maybe-reload-index (index))
 
-(defmethod print-object ((obj manifest) stream)
+(defmethod print-object ((obj index) stream)
   (print-unreadable-object (obj stream :type t :identity t)
     (format stream "~S ~A repos"
-            (manifest-file obj)
-            (length (manifest-repos obj)))))
+            (index-file obj)
+            (length (index-repos obj)))))
 
-(defmethod manifest-file ((manifest manifest))
-  (str (manifest-dir manifest) "/repo.manifest"))
+(defmethod index-file ((index index))
+  (str (index-dir index) "/repo-index.lisp"))
 
-(defun manifest-from-file (pathname)
+(defun index-from-file (pathname)
   (let ((*repos* nil)
         (write-date (file-write-date pathname)))
     (load pathname)
-    (make-instance 'manifest
+    (make-instance 'index
                    :write-date write-date
                    :dir (dirname pathname)
                    :repos *repos*)))
 
-(defmethod reload-manifest ((manifest manifest))
-  (let* ((pathname (manifest-file manifest))
+(defmethod reload-index ((index index))
+  (let* ((pathname (index-file index))
          (*repos* nil)
          (write-date (file-write-date pathname)))
     (load pathname)
-    (setf (manifest-write-date manifest) write-date
-          (manifest-repos manifest) *repos*))
-  manifest)
-
-(defmethod maybe-reload-manifest ((manifest manifest))
-  (if (< (manifest-write-date manifest)
-         (file-write-date (manifest-file manifest)))
-      (reload-manifest manifest)
-      manifest))
-
-(defmethod install ((manifest manifest))
-  (let ((manifest (maybe-reload-manifest manifest)))
-    (let ((*repo-dir* (manifest-dir manifest))
-          (*repos* (manifest-repos manifest)))
+    (setf (index-write-date index) write-date
+          (index-repos index) *repos*))
+  index)
+
+(defmethod maybe-reload-index ((index index))
+  (if (< (index-write-date index)
+         (file-write-date (index-file index)))
+      (reload-index index)
+      index))
+
+(defmethod install ((index index))
+  (let ((index (maybe-reload-index index)))
+    (let ((*repo-dir* (index-dir index))
+          (*repos* (index-repos index)))
       (install *repos*))))
 
-(defmethod update ((manifest manifest))
-  (let ((manifest (maybe-reload-manifest manifest)))
-    (let ((*repo-dir* (manifest-dir manifest))
-          (*repos* (manifest-repos manifest)))
+(defmethod update ((index index))
+  (let ((index (maybe-reload-index index)))
+    (let ((*repo-dir* (index-dir index))
+          (*repos* (index-repos index)))
       (update *repos*))))
 
-;;  manifest uri handlers
+;;  index uri handlers
 
-(defun manifest-file-p (x)
-  (or (string= "repo.manifest" x)
-      (string-ends-with "/repo.manifest" x)))
+(defun index-file-p (x)
+  (or (string= "repo-index.lisp" x)
+      (string-ends-with "/repo-index.lisp" x)))
 
-(defun local-manifest-uri-handler (x)
-  (let ((end (string-ends-with "/repo.manifest" x)))
+(defun local-index-uri-handler (x)
+  (let ((end (string-ends-with "/repo-index.lisp" x)))
     (when end
       (let* ((*repo-dir* (subseq x 0 end))
-             (manifest (str *repo-dir* "/repo.manifest")))
-        (when (probe-file manifest)
-          (manifest-from-file manifest))))))
+             (index (str *repo-dir* "/repo-index.lisp")))
+        (when (probe-file index)
+          (index-from-file index))))))
 
-(defvar *manifest-uri-handlers*
-  '(local-manifest-uri-handler))
+(defvar *index-uri-handlers*
+  '(local-index-uri-handler))
 
-(defun manifest (uri)
-  "Load manifest from uri"
+(defun index (uri)
+  "Load index from uri"
   (labels ((do-handlers (handlers)
              (unless (endp handlers)
                (or (funcall (first handlers) uri)
                    (do-handlers (rest handlers))))))
-    (do-handlers *manifest-uri-handlers*)))
+    (do-handlers *index-uri-handlers*)))
 
-(defun manifest-or-die (uri)
-  (or (manifest uri) (error "failed to load manifest ~S" uri)))
+(defun index-or-die (uri)
+  (or (index uri) (error "failed to load index ~S" uri)))
 
 ;;  install and update commands
 
 (defmethod install ((x string))
-  (when *manifest*
-    (maybe-reload-manifest *manifest*))
-  (setq *repos* (manifest-repos *manifest*))
-  (if (manifest-file-p x)
-      (install (manifest-or-die x))
+  (when *index*
+    (maybe-reload-index *index*))
+  (setq *repos* (index-repos *index*))
+  (if (index-file-p x)
+      (install (index-or-die x))
       (install (repo-or-die x))))
 
 (defmethod install ((x null))
   nil)
 
 (defmethod install ((x symbol))
-  (when *manifest*
-    (maybe-reload-manifest *manifest*))
-  (setq *repos* (manifest-repos *manifest*))
+  (when *index*
+    (maybe-reload-index *index*))
+  (setq *repos* (index-repos *index*))
   (install (repo-or-die x)))
 
 (defmethod update ((x string))
-  (when *manifest*
-    (maybe-reload-manifest *manifest*))
-  (setq *repos* (manifest-repos *manifest*))
-  (if (manifest-file-p x)
-      (update (manifest-or-die x))
+  (when *index*
+    (maybe-reload-index *index*))
+  (setq *repos* (index-repos *index*))
+  (if (index-file-p x)
+      (update (index-or-die x))
       (update (repo-or-die x))))
 
 (defmethod update ((x null))
   nil)
 
 (defmethod update ((x symbol))
-  (when *manifest*
-    (maybe-reload-manifest *manifest*))
-  (setq *repos* (manifest-repos *manifest*))
+  (when *index*
+    (maybe-reload-index *index*))
+  (setq *repos* (index-repos *index*))
   (update (repo-or-die x)))
 
 ;;  system-definition
 
 (defun sysdef (x)
-  (when *manifest*
-    (maybe-reload-manifest *manifest*))
-  (setq *repos* (manifest-repos *manifest*))
+  (when *index*
+    (maybe-reload-index *index*))
+  (setq *repos* (index-repos *index*))
   (let ((repo (or (find-repo-by-package x)
                   (repo x))))
     (when repo
@@ -685,9 +630,9 @@
 ;;  setup
 
 (defun boot ()
-  (let ((manifest-file (str *repo-dir* "/repo.manifest")))
-    (when (probe-file manifest-file)
-      (setq *manifest* (manifest manifest-file))
-      (setq *repos* (manifest-repos *manifest*))
+  (let ((index-file (str *repo-dir* "/repo-index.lisp")))
+    (when (probe-file index-file)
+      (setq *index* (index index-file))
+      (setq *repos* (index-repos *index*))
       (when (find-package :asdf)
         (pushnew 'sysdef asdf:*system-definition-search-functions*)))))