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

Fix 107 #153

Merged
merged 3 commits into from
Aug 26, 2021
Merged
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
35 changes: 18 additions & 17 deletions make.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func runGitCommandIn(dir string, arg ...string) error {
}

func createGitRepository(debsrc, gopkg, orig string, u *upstream,
includeUpstreamHistory, allowUnknownHoster, dep14, pristineTar bool) (string, error) {
includeUpstreamHistory bool, allowUnknownHoster bool, debianBranch string, pristineTar bool) (string, error) {
wd, err := os.Getwd()
if err != nil {
return "", err
Expand All @@ -392,14 +392,17 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
return "", err
}

// "git init -b" is the one-liner we need here, however it was added in Git 2.28.
// For now we prefer to keep compatibility with older Git, so we do it in two
// rounds, "git init" then "git checkout".
//if err := runGitCommandIn(dir, "init", "-b", debianBranch); err != nil {
// return dir, err
//}
if err := runGitCommandIn(dir, "init"); err != nil {
return dir, err
}

if dep14 {
if err := runGitCommandIn(dir, "checkout", "-q", "-b", "debian/sid"); err != nil {
return dir, err
}
if err := runGitCommandIn(dir, "checkout", "-q", "-b", debianBranch); err != nil {
return dir, err
}

// Set repository options
Expand Down Expand Up @@ -434,12 +437,6 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,

// Preconfigure branches

var debianBranch string
if dep14 {
debianBranch = "debian/sid"
} else {
debianBranch = "master"
}
branches := []string{debianBranch, "upstream"}
if pristineTar {
branches = append(branches, "pristine-tar")
Expand Down Expand Up @@ -470,10 +467,7 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,

// Import upstream orig tarball

arg := []string{"import-orig", "--no-interactive"}
if dep14 {
arg = append(arg, "--debian-branch=debian/sid")
}
arg := []string{"import-orig", "--no-interactive", "--debian-branch=" + debianBranch}
if pristineTar {
arg = append(arg, "--pristine-tar")
}
Expand Down Expand Up @@ -843,6 +837,12 @@ func execMake(args []string, usage func()) {
log.Fatalf("-type=%q not recognized, aborting\n", pkgTypeString)
}

// Set the debian branch.
debBranch := "master"
if dep14 {
debBranch = "debian/sid"
}

switch strings.TrimSpace(wrapAndSort) {
case "a":
// Current default, also what "cme fix dpkg" generates
Expand Down Expand Up @@ -929,7 +929,7 @@ func execMake(args []string, usage func()) {

debversion := u.version + "-1"

dir, err := createGitRepository(debsrc, gopkg, orig, u, includeUpstreamHistory, allowUnknownHoster, dep14, pristineTar)
dir, err := createGitRepository(debsrc, gopkg, orig, u, includeUpstreamHistory, allowUnknownHoster, debBranch, pristineTar)
if err != nil {
log.Fatalf("Could not create git repository: %v\n", err)
}
Expand Down Expand Up @@ -991,6 +991,7 @@ func execMake(args []string, usage func()) {
fmt.Printf(" dh-make-golang create-salsa-project %s\n", debsrc)
fmt.Printf("\n")
fmt.Printf("Once you are happy with your packaging, push it to salsa using:\n")
fmt.Printf(" git push origin %s\n", debBranch)
fmt.Printf(" gbp push\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, however I'm still not sure about gbp push. As per the man page and the bug report, it is clearly indicated that gbp push is intended to be run after uploading a Debian package to the archive. In the bug report Guido suggest simply running git push when there was no release.

Adding a --tips flag to gbp push has been suggested here but looks not implemented atm.

Personally, I'm doing a git push --all && git push --tags in order to push all the branches and the tags to the Salsa repository. I wonder what the rest of the team think about that. @zhsj any opinion on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's clear that the gbp push workflow doesn't work here. However I would much prefer implementing a dh-make-golang push command. And I don't like git push --tags since it pushes all upstream tags which are not needed, for example upstream have v1.0.0 -> v10.0.0 tags, while we only need upstream/10.0.0 tag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, so this dh-make-golang push command should be running a git push origin to push the branches and then push all the tags beginning by upstream/ ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably like gbp push, but allow to push wip debian branch:

  • git push origin debian/sid
  • git push origin upstream
  • git push origin upstream/<tag>
  • (optional) git push origin pristine-tar
  • (optional) git push origin debian/<tag>

While I'm writing above, I find it forces dh-make-golang to parse gbp.conf to see the upstream branch name ..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great ideas everyone! I like how @elboulangero has improved the code too. As I am preparing for a v0.5.0 release today, I think I will go ahead and merge this PR now while @zhsj continues to work on dh-make-golang push. Many thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks all for the review and feedback!

fmt.Printf("\n")

Expand Down