diff options
authorSean Whitton <>2016-08-12 18:53:11 -0700
committerSean Whitton <>2016-08-12 18:53:22 -0700
commitfa2090b76622569638d354898c939aa231e896f6 (patch)
parent6e6dbbf995e42fc068dc166647cd6b3d9b85f888 (diff)
better output & docs for when DEB_* isn't enough
2 files changed, 22 insertions, 13 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
;; 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
+ (version-upstream (null-empty-string
+ (version (if upstream-version upstream-version version-upstream))
+ (sanitised-version (dhelpa-sanitise-version version)))
+ ;; sanity check #1
(if (and upstream-version
(not (string= upstream-version 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)))
(defun dhelpa-sanitise-version (version)
diff --git a/ b/
index d260e48..ca5f6a2 100755
--- a/
+++ b/
@@ -326,9 +326,10 @@ substvars
If dh_elpa can't determine the package version by looking at *.el
files (usually because upstream has failed to include the proper
-headers), it will fallback to the DEB_UPSTREAM_VERSION and
-DEB_VERSION_UPSTREAM environment variables. An easy way to set one of
-these is just to prepend the following to your rules file:
+headers or *-pkg.el file), it will fallback to the
+An easy way to set one of these is just to prepend the following to
+your rules file:
=over 4
@@ -337,6 +338,8 @@ these is just to prepend the following to your rules file:
-Note that this will fail in certain cases where the Debian upstream
-version cannot be translated into an adequate Emacs version string.
-See the documentation for the `dhelpa-sanitise-version' function.
+Certain Debian upstream version strings cannot be translated into
+version strings Emacs will accept (see the docstring for the Emacs
+function `version-to-list' for details). dh_elpa will error out if
+the version cannot be translated. You should resort to patching in a
+Package-Version header or adding a *-pkg.el file.