summaryrefslogtreecommitdiff
path: root/dh-elpa.el
diff options
context:
space:
mode:
Diffstat (limited to 'dh-elpa.el')
-rw-r--r--dh-elpa.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/dh-elpa.el b/dh-elpa.el
index d7a9766..094913e 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -114,18 +114,24 @@ Versions taken from environment variables are run through
`dhelpa-sanitise-version'."
;; If one of these environment variables is the empty string, it's
;; as good as unset, so we replace that with the nil value.
- (let ((upstream-version (null-empty-string
- (dhelpa-sanitise-version
- (getenv "DEB_UPSTREAM_VERSION"))))
- (version-upstream (null-empty-string
- (dhelpa-sanitise-version
- (getenv "DEB_VERSION_UPSTREAM")))))
+ (let* ((upstream-version (null-empty-string
+ (getenv "DEB_UPSTREAM_VERSION")))
+ (version-upstream (null-empty-string
+ (getenv "DEB_VERSION_UPSTREAM")))
+ (version (if upstream-version upstream-version version-upstream))
+ (sanitised-version (dhelpa-sanitise-version version)))
+ ;; sanity check #1
(if (and upstream-version
version-upstream
(not (string= upstream-version version-upstream)))
(error "The DEB_UPSTREAM_VERSION and DEB_VERSION_UPSTREAM
environment variables are both set, but they disagree.")
- (if upstream-version upstream-version version-upstream))))
+ ;; sanity check #2
+ (unless (ignore-errors (version-to-list sanitised-version))
+ (error (concat "E: The Debian version " version " cannot be used as an ELPA version.
+See dh_elpa(1) HINTS for how to deal with this.")))
+ ;; if we got this far, return it
+ sanitised-version)))
;;;###autoload
(defun dhelpa-sanitise-version (version)