summaryrefslogtreecommitdiff
path: root/control.write.go
diff options
context:
space:
mode:
Diffstat (limited to 'control.write.go')
-rw-r--r--control.write.go109
1 files changed, 0 insertions, 109 deletions
diff --git a/control.write.go b/control.write.go
deleted file mode 100644
index b161430..0000000
--- a/control.write.go
+++ /dev/null
@@ -1,109 +0,0 @@
-package main
-
-/*
-The default order to write the fields in the control file:
-
-root@mirrors:/home/mirrors/debian/pool/main/m/moon-buggy# dpkg -I moon-buggy_1.0.51-15_arm64.deb
- new Debian package, version 2.0.
- size 196540 bytes: control archive=6240 bytes.
- 202 bytes, 12 lines * config #!/bin/sh
- 601 bytes, 14 lines control
- 1020 bytes, 15 lines md5sums
- 1757 bytes, 59 lines * postinst #!/bin/sh
- 551 bytes, 22 lines * postrm #!/bin/sh
- 11703 bytes, 104 lines templates
- Package: moon-buggy
- Version: 1:1.0.51-15
- Architecture: arm64
- Maintainer: Christian T. Steigies <[email protected]>
- Installed-Size: 329
- Depends: debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.34), libncurses6 (>= 6), libtinfo6 (>= 6)
- Conflicts: moon-buggy-pause, suidmanager (<< 0.50)
- Section: games
- Priority: optional
- Homepage: http://seehuhn.de/pages/moon-buggy
- Description: Drive a car across the moon
- Moon-buggy is a simple character graphics game, where you drive some
- kind of car across the moon's surface. Unfortunately there are
- dangerous craters there. Fortunately your car can jump over them!
-*/
-
-/*
-func writeDebianControlFile(repo *gitpb.Repo) bool {
- filename := "files/DEBIAN/control"
- cf, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
- if err != nil {
- log.Info("open control file failed", err)
- return false
- }
- fmt.Fprintln(cf, "Package:", repo.Control["Package"]) // c.Package.String())
- // never do Source as it has something to do with where aptly puts the files
- // fmt.Fprintln(cf, "Source:", repo.Control["Source"]) // c.Source.String())
- fmt.Fprintln(cf, "Version:", repo.Control["Version"])
- if repo.Control["Architecture"] == "" {
- repo.Control["Architecture"] = argv.Arch
- }
- fmt.Fprintln(cf, "Architecture:", repo.Control["Architecture"]) // c.Architecture.String())
-
- writeControlVar(cf, repo, "Maintainer")
- fmt.Fprintln(cf, "Installed-Size::", "2097152") // fixme. du -s files/
- writeControlVar(cf, repo, "Depends")
- writeControlVar(cf, repo, "Build-Depends")
- writeControlVar(cf, repo, "Conflicts")
- writeControlVar(cf, repo, "Packager")
- writeControlVar(cf, repo, "GoPath")
- writeControlVar(cf, repo, "URL")
-
- t := time.Now()
- // update to now now despite what the GUI is showing
- fmt.Fprintln(cf, "Package-Build-Date:", cobol.Time(t))
- fmt.Fprintln(cf, "Git-Tag-Date:", "go-deb todo: get this from git")
-
- desc, _ := repo.Control["Description"] // c.Description.String()
- parts := strings.Split(desc, "\n")
- fmt.Fprintln(cf, "Description:", strings.Join(parts, "\n "))
-
- log.Info("file written as:", filename)
- return true
-}
-
-func writeControlVar(f *os.File, repo *gitpb.Repo, varname string) {
- val, _ := repo.Control[varname]
- if val == "" {
- return
- }
- // fix this when this code is rewritten to use the .proto
- if varname == "URL" {
- varname = "Homepage"
- }
- fmt.Fprintln(f, varname+":", val)
-}
-
-// try to guess or figure out the config file values
-// if there is not a control file
-func computeControlValues(repo *gitpb.Repo) bool {
- if repo.Control["Package"] == "" {
- // get the package name from the repo name
- path := repo.Control["pathL"] // c.pathL.String()
- parts := strings.Split(path, "/")
- name := parts[len(parts)-1]
- repo.Control["Package"] = name
- }
- if repo.Control["Source"] == "" {
- repo.Control["Source"] = repo.Control["Package"]
- }
- if repo.Control["Build-Depends"] == "" {
- repo.Control["Build-Depends"] = repo.Control["golang"]
- }
- if repo.Control["Recommends"] == "" {
- repo.Control["Recommends"] = repo.Control["go-gui-toolkits"]
- }
- if repo.Control["Maintainer"] == "" {
- repo.Control["Maintainer"] = "todo: get from ENV"
- }
- if repo.Control["Description"] == "" {
- repo.Control["Description"] = "todo: put URL here"
- }
- return true
-}
-*/