emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/repology d6de33c: repology-license: Fix Gentoo license


From: Nicolas Goaziou
Subject: [elpa] externals/repology d6de33c: repology-license: Fix Gentoo license analysis
Date: Tue, 19 Jan 2021 08:06:15 -0500 (EST)

branch: externals/repology
commit d6de33c9e892c6b1ded246413648d7d6fabaca39
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    repology-license: Fix Gentoo license analysis
    
    * repology-license.el (repology--license-get-identifiers:gentoo): Do
    not necessarily return nil when `repology--license-identifiers:gentoo'
    is nil.
    (repology--license-check:gentoo): Make sure to return a boolean when
    `repology--license-identifiers:gentoo' is non-nil.
---
 repology-license.el | 48 +++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/repology-license.el b/repology-license.el
index 9ef9a06..c60388a 100644
--- a/repology-license.el
+++ b/repology-license.el
@@ -118,28 +118,29 @@ This list is populated with 
`repology--license-get-identifiers:gentoo'.")
 
 (defun repology--license-get-identifiers:gentoo ()
   "Return list of free license identifiers according to Gentoo."
-  (unless repology--license-identifiers:gentoo
-    (with-temp-message "Repology: Fetching license identifiers for Gentoo..."
-      (let ((request
-              (repology-request repology--license-identifiers-url:gentoo)))
-        (pcase (plist-get request :reason)
-          ("OK"
-           (let ((identifiers nil))
-             (with-temp-buffer
-               (insert (plist-get request :body))
-               (dolist (category repology--license-categories:gentoo)
-                 (goto-char 1)
-                 (when (re-search-forward (concat "^" category " +"))
-                   (let ((line (buffer-substring (point) (line-end-position))))
-                     (setq identifiers
-                           (nconc (split-string line) identifiers)))))
-               (dolist (category repology--license-categories:gentoo)
-                 (setq identifiers (delete (concat "@" category) 
identifiers))))
-             (setq repology--license-identifiers:gentoo identifiers)))
-          (_
-           (message
-            "Repology: Cannot fetch Gentoo licenses.  \
-Ignoring repository")))))))
+  (or repology--license-identifiers:gentoo
+      (with-temp-message "Repology: Fetching license identifiers for Gentoo..."
+        (let ((request
+                (repology-request repology--license-identifiers-url:gentoo)))
+          (pcase (plist-get request :reason)
+            ("OK"
+             (let ((identifiers nil))
+               (with-temp-buffer
+                 (insert (plist-get request :body))
+                 (dolist (category repology--license-categories:gentoo)
+                   (goto-char 1)
+                   (when (re-search-forward (concat "^" category " +"))
+                     (let ((l (buffer-substring (point) (line-end-position))))
+                       (setq identifiers
+                             (nconc (split-string l) identifiers)))))
+                 (dolist (category repology--license-categories:gentoo)
+                   (setq identifiers
+                         (delete (concat "@" category) identifiers))))
+               (setq repology--license-identifiers:gentoo identifiers)))
+            (_
+             (message "Repology: Cannot fetch Gentoo licenses.  \
+Ignoring repository")
+             nil))))))
 
 (defun repology--license-gentoo:skip-whitespace ()
   "Skip past the whitespace at point."
@@ -225,7 +226,8 @@ Ignoring repository")))))))
         (while (and value (/= (repology--license-gentoo:peek) 0))
           (unless (repology--license-gentoo:read-next)
             (setq value nil)))
-        value))))
+        ;; Return a boolean.
+        (and value t)))))
 
 
 ;;; Reference Repository: OpenSUSE (OSS)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]