From 7bc5006c0b4bff181874456726e3985c944bc4bf Mon Sep 17 00:00:00 2001
From: Francesco Ariis <fa-ml@ariis.it>
Date: Fri, 15 Mar 2024 17:31:33 +0100
Subject: [PATCH] Conform BSD-2-Clause and BSD-3-Clause text to SPDX

`cabal init` text for BSD-2-Clause and BSD-3-Clause licence differed
slightly from the one published at SPDX. [1] [2]

This caused some problems to users when dealing with licence-recognition
software. [3]

[1] https://spdx.org/licenses/BSD-2-Clause.html
[2] https://spdx.org/licenses/BSD-3-Clause.html
[3] https://discourse.haskell.org/t/non-standard-license-generated-by-stack-new/9059

(cherry picked from commit 1e86730a75d1fbba01d87cb68f11999ac8b5302c)
---
 .../src/Distribution/Client/Init/Licenses.hs         |  8 +++-----
 changelog.d/pr-9813                                  | 12 ++++++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)
 create mode 100644 changelog.d/pr-9813

diff --git a/cabal-install/src/Distribution/Client/Init/Licenses.hs b/cabal-install/src/Distribution/Client/Init/Licenses.hs
index ef648e9351..1f9177083b 100644
--- a/cabal-install/src/Distribution/Client/Init/Licenses.hs
+++ b/cabal-install/src/Distribution/Client/Init/Licenses.hs
@@ -30,7 +30,6 @@ bsd2 :: String -> String -> License
 bsd2 authors year =
   unlines
     [ "Copyright (c) " ++ year ++ ", " ++ authors
-    , "All rights reserved."
     , ""
     , "Redistribution and use in source and binary forms, with or without"
     , "modification, are permitted provided that the following conditions are"
@@ -48,7 +47,7 @@ bsd2 authors year =
     , "\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT"
     , "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR"
     , "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT"
-    , "OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
+    , "HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
     , "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT"
     , "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,"
     , "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY"
@@ -62,7 +61,6 @@ bsd3 authors year =
   unlines
     [ "Copyright (c) " ++ year ++ ", " ++ authors
     , ""
-    , "All rights reserved."
     , ""
     , "Redistribution and use in source and binary forms, with or without"
     , "modification, are permitted provided that the following conditions are met:"
@@ -75,7 +73,7 @@ bsd3 authors year =
     , "      disclaimer in the documentation and/or other materials provided"
     , "      with the distribution."
     , ""
-    , "    * Neither the name of " ++ authors ++ " nor the names of other"
+    , "    * Neither the name of the copyright holder nor the names of its"
     , "      contributors may be used to endorse or promote products derived"
     , "      from this software without specific prior written permission."
     , ""
@@ -83,7 +81,7 @@ bsd3 authors year =
     , "\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT"
     , "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR"
     , "A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT"
-    , "OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
+    , "HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
     , "SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT"
     , "LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,"
     , "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY"
diff --git a/changelog.d/pr-9813 b/changelog.d/pr-9813
new file mode 100644
index 0000000000..fc6195ac6e
--- /dev/null
+++ b/changelog.d/pr-9813
@@ -0,0 +1,12 @@
+synopsis: Adjust BSD-2-Clause and BSD-3-Clause licence text
+packages: cabal-install
+prs: #9813
+issues: #9812
+
+description: {
+
+This change matters to BSD-2-Clause and BSD-3-Clause licences. For these two
+licences, `cabal init` created a licence file that slightly differed from
+wording published at SPDX.  This has been rectified.
+
+}
-- 
GitLab