Skip to content

Commit

Permalink
Put build artifacts in debian/build/ to avoid polluting upstream so…
Browse files Browse the repository at this point in the history
…urces

Instead of putting build artifacts in `_build/` at the project root,
where they pollute the upstream sources and lure some people to also
modify the upstream `.gitignore` file, put it in `debian/build/` along
with all other build artifacts that get generated in `debian/`.
  • Loading branch information
ottok committed Jan 19, 2025
1 parent 049cf81 commit 0bdd05c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion template.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func writeDebianGitIgnore(dir, debLib, debProg string, pkgType packageType) erro
fmt.Fprintf(f, "*.log\n")
fmt.Fprintf(f, "*.substvars\n")
fmt.Fprintf(f, "/.debhelper/\n")
fmt.Fprintf(f, "/build/\n")
fmt.Fprintf(f, "/debhelper-build-stamp\n")
fmt.Fprintf(f, "/files\n")

Expand Down Expand Up @@ -299,7 +300,12 @@ func writeDebianRules(dir string, pkgType packageType) error {
fmt.Fprintf(f, "#!/usr/bin/make -f\n")
fmt.Fprintf(f, "\n")
fmt.Fprintf(f, "%%:\n")
fmt.Fprintf(f, "\tdh $@ --builddirectory=_build --buildsystem=golang\n")
fmt.Fprintf(f, "\tdh $@ --builddirectory=debian/build --buildsystem=golang\n")
// Note: The above `--builddirectory=debian/build` will eventually be obsolete
// in 2028+ then the dh-golang version 1.63+ that has
// https://salsa.debian.org/go-team/packages/dh-golang/-/commit/bc16dff5381b668a71fa99c381baba202c34c789
// is in use everywhere

if pkgType == typeProgram {
fmt.Fprintf(f, "\n")
fmt.Fprintf(f, "override_dh_auto_install:\n")
Expand Down

0 comments on commit 0bdd05c

Please sign in to comment.