MCPcopy
hub / github.com/syncthing/syncthing / buildDeb

Function buildDeb

build.go:595–662  ·  view source on GitHub ↗
(target target, tags []string)

Source from the content-addressed store, hash-verified

593}
594
595func buildDeb(target target, tags []string) {
596 os.RemoveAll("deb")
597
598 // "goarch" here is set to whatever the Debian packages expect. We correct
599 // it to what we actually know how to build and keep the Debian variant
600 // name in "debarch".
601 debarch := goarch
602 switch goarch {
603 case "i386":
604 goarch = "386"
605 case "armel", "armhf":
606 goarch = "arm"
607 }
608
609 build(target, append(tags, "noupgrade"))
610
611 for i := range target.installationFiles {
612 target.installationFiles[i].src = strings.Replace(target.installationFiles[i].src, "{{binary}}", target.BinaryName(), 1)
613 target.installationFiles[i].dst = strings.Replace(target.installationFiles[i].dst, "{{binary}}", target.BinaryName(), 1)
614 }
615
616 for _, af := range target.installationFiles {
617 if err := copyFile(af.src, af.dst, af.perm); err != nil {
618 log.Fatal(err)
619 }
620 }
621
622 maintainer := "Syncthing Release Management <release@syncthing.net>"
623 debver := version
624 if strings.HasPrefix(debver, "v") {
625 debver = debver[1:]
626 // Debian interprets dashes as separator between main version and
627 // Debian package version, and thus thinks 0.14.26-rc.1 is better
628 // than just 0.14.26. This rectifies that.
629 debver = strings.Replace(debver, "-", "~", -1)
630 }
631 if strings.Contains(debver, "_") {
632 debver = strings.Replace(debver, "_", "~", -1)
633 }
634 args := []string{
635 "-t", "deb",
636 "-s", "dir",
637 "-C", "deb",
638 "-n", target.debname,
639 "-v", debver,
640 "-a", debarch,
641 "-m", maintainer,
642 "--vendor", maintainer,
643 "--description", target.description,
644 "--url", "https://syncthing.net/",
645 "--license", "MPL-2",
646 }
647 for _, dep := range target.debdeps {
648 args = append(args, "-d", dep)
649 }
650 if target.systemdService != "" {
651 debpost, err := createPostInstScript(target)
652 defer os.Remove(debpost)

Callers 1

runCommandFunction · 0.85

Calls 9

buildFunction · 0.90
createPostInstScriptFunction · 0.85
runPrintFunction · 0.85
BinaryNameMethod · 0.80
FatalMethod · 0.80
ContainsMethod · 0.80
copyFileFunction · 0.70
RemoveAllMethod · 0.65
RemoveMethod · 0.65

Tested by

no test coverage detected