forked from Debian/dh-make-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
debian/patches/0002-Always-call-upstream-git-remote-upstreamvcs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= <[email protected]> | ||
Date: Thu, 21 Nov 2024 00:18:30 -0800 | ||
Subject: Always call upstream git remote `upstreamvcs` | ||
|
||
Instead of using various different upstream remote names, use the one and | ||
same upstream git remote name consistently. As the name pick `upstreamvcs` | ||
just as git-buildpackage does, so that if anybody runs `gbp clone` they | ||
will automatically end up with the same git remotes and branches as anyone | ||
in to go-team. | ||
--- | ||
make.go | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/make.go b/make.go | ||
index b768095..7b6f8d2 100644 | ||
--- a/make.go | ||
+++ b/make.go | ||
@@ -482,7 +482,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream, | ||
} | ||
|
||
if includeUpstreamHistory { | ||
- u.remote, err = shortHostName(gopkg, allowUnknownHoster) | ||
+ // Always call the upstream git remote 'upstreamvcs' just like git-buildpackage does | ||
+ u.remote = "upstreamvcs" | ||
if err != nil { | ||
return dir, fmt.Errorf("unable to fetch upstream history: %q", err) | ||
} |
47 changes: 47 additions & 0 deletions
47
debian/patches/0003-Extend-default-debian-gbp.conf-with-extra-security-c.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= <[email protected]> | ||
Date: Thu, 21 Nov 2024 00:20:25 -0800 | ||
Subject: 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. | ||
--- | ||
template.go | 24 ++++++++++++++++++++++++ | ||
1 file changed, 24 insertions(+) | ||
|
||
diff --git a/template.go b/template.go | ||
index 74cca68..f60eb13 100644 | ||
--- a/template.go | ||
+++ b/template.go | ||
@@ -344,6 +344,30 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error { | ||
if pristineTar { | ||
fmt.Fprintf(f, "pristine-tar = True\n") | ||
} | ||
+ | ||
+ // Additional text to the template which is useful for 99% of the go packages | ||
+ // NOTE: The v%%(version%%~%%.)s will print v%(version%~%.)s | ||
+ fmt.Fprintf(f, ` | ||
+# Lax requirement to use branch name 'debian/latest' so that git-buildpackage | ||
+# will always build using the currently checked out branch as the Debian branch. | ||
+# This makes it easier for contributors to work with feature and bugfix | ||
+# branches. | ||
+ignore-branch = True | ||
+ | ||
+# Configure the upstream tag format below, so that 'gbp import-orig' will run | ||
+# correctly, and link tarball import branch ('upstream/latest') with the | ||
+# equivalent upstream release tag, showing a complete audit trail of what | ||
+# upstream released and what was imported into Debian. | ||
+# | ||
+# Most go packages have tags of form 'v1.0.0' | ||
+#upstream-vcs-tag = v%%(version%%~%%.)s | ||
+ | ||
+# Check that upstream signed git tags (options: auto|on|off) | ||
+#upstream-signatures = on | ||
+ | ||
+# Ensure the Debian maintainer signs git tags automatically | ||
+#sign-tags = True | ||
+`) | ||
return nil | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
debian/patches/0004-Stop-modifying-upstream-.gitignore-file.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= <[email protected]> | ||
Date: Thu, 21 Nov 2024 00:23:12 -0800 | ||
Subject: Stop modifying upstream .gitignore file | ||
|
||
The fact that Debian builds produce extra files in the build directory | ||
is a separate concern and should not be managed by .gitignores in upstream | ||
directory. Anyways, the list is not going to be complete on most packages, | ||
and instead of extending the list, a better practice is to have proper | ||
`make clean` rules in the `debian/rules`, or to simply run `git clean -fdx` | ||
between builds. Additionally, everyone should be using `gbp pq` to update | ||
patches instead of legacy Quilt, so no more `.pc` directories should be | ||
generated. | ||
--- | ||
make.go | 23 ----------------------- | ||
1 file changed, 23 deletions(-) | ||
|
||
diff --git a/make.go b/make.go | ||
index 7b6f8d2..b5376ff 100644 | ||
--- a/make.go | ||
+++ b/make.go | ||
@@ -520,29 +520,6 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream, | ||
return dir, fmt.Errorf("import-orig: %w", err) | ||
} | ||
|
||
- { | ||
- f, err := os.OpenFile(filepath.Join(dir, ".gitignore"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) | ||
- if err != nil { | ||
- return dir, fmt.Errorf("open .gitignore: %w", err) | ||
- } | ||
- // Beginning newline in case the file already exists and lacks a newline | ||
- // (not all editors enforce a newline at the end of the file): | ||
- if _, err := f.Write([]byte("\n/.pc/\n/_build/\n")); err != nil { | ||
- return dir, fmt.Errorf("write to .gitignore: %w", err) | ||
- } | ||
- if err := f.Close(); err != nil { | ||
- return dir, fmt.Errorf("close .gitignore: %w", err) | ||
- } | ||
- } | ||
- | ||
- if err := runGitCommandIn(dir, "add", ".gitignore"); err != nil { | ||
- return dir, fmt.Errorf("git add .gitignore: %w", err) | ||
- } | ||
- | ||
- if err := runGitCommandIn(dir, "commit", "-m", "Ignore _build and quilt .pc dirs via .gitignore"); err != nil { | ||
- return dir, fmt.Errorf("git commit (.gitignore): %w", err) | ||
- } | ||
- | ||
return dir, nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
0001-Use-DEP-14-branch-names-debian-latest-and-upstream-l.patch | ||
0002-Always-call-upstream-git-remote-upstreamvcs.patch | ||
0003-Extend-default-debian-gbp.conf-with-extra-security-c.patch | ||
0004-Stop-modifying-upstream-.gitignore-file.patch |