1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

docs: fix licensing info for generated files (#542)

* docs: fix licensing info for generated files

 * change generate_cvss_enums.go to note that the input file is
   relevant for the license.
 * change license and copyright of cvss20enums.go and cvss3enums.go
   to BSD-3-Clause and FIRST.
 * add reuse.software 3.0 compatible files for the schema cvss files.

* Stamp right license into generated files.

---------

Co-authored-by: Sascha L. Teichmann <sascha.teichmann@intevation.de>
This commit is contained in:
Bernhard E. Reiter 2024-06-21 14:02:51 +02:00 committed by GitHub
parent 7a5347803a
commit e2ad3d3f83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 42 additions and 21 deletions

View file

@ -1,10 +1,5 @@
// This file is Free Software under the Apache-2.0 License
// without warranty, see README.md and LICENSES/Apache-2.0.txt for details.
//
// SPDX-License-Identifier: Apache-2.0
//
// SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
// Software-Engineering: 2023 Intevation GmbH <https://intevation.de>
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2017 FIRST.ORG, INC.
//
// THIS FILE IS MACHINE GENERATED. EDIT WITH CARE!

View file

@ -1,10 +1,5 @@
// This file is Free Software under the Apache-2.0 License
// without warranty, see README.md and LICENSES/Apache-2.0.txt for details.
//
// SPDX-License-Identifier: Apache-2.0
//
// SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
// Software-Engineering: 2023 Intevation GmbH <https://intevation.de>
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2017 FIRST.ORG, INC.
//
// THIS FILE IS MACHINE GENERATED. EDIT WITH CARE!

View file

@ -14,21 +14,21 @@ import (
"bytes"
"encoding/json"
"flag"
"fmt"
"go/format"
"log"
"os"
"regexp"
"sort"
"strings"
"text/template"
)
const tmplText = `// This file is Free Software under the MIT License
// without warranty, see README.md and LICENSES/MIT.txt for details.
//
// SPDX-License-Identifier: MIT
//
// SPDX-FileCopyrightText: 2023 German Federal Office for Information Security (BSI) <https://www.bsi.bund.de>
// Software-Engineering: 2023 Intevation GmbH <https://intevation.de>
// We from Intevation consider the source code parts in the following
// template file as too insignificant to be a piece of work that gains
// "copyrights" protection in the European Union. So the license(s)
// of the output files are fully determined by the input file.
const tmplText = `// {{ $.License }}
//
// THIS FILE IS MACHINE GENERATED. EDIT WITH CARE!
@ -69,6 +69,7 @@ type definition struct {
}
type schema struct {
License []string `json:"license"`
Definitions map[string]*definition `json:"definitions"`
}
@ -137,9 +138,22 @@ func main() {
}
sort.Strings(defs)
license := "determine license(s) from input file and replace this line"
pattern := regexp.MustCompile(`Copyright \(c\) (\d+), FIRST.ORG, INC.`)
for _, line := range s.License {
if m := pattern.FindStringSubmatch(line); m != nil {
license = fmt.Sprintf(
"SPDX-License-Identifier: BSD-3-Clause\n"+
"// SPDX-FileCopyrightText: %s FIRST.ORG, INC.", m[1])
break
}
}
var source bytes.Buffer
check(tmpl.Execute(&source, map[string]any{
"License": license,
"Prefix": *prefix,
"Definitions": s.Definitions,
"Keys": defs,

View file

@ -0,0 +1,2 @@
SPDX-License-Identifier: BSD-3-Clause
SPDX-FileCopyrightText: 2017 FIRST.ORG, INC.

View file

@ -0,0 +1,2 @@
SPDX-License-Identifier: BSD-3-Clause
SPDX-FileCopyrightText: 2017 FIRST.ORG, INC.

View file

@ -0,0 +1,2 @@
SPDX-License-Identifier: BSD-3-Clause
SPDX-FileCopyrightText: 2021 FIRST.ORG, INC.