Skip to content

Commit

Permalink
Fix easy reuse compliance issues and adapt generate code to it
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Dec 6, 2024
1 parent 486182d commit f16826d
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019–2020 Target, Copyright 2021 The Nix Community
# SPDX-License-Identifier: Apache-2.0
if type -P lorri &>/dev/null; then
eval "$(lorri direnv)"
else
Expand Down
1 change: 1 addition & 0 deletions LICENSES/Apache-2.0.txt
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ force-license-headers: FORCE install-addlicense

license-headers: FORCE install-addlicense
@printf "\e[1;36m>> addlicense\e[0m\n"
@addlicense -c "SAP SE" -s -- $(patsubst $(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...))
@addlicense -c "SAP SE" -s=only -- $(patsubst $(shell awk '$$1 == "module" {print $$2}' go.mod)%,.%/*.go,$(shell go list ./...))

check-license-headers: FORCE install-addlicense
@printf "\e[1;36m>> addlicense --check\e[0m\n"
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<!--
SPDX-FileCopyrightText: SAP SE
SPDX-License-Identifier: Apache-2.0
-->

# go-makefile-maker

[![CI](https://github.com/sapcc/go-makefile-maker/actions/workflows/ci.yaml/badge.svg)](https://github.com/sapcc/go-makefile-maker/actions/workflows/ci.yaml)
Expand Down
18 changes: 18 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: SAP SE
# SPDX-License-Identifier: Apache-2.0

version = 1

[[annotations]]
path = [
".github/CODEOWNERS",
".github/renovate.json",
".gitignore",
".license-scan-overrides.jsonl",
".license-scan-rules.json",
"go.mod",
"go.sum",
"Makefile.maker.yaml",
]
SPDX-FileCopyrightText = "SAP SE"
SPDX-License-Identifier = "Apache-2.0"
5 changes: 5 additions & 0 deletions internal/goreleaser/RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<!--
SPDX-FileCopyrightText: SAP SE
SPDX-License-Identifier: Apache-2.0
-->

# Release Guide

We use [GoReleaser][goreleaser] and GitHub workflows for automating the release
Expand Down
18 changes: 18 additions & 0 deletions internal/makefile/REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: SAP SE
# SPDX-License-Identifier: Apache-2.0

version = 1

[[annotations]]
path = [
".github/CODEOWNERS",
".github/renovate.json",
".gitignore",
".license-scan-overrides.jsonl",
".license-scan-rules.json",
"go.mod",
"go.sum",
"Makefile.maker.yaml",
]
SPDX-FileCopyrightText = "SAP SE"
SPDX-License-Identifier = "Apache-2.0"
2 changes: 2 additions & 0 deletions internal/makefile/license-scan-overrides.jsonl.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileContributor: SAP SE
SPDX-License-Identifier: Apache-2.0
2 changes: 2 additions & 0 deletions internal/makefile/license-scan-rules.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileContributor: SAP SE
SPDX-License-Identifier: Apache-2.0
8 changes: 7 additions & 1 deletion internal/makefile/makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import (
"github.com/sapcc/go-makefile-maker/internal/golang"
)

//go:embed REUSE.toml
var reuseConfig []byte

//go:embed license-scan-rules.json
var licenseRules []byte

Expand Down Expand Up @@ -414,7 +417,7 @@ endif
prerequisites: []string{"install-addlicense"},
recipe: []string{
`@printf "\e[1;36m>> addlicense\e[0m\n"`,
fmt.Sprintf(`@addlicense -c "SAP SE" -s %s %s`, ignoreOptionsStr, allSourceFilesExpr),
fmt.Sprintf(`@addlicense -c "SAP SE" -s=only %s %s`, ignoreOptionsStr, allSourceFilesExpr),
},
})

Expand All @@ -430,6 +433,9 @@ endif
})

if isGolang {
reuseConfigFile := "REUSE.toml"
must.Succeed(os.WriteFile(reuseConfigFile, reuseConfig, 0666))

licenseRulesFile := ".license-scan-rules.json"
must.Succeed(os.WriteFile(licenseRulesFile, licenseRules, 0666))

Expand Down
2 changes: 2 additions & 0 deletions internal/nix/nix-shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mkShell {
must.Succeed(os.WriteFile("shell.nix", []byte(nixShellFile), 0666))

must.Succeed(os.WriteFile(".envrc", []byte(`#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019–2020 Target, Copyright 2021 The Nix Community
# SPDX-License-Identifier: Apache-2.0
if type -P lorri &>/dev/null; then
eval "$(lorri direnv)"
else
Expand Down

0 comments on commit f16826d

Please sign in to comment.