mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-05 11:45:45 +00:00
Fix package.el handling of version numbers like 1.0pre6.
* lisp/emacs-lisp/package.el (package-version-join): Impose a standard string representation for pre/alpha/beta version lists. (package-unpack-single): Standardize the directory name by passing it through package-version-join.
This commit is contained in:
parent
ffbf300e1e
commit
ba08b24186
@ -1,7 +1,11 @@
|
||||
2011-03-10 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* emacs-lisp/package.el (package-strip-rcs-id): Accept any version
|
||||
string that does not signal an error in version-to-list.
|
||||
* emacs-lisp/package.el (package-version-join): Impose a standard
|
||||
string representation for pre/alpha/beta version lists.
|
||||
(package-unpack-single): Standardize the directory name by passing
|
||||
it through package-version-join.
|
||||
(package-strip-rcs-id): Accept any version string that does not
|
||||
signal an error in version-to-list.
|
||||
|
||||
2011-03-10 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
|
@ -320,14 +320,39 @@ The inner alist is keyed by version.")
|
||||
(put 'package-obsolete-alist 'risky-local-variable t)
|
||||
|
||||
(defconst package-subdirectory-regexp
|
||||
"^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$"
|
||||
"\\`\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)\\'"
|
||||
"Regular expression matching the name of a package subdirectory.
|
||||
The first subexpression is the package name.
|
||||
The second subexpression is the version string.")
|
||||
|
||||
(defun package-version-join (l)
|
||||
"Turn a list of version numbers into a version string."
|
||||
(mapconcat 'int-to-string l "."))
|
||||
(defun package-version-join (vlist)
|
||||
"Return the version string corresponding to the list VLIST.
|
||||
This is, approximately, the inverse of `version-to-list'.
|
||||
\(Actually, it returns only one of the possible inverses, since
|
||||
`version-to-list' is a many-to-one operation.)"
|
||||
(if (null vlist)
|
||||
""
|
||||
(let ((str-list (list "." (int-to-string (car vlist)))))
|
||||
(dolist (num (cdr vlist))
|
||||
(cond
|
||||
((>= num 0)
|
||||
(push (int-to-string num) str-list)
|
||||
(push "." str-list))
|
||||
((< num -3)
|
||||
(error "Invalid version list `%s'" vlist))
|
||||
(t
|
||||
;; pre, or beta, or alpha
|
||||
(cond ((equal "." (car str-list))
|
||||
(pop str-list))
|
||||
((not (string-match "[0-9]+" (car str-list)))
|
||||
(error "Invalid version list `%s'" vlist)))
|
||||
(push (cond ((= num -1) "pre")
|
||||
((= num -2) "beta")
|
||||
((= num -3) "alpha"))
|
||||
str-list))))
|
||||
(if (equal "." (car str-list))
|
||||
(pop str-list))
|
||||
(apply 'concat (nreverse str-list)))))
|
||||
|
||||
(defun package-strip-version (dirname)
|
||||
"Strip the version from a combined package name and version.
|
||||
@ -592,7 +617,9 @@ Otherwise it uses an external `tar' program.
|
||||
(if (string= file-name "package")
|
||||
(package--write-file-no-coding
|
||||
(expand-file-name (concat file-name ".el") package-user-dir))
|
||||
(let* ((pkg-dir (expand-file-name (concat file-name "-" version)
|
||||
(let* ((pkg-dir (expand-file-name (concat file-name "-"
|
||||
(package-version-join
|
||||
(version-to-list version)))
|
||||
package-user-dir))
|
||||
(el-file (expand-file-name (concat file-name ".el") pkg-dir))
|
||||
(pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir)))
|
||||
|
Loading…
Reference in New Issue
Block a user