From 092acca8b3b645be5261592d29aad77736e2d606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Ga=C5=82kowski?= Date: Thu, 2 Mar 2023 18:44:32 +0100 Subject: [PATCH] lisp-modules: make ql-import.lisp automatically pull the latest Quicklisp dist --- doc/languages-frameworks/lisp.section.md | 9 +++---- .../development/lisp-modules/import/main.lisp | 27 ++++++++++++++----- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/doc/languages-frameworks/lisp.section.md b/doc/languages-frameworks/lisp.section.md index ef50da05c4d7..3d5f0770f23f 100644 --- a/doc/languages-frameworks/lisp.section.md +++ b/doc/languages-frameworks/lisp.section.md @@ -81,16 +81,15 @@ nix-shell --run 'sbcl --script ql-import.lisp' The script will: -1. Download the Quicklisp `systems.txt` and `releases.txt` files +1. Download the latest Quicklisp `systems.txt` and `releases.txt` files 2. Generate an SQLite database of all QL systems in `packages.sqlite` 3. Generate an `imported.nix` file from the database The maintainer's job there is to: -1. Update the `import/main.lisp` file for new QL releases -2. Re-run the `ql-import.lisp` script -3. Add missing native dependencies in `ql.nix` -4. For packages that still don't build, package them manually in `packages.nix` +1. Re-run the `ql-import.lisp` script +2. Add missing native dependencies in `ql.nix` +3. For packages that still don't build, package them manually in `packages.nix` Also, the `imported.nix` file **must not be edited manually**! It should only be generated as described in this section. diff --git a/pkgs/development/lisp-modules/import/main.lisp b/pkgs/development/lisp-modules/import/main.lisp index efad1ca64570..2ab754d05a4c 100644 --- a/pkgs/development/lisp-modules/import/main.lisp +++ b/pkgs/development/lisp-modules/import/main.lisp @@ -2,7 +2,9 @@ (:use :common-lisp :org.lispbuilds.nix/database/sqlite :org.lispbuilds.nix/repository/quicklisp - :org.lispbuilds.nix/api)) + :org.lispbuilds.nix/api) + (:local-nicknames + (:http :dexador))) (in-package org.lispbuilds.nix/main) @@ -18,12 +20,22 @@ :init-file (resource "init" "sql") :url "packages.sqlite")) -;; Check http://beta.quicklisp.org/dist/quicklisp.txt for updates -(defvar *quicklisp* - (make-instance - 'quicklisp-repository - :dist-url - "https://beta.quicklisp.org/dist/quicklisp/2023-02-15/")) +(defvar *quicklisp* nil) + +(defun get-quicklisp-version () + (let ((response (http:get "http://beta.quicklisp.org/dist/quicklisp.txt"))) + (subseq + (second (uiop:split-string response :separator '(#\Newline))) + 9))) + +(defun init-quicklisp () + (setf *quicklisp* + (make-instance + 'quicklisp-repository + :dist-url + (format nil + "https://beta.quicklisp.org/dist/quicklisp/~a/" + (get-quicklisp-version))))) (defun run-importers () (ignore-errors (delete-file "packages.sqlite")) @@ -38,5 +50,6 @@ (defun main () (format t "~%") + (init-quicklisp) (run-importers) (gen-nix-file))