Skip to content

Commit 0bdd05c

Browse files
committed
Put build artifacts in debian/build/ to avoid polluting upstream sources
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/`.
1 parent 049cf81 commit 0bdd05c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

template.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func writeDebianGitIgnore(dir, debLib, debProg string, pkgType packageType) erro
8686
fmt.Fprintf(f, "*.log\n")
8787
fmt.Fprintf(f, "*.substvars\n")
8888
fmt.Fprintf(f, "/.debhelper/\n")
89+
fmt.Fprintf(f, "/build/\n")
8990
fmt.Fprintf(f, "/debhelper-build-stamp\n")
9091
fmt.Fprintf(f, "/files\n")
9192

@@ -299,7 +300,12 @@ func writeDebianRules(dir string, pkgType packageType) error {
299300
fmt.Fprintf(f, "#!/usr/bin/make -f\n")
300301
fmt.Fprintf(f, "\n")
301302
fmt.Fprintf(f, "%%:\n")
302-
fmt.Fprintf(f, "\tdh $@ --builddirectory=_build --buildsystem=golang\n")
303+
fmt.Fprintf(f, "\tdh $@ --builddirectory=debian/build --buildsystem=golang\n")
304+
// Note: The above `--builddirectory=debian/build` will eventually be obsolete
305+
// in 2028+ then the dh-golang version 1.63+ that has
306+
// https://salsa.debian.org/go-team/packages/dh-golang/-/commit/bc16dff5381b668a71fa99c381baba202c34c789
307+
// is in use everywhere
308+
303309
if pkgType == typeProgram {
304310
fmt.Fprintf(f, "\n")
305311
fmt.Fprintf(f, "override_dh_auto_install:\n")

0 commit comments

Comments
 (0)