summaryrefslogtreecommitdiff
path: root/control.write.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-09 20:29:37 -0500
committerJeff Carr <[email protected]>2025-10-09 20:29:37 -0500
commitadcc1c506a038e965b2172ebfd2809d0d5d8a4a9 (patch)
tree528cdfc770791d6c226262993e4c48e528f6d42a /control.write.go
parent8e00d326078a7d65655ce3938123a4b2003c5168 (diff)
more work on a standard library for all of thisv0.22.161v0.22.160
Diffstat (limited to 'control.write.go')
-rw-r--r--control.write.go36
1 files changed, 34 insertions, 2 deletions
diff --git a/control.write.go b/control.write.go
index 3c0ef7c..52c74d6 100644
--- a/control.write.go
+++ b/control.write.go
@@ -12,6 +12,34 @@ import (
"go.wit.com/log"
)
+/*
+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)
@@ -28,13 +56,13 @@ func writeDebianControlFile(repo *gitpb.Repo) bool {
}
fmt.Fprintln(cf, "Architecture:", repo.Control["Architecture"]) // c.Architecture.String())
+ writeControlVar(cf, repo, "Maintainer")
writeControlVar(cf, repo, "Depends")
writeControlVar(cf, repo, "Build-Depends")
- writeControlVar(cf, repo, "Maintainer")
+ writeControlVar(cf, repo, "Conflicts")
writeControlVar(cf, repo, "Packager")
writeControlVar(cf, repo, "GoPath")
writeControlVar(cf, repo, "URL")
- writeControlVar(cf, repo, "Conflicts")
stamp := time.Now().UTC().Format("2006/01/02 15:04:05 UTC")
// update to now now despite what the GUI is showing
@@ -54,6 +82,10 @@ func writeControlVar(f *os.File, repo *gitpb.Repo, varname string) {
if val == "" {
return
}
+ // fix this when this code is rewritten to use the .proto
+ if varname == "URL" {
+ varname = "Homepage"
+ }
fmt.Fprintln(f, varname+":", val)
}