Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DEP-14 branch names debian/latest and upstream/latest, and upstream vcs remote name 'upstreamvcs' #247

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions make.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,16 @@ func runGitCommandIn(dir string, arg ...string) error {
}

func createGitRepository(debsrc, gopkg, orig string, u *upstream,
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string, pristineTar bool) (string, error) {
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string,
dep14 bool, pristineTar bool) (string, error) {

// debianBranch is passed in function call, but upstream import branch needs
// also to be defined
upstreamImportBranch := "upstream"
if dep14 {
upstreamImportBranch = "upstream/latest"
}

wd, err := os.Getwd()
if err != nil {
return "", fmt.Errorf("get cwd: %w", err)
Expand Down Expand Up @@ -462,7 +471,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,

// Preconfigure branches

branches := []string{debianBranch, "upstream"}
branches := []string{debianBranch, upstreamImportBranch}

if pristineTar {
branches = append(branches, "pristine-tar")
}
Expand All @@ -476,13 +486,8 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
}

if includeUpstreamHistory {
u.remote, err = shortHostName(gopkg, allowUnknownHoster)
if err != nil {
return dir, fmt.Errorf("unable to fetch upstream history: %q", err)
}
if u.remote == "debian" {
u.remote = "salsa"
}
// Always call the upstream git remote 'upstreamvcs' just like git-buildpackage does
u.remote = "upstreamvcs"
log.Printf("Adding remote %q with URL %q\n", u.remote, u.rr.Repo)
if err := runGitCommandIn(dir, "remote", "add", u.remote, u.rr.Repo); err != nil {
return dir, fmt.Errorf("git remote add %s %s: %w", u.remote, u.rr.Repo, err)
Expand All @@ -494,8 +499,14 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
}

// Import upstream orig tarball
// (and release git tag if includeUpstreamHistory)

arg := []string{"import-orig", "--no-interactive", "--debian-branch=" + debianBranch}
arg := []string{
"import-orig",
"--no-interactive",
"--debian-branch=" + debianBranch,
"--upstream-branch=" + upstreamImportBranch,
}
if pristineTar {
arg = append(arg, "--pristine-tar")
}
Expand Down Expand Up @@ -777,7 +788,7 @@ func execMake(args []string, usage func()) {
fs.BoolVar(&dep14,
"dep14",
true,
"Follow DEP-14 branch naming and use debian/sid (instead of master)\n"+
"Follow DEP-14 branch naming and use debian/latest (instead of master)\n"+
"as the default debian-branch.")

var pristineTar bool
Expand Down Expand Up @@ -887,7 +898,7 @@ func execMake(args []string, usage func()) {
// Set the debian branch.
debBranch := "master"
if dep14 {
debBranch = "debian/sid"
debBranch = "debian/latest"
}

switch strings.TrimSpace(wrapAndSort) {
Expand Down Expand Up @@ -978,7 +989,7 @@ func execMake(args []string, usage func()) {

debversion := u.version + "-1"

dir, err := createGitRepository(debsrc, gopkg, orig, u, includeUpstreamHistory, allowUnknownHoster, debBranch, pristineTar)
dir, err := createGitRepository(debsrc, gopkg, orig, u, includeUpstreamHistory, allowUnknownHoster, debBranch, dep14, pristineTar)
if err != nil {
log.Fatalf("Could not create git repository: %v\n", err)
}
Expand Down
3 changes: 2 additions & 1 deletion template.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error {

fmt.Fprintf(f, "[DEFAULT]\n")
if dep14 {
fmt.Fprintf(f, "debian-branch = debian/sid\n")
fmt.Fprintf(f, "debian-branch = debian/latest\n")
fmt.Fprintf(f, "upstream-branch = upstream/latest\n")
fmt.Fprintf(f, "dist = DEP14\n")
}
if pristineTar {
Expand Down
Loading