|
| 1 | +From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= < [email protected]> |
| 2 | +Date: Tue, 19 Nov 2024 22:21:58 -0800 |
| 3 | +Subject: Use DEP-14 branch names `debian/latest` and `upstream/latest` |
| 4 | + |
| 5 | +In DEP-14, the preferred branch name for the Debian packaging target |
| 6 | +branch is `debian/latest` and the preferred name for the upstream import |
| 7 | +target branch is `upstream/latest`. |
| 8 | + |
| 9 | +Note that the upstream development branch name can be whatever and |
| 10 | +should stay as it is upstream, typically `main` or `master`. The branch |
| 11 | +`upstream/latest` should not point to the latest upstream development |
| 12 | +commit, but to the latest commit that was used as the upstream release |
| 13 | +that the Debian revision was derived from. |
| 14 | +--- |
| 15 | + make.go | 14 +++++++++----- |
| 16 | + template.go | 3 ++- |
| 17 | + 2 files changed, 11 insertions(+), 6 deletions(-) |
| 18 | + |
| 19 | +diff --git a/make.go b/make.go |
| 20 | +index 14f267f..74e45e3 100644 |
| 21 | +--- a/make.go |
| 22 | ++++ b/make.go |
| 23 | +@@ -416,7 +416,8 @@ func runGitCommandIn(dir string, arg ...string) error { |
| 24 | + } |
| 25 | + |
| 26 | + func createGitRepository(debsrc, gopkg, orig string, u *upstream, |
| 27 | +- includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string, pristineTar bool) (string, error) { |
| 28 | ++ includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string, |
| 29 | ++ dep14 bool, pristineTar bool) (string, error) { |
| 30 | + wd, err := os.Getwd() |
| 31 | + if err != nil { |
| 32 | + return "", fmt.Errorf("get cwd: %w", err) |
| 33 | +@@ -462,7 +463,7 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream, |
| 34 | + |
| 35 | + // Preconfigure branches |
| 36 | + |
| 37 | +- branches := []string{debianBranch, "upstream"} |
| 38 | ++ branches := []string{debianBranch, "upstream/latest"} |
| 39 | + if pristineTar { |
| 40 | + branches = append(branches, "pristine-tar") |
| 41 | + } |
| 42 | +@@ -496,6 +497,9 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream, |
| 43 | + // Import upstream orig tarball |
| 44 | + |
| 45 | + arg := []string{"import-orig", "--no-interactive", "--debian-branch=" + debianBranch} |
| 46 | ++ if dep14 { |
| 47 | ++ arg = append(arg, "--upstream-branch=upstream/latest") |
| 48 | ++ } |
| 49 | + if pristineTar { |
| 50 | + arg = append(arg, "--pristine-tar") |
| 51 | + } |
| 52 | +@@ -754,7 +758,7 @@ func execMake(args []string, usage func()) { |
| 53 | + fs.BoolVar(&dep14, |
| 54 | + "dep14", |
| 55 | + true, |
| 56 | +- "Follow DEP-14 branch naming and use debian/sid (instead of master)\n"+ |
| 57 | ++ "Follow DEP-14 branch naming and use debian/latest (instead of master)\n"+ |
| 58 | + "as the default debian-branch.") |
| 59 | + |
| 60 | + var pristineTar bool |
| 61 | +@@ -864,7 +868,7 @@ func execMake(args []string, usage func()) { |
| 62 | + // Set the debian branch. |
| 63 | + debBranch := "master" |
| 64 | + if dep14 { |
| 65 | +- debBranch = "debian/sid" |
| 66 | ++ debBranch = "debian/latest" |
| 67 | + } |
| 68 | + |
| 69 | + switch strings.TrimSpace(wrapAndSort) { |
| 70 | +@@ -955,7 +959,7 @@ func execMake(args []string, usage func()) { |
| 71 | + |
| 72 | + debversion := u.version + "-1" |
| 73 | + |
| 74 | +- dir, err := createGitRepository(debsrc, gopkg, orig, u, includeUpstreamHistory, allowUnknownHoster, debBranch, pristineTar) |
| 75 | ++ dir, err := createGitRepository(debsrc, gopkg, orig, u, includeUpstreamHistory, allowUnknownHoster, debBranch, dep14, pristineTar) |
| 76 | + if err != nil { |
| 77 | + log.Fatalf("Could not create git repository: %v\n", err) |
| 78 | + } |
| 79 | +diff --git a/template.go b/template.go |
| 80 | +index 78c2ba9..0e356c5 100644 |
| 81 | +--- a/template.go |
| 82 | ++++ b/template.go |
| 83 | +@@ -342,7 +342,8 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error { |
| 84 | + |
| 85 | + fmt.Fprintf(f, "[DEFAULT]\n") |
| 86 | + if dep14 { |
| 87 | +- fmt.Fprintf(f, "debian-branch = debian/sid\n") |
| 88 | ++ fmt.Fprintf(f, "debian-branch = debian/latest\n") |
| 89 | ++ fmt.Fprintf(f, "upstream-branch = upstream/latest\n") |
| 90 | + fmt.Fprintf(f, "dist = DEP14\n") |
| 91 | + } |
| 92 | + if pristineTar { |
0 commit comments