purcell / package-lint

A linting library for elisp package metadata
GNU General Public License v3.0
195 stars 34 forks source link

Where does the SPDX-License-Identifier go? #210

Closed tarsius closed 3 years ago

tarsius commented 3 years ago

In the header sure. But where?

Maybe this is crazy but what about:

;;; auto-compile.el --- automatically compile Emacs Lisp libraries  -*- lexical-binding: t -*-

;; Copyright (C) 2008-2021  Jonas Bernoulli
;; SPDX-License-Identifier: GPL-3.0-or-later

;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Homepage: https://github.com/emacscollective/auto-compile
;; Keywords: compile, convenience, lisp

;; Package-Requires: ((emacs "25.1") (packed "3.0.3"))

;; This file is not part of GNU Emacs.

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.

;;; Commentary:

I.e.: give up on "nothing shall ever touch the copyright line".

Or instead give up on "never put anything in between the header keywords (except empty lines, for grouping purposes)", i.e.:

;;; auto-compile.el --- automatically compile Emacs Lisp libraries  -*- lexical-binding: t -*-

;; Copyright (C) 2008-2021  Jonas Bernoulli

;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Homepage: https://github.com/emacscollective/auto-compile
;; Keywords: compile, convenience, lisp

;; Package-Requires: ((emacs "25.1") (packed "3.0.3"))

;; This file is not part of GNU Emacs.

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.

;; SPDX-License-Identifier: GPL-3.0-or-later

;;; Commentary:
lassik commented 3 years ago

Strongly recommend doing it like in your first example:

;; Copyright (C) 2008-2021  Jonas Bernoulli
;; SPDX-License-Identifier: GPL-3.0-or-later

This format is compliant with the reuse spec and there are already automated tools that can parse it (at least the reuse command).

lassik commented 3 years ago

In most cases the Author: line will duplicate the name in the Copyright line, but I don't see a way around that.

lassik commented 3 years ago

I spoke too soon. Your second example passes the reuse linter as well; apparently it doesn't matter if the copyright and spdx lines are far apart.

tarsius commented 3 years ago

Another crazy idea. Put the SPDX-License-Identifier before the permission statement and deal with the fact that there are now three consecutive single-line groups by connecting the outer ones to their neighbors using lines with only ;;. I.e. super-groups.

;;; hl-todo.el --- highlight TODO and similar keywords  -*- lexical-binding: t -*-

;; Copyright (C) 2013-2021  Jonas Bernoulli

;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Homepage: https://github.com/tarsius/hl-todo
;; Keywords: convenience
;;
;; Package-Requires: ((emacs "25"))

;; This file is not part of GNU Emacs.

;; SPDX-License-Identifier: GPL-3.0-or-later
;;
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.

;;; Commentary:

Oh! And/or put the "not Emacs" after the permission statement.

;;; hl-todo.el --- highlight TODO and similar keywords  -*- lexical-binding: t -*-

;; Copyright (C) 2013-2021  Jonas Bernoulli

;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Homepage: https://github.com/tarsius/hl-todo
;; Keywords: convenience

;; Package-Requires: ((emacs "25"))

;; SPDX-License-Identifier: GPL-3.0-or-later

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.

;; This file is not part of GNU Emacs.

;;; Commentary:

Just thinking out load here. Stop me if you can. Seriously. Stop me.

tarsius commented 3 years ago

Hm actually, this is kinda nice:

 ;; Package-Requires: ((emacs "25"))

-;; This file is not part of GNU Emacs.
+;; SPDX-License-Identifier: GPL-3.0-or-later

 ;; This file is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
-
+;;
 ;; This file is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
-
+;;
 ;; For a full copy of the GNU General Public License
 ;; see <http://www.gnu.org/licenses/>.

+;; This file is not part of GNU Emacs.
+
 ;;; Commentary:
lassik commented 3 years ago

We probably should pitch SPDX to emacs-devel and have them make the decision

tarsius commented 3 years ago

Thanks for letting me think out loud here...