Strip parent path from package descriptions for reproducibility
authorRob Browning <rlb@defaultvalue.org>
Sat, 7 Nov 2020 21:05:52 +0000 (15:05 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 7 Nov 2020 22:10:55 +0000 (16:10 -0600)
Previously, the package description would include the full build tree
path which varies.  Instead, remove any duplicate slashes and any
components other than the immediate parent.

Thanks to Chris Lamb for reporting the problem and tracking down the
cause.

Bug-Debian: https://bugs.debian.org/972861

lisp/emacs-lisp/package.el

index 7d6be3cf4e28a030c047a0bf14056898dc8125f2..60561fdb67803404872ab0b97947f40943422cb4 100644 (file)
@@ -963,7 +963,11 @@ untar into a directory named DIR; otherwise, signal an error."
       (write-region
        (concat
         ";;; Generated package description from "
-        (replace-regexp-in-string "-pkg\\.el\\'" ".el" pkg-file)
+        (replace-regexp-in-string ;; just the final y.el or x/y.el
+         "^.*?\\([^/]+/\\)?\\([^/]+\\)$" "\\1\\2"
+         (replace-regexp-in-string
+          "/+" "/"
+          (replace-regexp-in-string "-pkg\\.el\\'" ".el" pkg-file)))
         "  -*- no-byte-compile: t -*-\n"
         (prin1-to-string
          (nconc