commit:     3ecda98fcd590fed73966df7f7f1fca86de019a7
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed May  5 16:14:14 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed May  5 16:14:14 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gs-elpa.git/commit/?id=3ecda98f

gs_elpa/elpa_db.py: Check version numbers for sanity

Packages with negative version numbers have been seen in melpa-stable.
These appear to be the result of mapping non-numeric versions,
which are defined in version-regexp-alist as follows (Emacs 27.2):
  (("^[-._+ ]?snapshot$" . -4)
   ("^[-._+]$" . -4)
   ("^[-._+ ]?\\(cvs\\|git\\|bzr\\|svn\\|hg\\|darcs\\)$" . -4)
   ("^[-._+ ]?unknown$" . -4)
   ("^[-._+ ]?alpha$" . -3)
   ("^[-._+ ]?beta$" . -2)
   ("^[-._+ ]?\\(pre\\|rc\\)$" . -1))

We could try to map them to Gentoo _alpha, _beta, etc. suffixes, but
it would require more effort to determine the name of the distfile
(and record it in the ebuild). Therefore skip these packages for now.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 gs_elpa/elpa_db.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gs_elpa/elpa_db.py b/gs_elpa/elpa_db.py
index ad0e374..f307c87 100644
--- a/gs_elpa/elpa_db.py
+++ b/gs_elpa/elpa_db.py
@@ -88,6 +88,11 @@ class ElpaDBGenerator(DBGenerator):
             if self.in_config([common_config, config], "exclude", realname):
                 continue
 
+            # Version numbers with negative elements have been seen
+            # in melpa-stable. Skip these packages for now.
+            if not all(i >= 0 for i in desc[INFO_VERSION]):
+                continue
+
             pkg = Package("app-emacs", realname,
                           '.'.join(map(str, desc[INFO_VERSION])))
             source_type = desc[INFO_SRC_TYPE].value()

Reply via email to