Skip to content

Commit c6fdafd

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 a6fe7fa commit c6fdafd

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

template.go

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

0 commit comments

Comments
 (0)