Skip to content

Commit 5eaf8c3

Browse files
committed
Extend default debian/gbp.conf with extra security config tips
When creating a new package, populate the git-buildpackage with additional configs and in-line comments on why and how to use them. This will make go packaging easier, more consistent and more secure as the best practices flow to all packages via good defaults. Contents is in line with the template used by `dh-make` version 2.202503.
1 parent 9fbf9e3 commit 5eaf8c3

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

template.go

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,42 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error {
341341
fmt.Fprintf(f, "dist = DEP14\n")
342342
}
343343
if pristineTar {
344-
fmt.Fprintf(f, "pristine-tar = True\n")
345-
}
344+
fmt.Fprintf(f, `
345+
# Enable pristine-tar to exactly reproduce orig tarballs
346+
pristine-tar = True
347+
348+
`)
349+
}
350+
351+
// Additional text to the template which is useful for 99% of the go packages
352+
fmt.Fprint(f, `
353+
# Lax requirement to use branch name 'debian/latest' so that git-buildpackage
354+
# will always build using the currently checked out branch as the Debian branch.
355+
# This makes it easier for contributors to work with feature and bugfix
356+
# branches.
357+
ignore-branch = True
358+
359+
# The Debian packaging git repository may also host actual upstream tags and
360+
# branches, typically named 'main' or 'master'. Configure the upstream tag
361+
# format below, so that 'gbp import-orig' will run correctly, and link tarball
362+
# import branch ('upstream/latest') with the equivalent upstream release tag,
363+
# showing a complete audit trail of what upstream released and what was imported
364+
# into Debian.
365+
#
366+
# TODO: Most Go packages have tags of form 'v1.0.0', but must be double-checked.
367+
upstream-vcs-tag = v%(version%~%-)s
368+
369+
# If upstream publishes tarball signatures, git-buildpackage will by default
370+
# import and use the them. Change this to 'on' to make 'gbp import-orig' abort
371+
# if the signature is not found or is not valid.
372+
#
373+
# Most Go packages don't publish signatures for the tarball releases, so this is
374+
# not enabled by default.
375+
#upstream-signatures = on
376+
377+
# Ensure the Debian maintainer signs git tags automatically.
378+
sign-tags = True
379+
`)
346380
return nil
347381
}
348382

0 commit comments

Comments
 (0)