@@ -46,6 +46,9 @@ func writeTemplates(dir, gopkg, debsrc, debLib, debProg, debversion string,
46
46
if err := writeDebianPackageInstall (dir , debLib , debProg , pkgType ); err != nil {
47
47
return err
48
48
}
49
+ if err := writeDebianUpstreamMetadata (dir , gopkg ); err != nil {
50
+ return err
51
+ }
49
52
50
53
if err := writeDebianGbpConf (dir , dep14 , pristineTar ); err != nil {
51
54
return err
@@ -377,6 +380,37 @@ func writeDebianPackageInstall(dir, debLib, debProg string, pkgType packageType)
377
380
return nil
378
381
}
379
382
383
+ func writeDebianUpstreamMetadata (dir , gopkg string ) error {
384
+ // TODO: Support other hosters too
385
+ host := "github.com"
386
+
387
+ owner , repo , err := findGitHubRepo (gopkg )
388
+ if err != nil {
389
+ log .Printf ("debian/upstream/metadata: Unable to resolve %s to github.com, skipping\n " , gopkg )
390
+ return nil
391
+ }
392
+ if ! strings .HasPrefix (gopkg , "github.com/" ) {
393
+ log .Printf ("debian/upstream/metadata: %s resolves to %s/%s/%s\n " , gopkg , host , owner , repo )
394
+ }
395
+
396
+ if err := os .Mkdir (filepath .Join (dir , "debian" , "upstream" ), 0755 ); err != nil {
397
+ return err
398
+ }
399
+ f , err := os .Create (filepath .Join (dir , "debian" , "upstream" , "metadata" ))
400
+ if err != nil {
401
+ return err
402
+ }
403
+ defer f .Close ()
404
+
405
+ fmt .Fprintf (f , "---\n " )
406
+ fmt .Fprintf (f , "Bug-Database: https://%s/%s/%s/issues\n " , host , owner , repo )
407
+ fmt .Fprintf (f , "Bug-Submit: https://%s/%s/%s/issues/new\n " , host , owner , repo )
408
+ fmt .Fprintf (f , "Repository: https://%s/%s/%s.git\n " , host , owner , repo )
409
+ fmt .Fprintf (f , "Repository-Browse: https://%s/%s/%s\n " , host , owner , repo )
410
+
411
+ return nil
412
+ }
413
+
380
414
func writeDebianGitLabCI (dir string ) error {
381
415
const gitlabciymlTmpl = `# auto-generated, DO NOT MODIFY.
382
416
# The authoritative copy of this file lives at:
0 commit comments