              :type boolean
              :documentation "If non-nil this package is ignored.")))
 
-(defvar configuration-layer-layers '()
+(defvar configuration-layer--layers '()
   "A non-sorted list of `cfgl-layer' objects.")
 
-(defvar configuration-layer-packages '()
+(defvar configuration-layer--packages '()
   "An alphabetically sorted list of `cfgl-package' objects.")
+
+(defvar configuration-layer--used-distant-packages '()
+  "A list of all distant packages that are effectively used.")
 
 (defvar configuration-layer-error-count nil
   "Non nil indicates the number of errors occurred during the

   "--> fetching new package repository indexes...\n")
  (spacemacs//redisplay)
  (package-refresh-contents)
  (let* ((candidates (configuration-layer/filter-packages
                      configuration-layer-packages
                      (lambda (x) (and (not (null (oref x :owner)))
                                       (not (eq 'local (oref x :location)))
                                       (not (oref x :excluded))))))
         (update-packages (configuration-layer//get-packages-to-update
                           (mapcar 'car (object-assoc-list :name candidates))))
         (date (format-time-string "%y-%m-%d_%H.%M.%S"))
         (rollback-dir (expand-file-name
                        (concat configuration-layer-rollback-directory

  (interactive)
  (let* ((dependencies (configuration-layer//get-all-packages-dependencies))
         (implicit-packages (configuration-layer//get-implicit-packages
                             configuration-layer--used-distant-packages))
         (orphans (configuration-layer//filter-used-themes
                   (configuration-layer//get-orphan-packages
                    configuration-layer--used-distant-packages
                    implicit-packages
                    dependencies)))
         (orphans-count (length orphans)))
    ;; (message "dependencies: %s" dependencies)
    ;; (message "implicit: %s" implicit-packages)
