Skip to content

Commit 2419ed6

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 adapted from the template used by `dh-make` version 2.202503.
1 parent 7350c39 commit 2419ed6

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

template.go

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,42 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error {
356356
fmt.Fprintf(f, "dist = DEP14\n")
357357
}
358358
if pristineTar {
359-
fmt.Fprintf(f, "pristine-tar = True\n")
359+
fmt.Fprintf(f, `
360+
361+
# Enable pristine-tar for git-buildpackage to exactly reproduce orig tarballs
362+
pristine-tar = True
363+
`)
360364
}
365+
366+
// Additional text to the template which is useful for most Go packages
367+
fmt.Fprint(f, `
368+
369+
# Enable git-buildpackage to build using the currently checked out branch as if
370+
# it was the Debian branch. This makes it easier for contributors to develop and
371+
# test using feature/bugfix branches.
372+
ignore-branch = True
373+
374+
# The Debian packaging git repository may also host actual upstream tags and
375+
# branches, typically named 'main' or 'master'. Configure the upstream tag
376+
# format below, so that 'gbp import-orig --uscan' will run correctly, and link
377+
# the tarball import branch ('upstream/latest') with the equivalent upstream
378+
# release tag, showing a complete audit trail of what upstream released and what
379+
# was imported into Debian.
380+
#
381+
# TODO: Most Go packages have tags of form 'v1.0.0', but must be double-checked.
382+
#upstream-vcs-tag = v%(version%~%-)s
383+
384+
# If upstream publishes tarball signatures, git-buildpackage will by default
385+
# import and use the them. Change this to 'on' to make 'gbp import-orig' abort
386+
# if the signature is not found or is not valid.
387+
#
388+
# Most Go packages don't publish signatures for the tarball releases, so this is
389+
# not enabled by default.
390+
#upstream-signatures = on
391+
392+
# Ensure the Debian maintainer signs git tags automatically.
393+
#sign-tags = True
394+
`)
361395
return nil
362396
}
363397

0 commit comments

Comments
 (0)