@@ -43,6 +43,9 @@ func writeTemplates(dir, gopkg, debsrc, debLib, debProg, debversion string,
43
43
if err := writeDebianPackageInstall (dir , debLib , debProg , pkgType ); err != nil {
44
44
return err
45
45
}
46
+ if err := writeDebianGitLabCI (dir ); err != nil {
47
+ return err
48
+ }
46
49
return nil
47
50
}
48
51
@@ -101,21 +104,21 @@ func addDescription(f *os.File, gopkg, comment string) {
101
104
func addLibraryPackage (f * os.File , gopkg , debLib string , dependencies []string ) {
102
105
fmt .Fprintf (f , "\n " )
103
106
fmt .Fprintf (f , "Package: %s\n " , debLib )
104
- deps := []string {"${misc:Depends}" }
105
107
fmt .Fprintf (f , "Architecture: all\n " )
106
- deps = append ( deps , dependencies ... )
108
+ deps := dependencies
107
109
sort .Strings (deps )
110
+ deps = append (deps , "${misc:Depends}" )
108
111
fprintfControlField (f , "Depends" , deps )
109
112
addDescription (f , gopkg , "(library)" )
110
113
}
111
114
112
115
func addProgramPackage (f * os.File , gopkg , debProg string , dependencies []string ) {
113
116
fmt .Fprintf (f , "\n " )
114
117
fmt .Fprintf (f , "Package: %s\n " , debProg )
115
- deps := []string {"${misc:Depends}" }
116
118
fmt .Fprintf (f , "Architecture: any\n " )
117
- deps = append ( deps , "${shlibs:Depends}" )
119
+ deps := dependencies
118
120
sort .Strings (deps )
121
+ deps = append (deps , "${misc:Depends}" , "${shlibs:Depends}" )
119
122
fprintfControlField (f , "Depends" , deps )
120
123
fmt .Fprintf (f , "Built-Using: ${misc:Built-Using}\n " )
121
124
addDescription (f , gopkg , "(program)" )
@@ -358,3 +361,44 @@ func writeDebianPackageInstall(dir, debLib, debProg string, pkgType packageType)
358
361
}
359
362
return nil
360
363
}
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