anchor.diff:  
     ;; Validate the version has a repository at least
     (assert (plusp (length (repositories library-version)))
  -	  nil
  -	  "~A version needs to define a repository at least" (version library-version))
  -  
  +          nil
  +          "~A version needs to define a repository at least" (version library-version))
  +
     ;; Assign the version to the repositories
     (loop for repository in (repositories library-version)
  -       do (setf (library-version repository) library-version)))
  +     do (setf (library-version repository) library-version)))
   
   (defun print-library-version (library-version stream)
     (format stream "~A-~A~@[ (~A)~]"
  -	  (library-name (library library-version))
  -	  (version library-version)
  -	  (stability library-version)))
  +          (library-name (library library-version))
  +          (version library-version)
  +          (stability library-version)))
   
   (defmethod print-object ((library-version cld-library-version) stream)
     (print-unreadable-object (library-version stream :type t :identity t)
  
positive.code: (defun find-cld-library (name &optional (error-p t))
    (or (gethash name *cld-libraries*)
        (when error-p
  	(error "Library ~A not found" name))))
  
  (defun list-cld-libraries ()
    (loop for library being the hash-values of *cld-libraries*
         collect library))
  
  (defun register-cld-library (library)
    (setf (gethash (library-name library) *cld-libraries*) library))
  
  (defun find-cld-library-version (library version &optional (error-p t))
    (loop for library-version in (library-versions library)
         when (equalp (version library-version) version)
         do (return-from find-cld-library-version library-version))
    (when error-p
      (error "~A version ~A not found" library version)))
  
  (defclass cld-library ()
    ((name :initarg :name
  	 :initform (error "Provide the library name")
  	 :accessor library-name
  	 :documentation "The library name")
     (author :initarg :author
  	   :initform nil
  	   :accessor library-author
  	   :documentation "The library author")
     (maintainer :initarg :maintainer
  	       :initform nil
  	       :accessor library-maintainer
  	       :documentation "The library maintainer")
     (description :initarg :description
  		:initform nil
  		:accessor library-description
  		:documentation "The library description")
     (license :initarg :license
  	    :initform nil
  	    :accessor library-license
  	    :documentation "The library license")
     (cld :initarg :cld
  	:initform (error "Provide the cld")
  	:accessor library-cld
  	:documentation "The library meta description address. Can be a pathname or an url")
     (versions :initarg :versions
  	     :initform (error "Provide a library version at least")
  	     :accessor library-versions
  	     :documentation "The library versions")
     (tags :initarg :tags
  	 :initform nil
  	 :accessor library-tags
  	 :documentation "Library tags"))
    (:documentation "A library meta description"))
  
  (defmethod print-object ((library cld-library) stream)
    (print-unreadable-object (library stream :type t :identity t)
      (format stream "~A (~A)"
  	    (library-name library)
  	    (library-cld library))))
  
  (defmethod initialize-instance :after ((library cld-library) &rest initargs)
    (declare (ignore initargs))
  
    ;; Assign the library to the versions
    (loop for version in (library-versions library)
         do (setf (library version) library))
  
    ;; Register the library
    (register-cld-library library))
  
  (defclass cld-library-version ()
    ((library :initarg :library
  	    :initform nil
  	    :accessor library
  	    :documentation "The cld-library")
     (version :initarg :version
  	    :initform (error "Provide the version")
  	    :accessor version
  	    :documentation "The library version")
     (description :initarg :description
  		:initform nil
  		:accessor description
  		:documentation "Library version description")
     (stability :initarg :stability
  	      :initform nil
  	      :accessor stability
  	      :documentation "Library version stability. One of :stable, :beta, :alpha")
     (repositories :initarg :repositories
  		 :initform (error "Provide a repository at least")
  		 :accessor repositories
  		 :documentation "Library version repositories")
     (dependencies :initarg :dependencies
  		 :initform nil
  		 :accessor dependencies
  		 :documentation "The library version dependencies"))
    (:documentation "A library version description"))
  
  (defmethod initialize-instance :after ((library-version cld-library-version) &rest initargs)
  
negative.code: (defun cache-library-version (library-version)
    (ensure-directories-exist *repositories-directory*)
    (let ((repository-name (format nil "~A-~A"
                                   (library-name (library library-version))
                                   (version library-version))))
      (let ((repository-directory (merge-pathnames
                                   (pathname (format nil "~A/" repository-name))
                                   *repositories-directory*)))
        (verbose-msg "Repository directory: ~A~%" repository-directory)
        (if (probe-file repository-directory)
            (verbose-msg "Repository for ~A already exists in ~A~%"
                         library-version
                         repository-directory)
                                          ;else
            (progn
              (verbose-msg "Repository does not exist for ~A. Caching...~%" library-version)
              (let ((done nil))
                (loop for repository in (repositories library-version)
                   while (not done)
                   do (progn
                        (verbose-msg "Trying with ~A...~%" repository)
                        (setf done (cache-repository repository repository-directory))
                        (if (not done)
                            (verbose-msg "Failed.~%")
                            (verbose-msg "Success.~%"))))
                (when (not done)
                  (error "Couldn't cache repository from ~{~A~}~%"
                         (repositories library-version))))))
        repository-directory)))
  
  (defmethod cache-repository (repository directory)
    (cache-repository-from-address (repository-address repository)
                                   repository directory))
  
  (defun symlink (target linkname)
    (trivial-shell:shell-command
     (format nil "ln -s ~A ~A"
             (princ-to-string target) ;; target directory
             (princ-to-string linkname))))
  
  (defun copy-directory (from to)
    (trivial-shell:shell-command
     (format nil "cp -r ~A ~A"
             (princ-to-string from)
             (princ-to-string to))))
  
  (defgeneric cache-repository-from-address (repository-address repository target-directory)
    (:documentation "Cache the given repository from repository-address to target-directory.
                     Methods of this generic function should return T on success, or NIL on failure."))
  
  (defmethod cache-repository-from-address ((repository-address directory-repository-address)
                                            repository target-directory)
    (multiple-value-bind (result code status)
        (ecase *address-cache-operation*
          (:symlink
           (let ((linkname (subseq (princ-to-string target-directory)
                                   0
                                   (1- (length (princ-to-string target-directory))))))
             (verbose-msg "Symlinking ~A to ~A~%"
                          (repository-directory repository-address)
                          linkname)
             (symlink (repository-directory repository-address)
                      linkname)))
          (:copy
           (verbose-msg "Copying directory ~A to ~A~%"
                        (repository-directory repository-address)
                        target-directory)
           (copy-directory (repository-directory repository-address)
                           target-directory)))
      (declare (ignore result))
      (zerop status)))
  
  (defmethod cache-repository-from-address ((repository-address url-repository-address)
                                            repository target-directory)
    (flet ((run-or-fail (&rest args)
             (multiple-value-bind (result code status)
                 (apply #'trivial-shell:shell-command args)
               (when (not (zerop status))
                 (return-from cache-repository-from-address nil)))))
      (let ((temporal-file
             (merge-pathnames
              (file-namestring (url repository-address))
              #p"/tmp/")))
        (verbose-msg "Downloading ~A...~%" (url repository-address))
        (run-or-fail (format nil "wget -O ~A ~A" temporal-file (url repository-address)))
        (verbose-msg "Extracting...~%")
        (run-or-fail (format nil "mkdir ~A" (princ-to-string target-directory)))
        (run-or-fail (format nil "tar zxf ~A --strip=1 -C ~A"
                             temporal-file
                             (princ-to-string target-directory))))
      t))
  
  (defmethod cache-repository-from-address ((repository-address git-repository-address)
                                            repository target-directory)
    (flet ((run-or-fail (command)
             (multiple-value-bind (result code status)
                 (trivial-shell:shell-command command)
               (declare (ignore result code))
               (when (not (zerop status))
                 (return-from cache-repository-from-address nil)))))
      (verbose-msg "Cloning repository: ~A...~%" (url repository-address))
      (run-or-fail (format nil "git clone ~A ~A"
                           (url repository-address)
                           (princ-to-string target-directory)))
      (when (commit repository-address)
        (verbose-msg "Checking out commit ~A~%" (commit repository-address))
        (let ((command  (format nil "cd ~A; git checkout ~A"
                                (princ-to-string target-directory)
                                (commit repository-address))))
          (verbose-msg "~A~%" command)
          (run-or-fail command)))
      t))
  
  (defclass cld-repository ()
    ((name :initarg :name
           :accessor name
           :initform nil
           :documentation "The cld repository name"))
    (:documentation "A .cld files repository"))
  
  (defclass directory-cld-repository (cld-repository)
    ((directory :initarg :directory
                :initform (error "Provide the cld repository directory")
                :accessor repository-directory
                :documentation "The cld repository directory"))
    (:documentation "A local (directory) cld repository"))
  
  (defmethod print-object ((cld-repository directory-cld-repository) stream)
    (print-unreadable-object (cld-repository stream :type t :identity t)
      (format stream "~A : ~A"
              (name cld-repository)
              (repository-directory cld-repository))))
  
  (defclass http-cld-repository (cld-repository)
    ((url :initarg :url
          :initform (error "Provide the cld repository url address")
          :accessor repository-url
          :documentation "The cld repository url address"))
    (:documentation "A cld repository on http"))
  
  (defmethod print-object ((cld-repository http-cld-repository) stream)
    (print-unreadable-object (cld-repository stream :type t :identity t)
      (format stream "~A : ~A"
              (name cld-repository)
              (repository-url cld-repository))))
  
  (defclass cached-http-cld-repository (http-cld-repository)
    ((cache-directory :initarg :cache-directory
                      :initform (error "Provide the cache directory")
                      :accessor cache-directory
                      :documentation "The cache directory"))
    (:documentation "A cld repository in which a cache is maintained in a local directory"))
  
  (defmethod find-cld ((cld-repository directory-cld-repository) library-name)
    (let ((cld-file (merge-pathnames (pathname (format nil "~A.cld" library-name))
                                     (repository-directory cld-repository))))
      (verbose-msg "Checking if ~A exists~%" cld-file)
      (probe-file cld-file)))
  
  (defmethod find-cld ((cld-repository http-cld-repository) library-name)
    (let* ((cld-url-address (format nil "~A/~A.cld"
                                    (repository-url cld-repository)
                                    library-name))
           (temporal-directory #p"/tmp/")
           (temporal-file (merge-pathnames (pathname (format nil "~A.cld" library-name))
                                           temporal-directory)))
      (verbose-msg "Trying to fetch ~A~%" cld-url-address)
      (let ((command (format nil "wget -O ~A ~A"
                             temporal-file
                             cld-url-address)))
        (verbose-msg "~A~%" command)
        (multiple-value-bind (result error status)
            (trivial-shell:shell-command command)
          (declare (ignore result error))
          (if (equalp status 0)
              (progn
                (verbose-msg "~A downloaded.~%" cld-url-address)
                temporal-file)
                                          ; else
              (verbose-msg "Failed.~%"))))))
  
  (defclass cld-address ()
    ()
  