Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/scripts/build_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
The templates in packaging/ hold the shape. This fills them from the one place
each value lives: the version from the tag, the checksums from the release's
own checksum file, the addresses from go.mod and web/public/CNAME, the date
from CHANGELOG.md. Nothing is typed twice, and the two values that are - the
product's name and its licence - are held to their Go originals by a guard.
from CHANGELOG.md. Nothing is typed twice, and the three values that are - the
product's name, its licence and its copyright line - are held to their Go
originals by a guard.

Usage:
python .github/scripts/build_packages.py --tag v0.4.0 \\
Expand Down Expand Up @@ -50,6 +51,11 @@
APP_NAME = "Testing Files Generator"
LICENCE = "GPL-3.0-only"

# The line tfg license prints, held by a guard to internal/version/version.go.
# Chocolatey's moderation asked for it in the nuspec after 0.4.0, and it
# refuses one shorter than four characters (rule CPMR0001).
COPYRIGHT = "Copyright (C) 2026 DonislawDev"

# The name both feeds show as the author, and the first part of the WinGet
# identifiers - the same publisher folder the sibling project already has in
# winget-pkgs.
Expand Down Expand Up @@ -258,6 +264,7 @@ def values(package, version, tag, sums):
"EXE": package.program + ".exe",
"MONIKER": package.moniker,
"LICENSE": LICENCE,
"COPYRIGHT": COPYRIGHT,
"REPO_URL": repo_url,
"PROJECT_URL": site(),
"DOCS_URL": site() + "docs/",
Expand Down
32 changes: 32 additions & 0 deletions internal/guard/packaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,38 @@ func TestThePackagesNameTheProductAndLicenceTheProgramDoes(t *testing.T) {
}
}

// Every package carries, once, the copyright line tfg license prints.
// Chocolatey's moderation asked for it after 0.4.0 and refuses one shorter than
// four characters (rule CPMR0001), and winget show prints it. Read from what
// the renderer wrote rather than from its copy, so a template that loses the
// element fails here as surely as a copy that drifts from the program.
func TestEveryPackageCarriesTheCopyrightTheProgramPrints(t *testing.T) {
lines := regexp.MustCompile(`(?m)^Copyright \(C\) .+$`).FindAllString(
readRepoFile(t, "internal/version/version.go"), -1)
if len(lines) != 1 {
t.Fatalf("internal/version/version.go holds %d copyright lines, not one - "+
"there is no single line to hold the packages to", len(lines))
}
nuspec := `<copyright>([^<]*)</copyright>`
locale := `(?m)^Copyright: (.*)$`
files := renderedPackages(t)
for _, pkg := range []struct{ file, pattern string }{
{windowChoco + "testing-files-generator.nuspec", nuspec},
{cliChoco + "testing-files-generator-cli.nuspec", nuspec},
{windowWinget + ".locale.en-US.yaml", locale},
{cliWinget + ".locale.en-US.yaml", locale},
} {
found := regexp.MustCompile(pkg.pattern).FindAllStringSubmatch(files[pkg.file], -1)
if len(found) != 1 {
t.Errorf("%s carries %d copyright lines, not one", pkg.file, len(found))
continue
}
if found[0][1] != lines[0] {
t.Errorf("%s gives the copyright as %q and tfg license as %q", pkg.file, found[0][1], lines[0])
}
}
}

// The package sources are in git. Chocolatey's moderation asks packageSourceUrl
// to point at them, the job in ci.yml renders them on a fresh clone, and the
// point of a package source is that somebody else can see what the package
Expand Down
5 changes: 3 additions & 2 deletions packaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ These are **templates**, not packages. Every `{{PLACEHOLDER}}` is filled by
`.github/scripts/build_packages.py` from the one place that owns the value: the
version from the release tag, the checksums from that release's
`verify-SHA256SUMS.txt`, the addresses from `go.mod` and `web/public/CNAME`, the
release date from `CHANGELOG.md`. The two values the renderer keeps a copy of,
the product name and the licence, are held to their Go originals by a guard.
release date from `CHANGELOG.md`. The three values the renderer keeps a copy
of, the product name, the licence and the copyright line, are held to their Go
originals by a guard.

python .github/scripts/build_packages.py --tag v0.4.0 \
--sums verify-SHA256SUMS.txt --out <a directory outside the repository>
Expand Down
1 change: 1 addition & 0 deletions packaging/chocolatey/package.nuspec.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<projectUrl>{{PROJECT_URL}}</projectUrl>
<iconUrl>{{ICON_URL}}</iconUrl>
<licenseUrl>{{LICENSE_URL}}</licenseUrl>
<copyright>{{COPYRIGHT}}</copyright>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectSourceUrl>{{REPO_URL}}</projectSourceUrl>
<docsUrl>{{DOCS_URL}}</docsUrl>
Expand Down
1 change: 1 addition & 0 deletions packaging/winget/locale.en-US.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PackageName: {{TITLE}}
PackageUrl: {{PROJECT_URL}}
License: {{LICENSE}}
LicenseUrl: {{LICENSE_URL}}
Copyright: {{COPYRIGHT}}
ShortDescription: {{SHORT_DESCRIPTION}}
Description: |-
{{DESCRIPTION}}
Expand Down
Loading