Commit c52e731e authored by Eric Timmons's avatar Eric Timmons
Browse files

First commit

parents
Loading
Loading
Loading
Loading

LICENSE

0 → 100644
+22 −0
Original line number Diff line number Diff line
Copyright 2020 Eric Timmons

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.org

0 → 100644
+5 −0
Original line number Diff line number Diff line
#+TITLE: Quicklisp -> CLPI Converter
#+AUTHOR: clpm-devel@common-lisp.net

This project converts project metadata from Quicklisp's format into CLPI's
format.

ql-clpi.asd

0 → 100644
+18 −0
Original line number Diff line number Diff line
;;;; QL-CLPI System Definition
;;;;
;;;; This software is part of QL-CLPI. See README.org for more information. See
;;;; LICENSE for license information.

#-:asdf3.2
(error "Requires ASDF >=3.2")

;; Not necessary, but easier to have when using SLIME.
(in-package :asdf-user)

(defsystem #:ql-clpi
  :version "0.0.1"
  :description "A library to convert Quicklisp metadata to CLPI metadata."
  :license "BSD-2-Clause"
  :pathname "src/"
  :class :package-inferred-system
  :depends-on (#:ql-clpi/ql-clpi))
+41 −0
Original line number Diff line number Diff line
;;;; Script to convert a QL distribution to a file based CLPI index.
;;;;
;;;; This software is part of QL-CLPI. See README.org for more information. See
;;;; LICENSE for license information.

(in-package #:cl-user)

(require :asdf)

(asdf:load-system :ql-clpi)
(asdf:load-system :clpm-multi-http-client/drakma)

(uiop:define-package #:ql-clpm-scripts/convert-ql-dist
    (:use #:cl
          #:ql-clpi
          #:ql-clpi/ql-dist
          #:ql-clpi/ql-to-clpi))

(in-package #:ql-clpm-scripts/convert-ql-dist)

(defun sync-ql-dist-to-file-index (ql-dist-uri ql-cache-dir clpi-dir
                                   &key http-client
                                     appendable-p)
  (let ((ql-dist (make-instance 'ql-dist
                                :uri ql-dist-uri
                                :cache-pathname ql-cache-dir
                                :http-client http-client))
        (index (make-instance 'clpi:file-index
                              :root clpi-dir)))
    (ql-dist-to-clpi ql-dist index :appendable-p appendable-p)
    index))

(defun run ()
  (clpi:index-save
   (sync-ql-dist-to-file-index "https://beta.quicklisp.org/dist/quicklisp.txt"
                               "/tmp/clpi/ql/"
                               "/tmp/clpi/file/"
                               :http-client
                               (make-instance 'clpm-multi-http-client/drakma:drakma-client)
                               :appendable-p t)))
(run)

src/ql-clpi.lisp

0 → 100644
+23 −0
Original line number Diff line number Diff line
;;;; QL-CLPI
;;;;
;;;; This software is part of QL-CLPI. See README.org for more information. See
;;;; LICENSE for license information.

(uiop:define-package #:ql-clpi/ql-clpi
    (:nicknames #:ql-clpi)
  (:use #:cl
        #:alexandria
        #:ql-clpi/ql-dist
        #:ql-clpi/ql-to-clpi)
  (:import-from #:alexandria)
  (:import-from #:clpi)
  (:export #:ql-dist
           #:ql-dist-to-clpi
           #:project-version-aliases))

(in-package #:ql-clpi/ql-clpi)

(defun project-version-aliases (project version)
  "Given a PROJECT and a VERSION, return all aliases of that version string."
  (let ((alias-alist (clpi:metadata-value project :ql/version-aliases)))
    (assoc-value alias-alist version :test 'equal)))