Skip to content

Commit 4d14f0a

Browse files
committed
New upstream version 0.3.1
2 parents c1cf2e9 + 88748fe commit 4d14f0a

File tree

2 files changed

+80
-8
lines changed

2 files changed

+80
-8
lines changed

make.go

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,19 +410,48 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
410410
if err := runGitCommandIn(dir, "config", "push.default", "matching"); err != nil {
411411
return dir, err
412412
}
413+
414+
// [remote "origin"]
415+
416+
originURL := "[email protected]:go-team/packages/" + debsrc + ".git"
417+
log.Printf("Adding remote \"origin\" with URL %q\n", originURL)
418+
if err := runGitCommandIn(dir, "remote", "add", "origin", originURL); err != nil {
419+
return dir, err
420+
}
413421
if err := runGitCommandIn(dir, "config", "--add", "remote.origin.push", "+refs/heads/*:refs/heads/*"); err != nil {
414422
return dir, err
415423
}
416424
if err := runGitCommandIn(dir, "config", "--add", "remote.origin.push", "+refs/tags/*:refs/tags/*"); err != nil {
417425
return dir, err
418426
}
419427

428+
// Preconfigure branches
429+
430+
var debianBranch string
431+
if dep14 {
432+
debianBranch = "debian/sid"
433+
} else {
434+
debianBranch = "master"
435+
}
436+
branches := []string{debianBranch, "upstream"}
437+
if pristineTar {
438+
branches = append(branches, "pristine-tar")
439+
}
440+
for _, branch := range branches {
441+
if err := runGitCommandIn(dir, "config", "branch."+branch+".remote", "origin"); err != nil {
442+
return dir, err
443+
}
444+
if err := runGitCommandIn(dir, "config", "branch."+branch+".merge", "refs/heads/"+branch); err != nil {
445+
return dir, err
446+
}
447+
}
448+
420449
if includeUpstreamHistory {
421450
u.remote, err = shortHostName(gopkg, allowUnknownHoster)
422451
if err != nil {
423452
return dir, fmt.Errorf("Unable to fetch upstream history: %q", err)
424453
}
425-
log.Printf("Adding %q as remote %q\n", u.rr.Repo, u.remote)
454+
log.Printf("Adding remote %q with URL %q\n", u.remote, u.rr.Repo)
426455
if err := runGitCommandIn(dir, "remote", "add", u.remote, u.rr.Repo); err != nil {
427456
return dir, err
428457
}
@@ -543,7 +572,7 @@ func shortHostName(gopkg string, allowUnknownHoster bool) (host string, err erro
543572
default:
544573
if allowUnknownHoster {
545574
suffix, _ := publicsuffix.PublicSuffix(host)
546-
host = host[:len(host)-len(suffix)-len(".")]
575+
host = fqdn[:len(fqdn)-len(suffix)-len(".")]
547576
log.Printf("WARNING: Using %q as canonical hostname for %q. If that is not okay, please file a bug against %s.\n", host, fqdn, os.Args[0])
548577
} else {
549578
err = fmt.Errorf("unknown hoster %q", fqdn)
@@ -940,7 +969,7 @@ func execMake(args []string, usage func()) {
940969
}
941970
fmt.Printf("\n")
942971
fmt.Printf("Resolve all TODOs in %s, then email it out:\n", itpname)
943-
fmt.Printf(" sendmail -t < %s\n", itpname)
972+
fmt.Printf(" /usr/sbin/sendmail -t < %s\n", itpname)
944973
fmt.Printf("\n")
945974
fmt.Printf("Resolve all the TODOs in debian/, find them using:\n")
946975
fmt.Printf(" grep -r TODO debian\n")
@@ -953,7 +982,6 @@ func execMake(args []string, usage func()) {
953982
fmt.Printf(" dh-make-golang create-salsa-project %s\n", debsrc)
954983
fmt.Printf("\n")
955984
fmt.Printf("Once you are happy with your packaging, push it to salsa using:\n")
956-
fmt.Printf(" git remote set-url origin [email protected]:go-team/packages/%s.git\n", debsrc)
957985
fmt.Printf(" gbp push\n")
958986
fmt.Printf("\n")
959987

template.go

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func writeTemplates(dir, gopkg, debsrc, debLib, debProg, debversion string,
4343
if err := writeDebianPackageInstall(dir, debLib, debProg, pkgType); err != nil {
4444
return err
4545
}
46+
if err := writeDebianGitLabCI(dir); err != nil {
47+
return err
48+
}
4649
return nil
4750
}
4851

@@ -101,21 +104,21 @@ func addDescription(f *os.File, gopkg, comment string) {
101104
func addLibraryPackage(f *os.File, gopkg, debLib string, dependencies []string) {
102105
fmt.Fprintf(f, "\n")
103106
fmt.Fprintf(f, "Package: %s\n", debLib)
104-
deps := []string{"${misc:Depends}"}
105107
fmt.Fprintf(f, "Architecture: all\n")
106-
deps = append(deps, dependencies...)
108+
deps := dependencies
107109
sort.Strings(deps)
110+
deps = append(deps, "${misc:Depends}")
108111
fprintfControlField(f, "Depends", deps)
109112
addDescription(f, gopkg, "(library)")
110113
}
111114

112115
func addProgramPackage(f *os.File, gopkg, debProg string, dependencies []string) {
113116
fmt.Fprintf(f, "\n")
114117
fmt.Fprintf(f, "Package: %s\n", debProg)
115-
deps := []string{"${misc:Depends}"}
116118
fmt.Fprintf(f, "Architecture: any\n")
117-
deps = append(deps, "${shlibs:Depends}")
119+
deps := dependencies
118120
sort.Strings(deps)
121+
deps = append(deps, "${misc:Depends}", "${shlibs:Depends}")
119122
fprintfControlField(f, "Depends", deps)
120123
fmt.Fprintf(f, "Built-Using: ${misc:Built-Using}\n")
121124
addDescription(f, gopkg, "(program)")
@@ -358,3 +361,44 @@ func writeDebianPackageInstall(dir, debLib, debProg string, pkgType packageType)
358361
}
359362
return nil
360363
}
364+
365+
func writeDebianGitLabCI(dir string) error {
366+
const gitlabciymlTmpl = `# auto-generated, DO NOT MODIFY.
367+
# The authoritative copy of this file lives at:
368+
# https://salsa.debian.org/go-team/ci/blob/master/config/gitlabciyml.go
369+
370+
# TODO: publish under debian-go-team/ci
371+
image: stapelberg/ci2
372+
373+
test_the_archive:
374+
artifacts:
375+
paths:
376+
- before-applying-commit.json
377+
- after-applying-commit.json
378+
script:
379+
# Create an overlay to discard writes to /srv/gopath/src after the build:
380+
- "rm -rf /cache/overlay/{upper,work}"
381+
- "mkdir -p /cache/overlay/{upper,work}"
382+
- "mount -t overlay overlay -o lowerdir=/srv/gopath/src,upperdir=/cache/overlay/upper,workdir=/cache/overlay/work /srv/gopath/src"
383+
- "export GOPATH=/srv/gopath"
384+
- "export GOCACHE=/cache/go"
385+
# Build the world as-is:
386+
- "ci-build -exemptions=/var/lib/ci-build/exemptions.json > before-applying-commit.json"
387+
# Copy this package into the overlay:
388+
- "GBP_CONF_FILES=:debian/gbp.conf gbp buildpackage --git-no-pristine-tar --git-ignore-branch --git-ignore-new --git-export-dir=/tmp/export --git-no-overlay --git-tarball-dir=/nonexistant --git-cleaner=/bin/true --git-builder='dpkg-buildpackage -S -d --no-sign'"
389+
- "pgt-gopath -dsc /tmp/export/*.dsc"
390+
# Rebuild the world:
391+
- "ci-build -exemptions=/var/lib/ci-build/exemptions.json > after-applying-commit.json"
392+
- "ci-diff before-applying-commit.json after-applying-commit.json"
393+
`
394+
395+
f, err := os.Create(filepath.Join(dir, "debian", "gitlab-ci.yml"))
396+
if err != nil {
397+
return err
398+
}
399+
defer f.Close()
400+
401+
fmt.Fprintf(f, gitlabciymlTmpl)
402+
403+
return nil
404+
}

0 commit comments

Comments
 (0)