Skip to content

Commit 7abe1e9

Browse files
committed
Put build artifacts in debian/.build/upstream 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 the `debian/` subdirectory along with all other Debian build artifacts.
1 parent 9fbf9e3 commit 7abe1e9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

template.go

Lines changed: 6 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,11 @@ 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/upstream --buildsystem=golang\n")
304+
// Note: The above `--builddirectory=debian/.build/upstream` will eventually be obsolete
305+
// in 2028+ then the dh-golang version 1.64+ that has merged
306+
// https://salsa.debian.org/go-team/packages/dh-golang/-/merge_requests/26
307+
303308
if pkgType == typeProgram {
304309
fmt.Fprintf(f, "\n")
305310
fmt.Fprintf(f, "override_dh_auto_install:\n")

0 commit comments

Comments
 (0)