aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-03-31 07:50:11 -0400
committerXe Iaso <me@xeiaso.net>2025-03-31 07:50:11 -0400
commit45b660e400c72c7a5a641889386d445ffe1ce202 (patch)
treea03a2d8b15f782d8da2cedca6836744cf97539f8 /cmd
parentd035c875a14f5ea10a3f6f95453a0f6b4bac77b6 (diff)
downloadx-45b660e400c72c7a5a641889386d445ffe1ce202.tar.xz
x-45b660e400c72c7a5a641889386d445ffe1ce202.zip
cmd/yeet: fixups
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/yeet/fly.go16
-rw-r--r--cmd/yeet/internal/mkdeb/mkdeb.go15
-rw-r--r--cmd/yeet/internal/mkrpm/mkrpm.go23
-rw-r--r--cmd/yeet/internal/pkgmeta/package.go5
-rw-r--r--cmd/yeet/var/.gitignore2
-rw-r--r--cmd/yeet/yeetfile.js52
6 files changed, 76 insertions, 37 deletions
diff --git a/cmd/yeet/fly.go b/cmd/yeet/fly.go
deleted file mode 100644
index b079bbc..0000000
--- a/cmd/yeet/fly.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package main
-
-import (
- "fmt"
- "log/slog"
-)
-
-type flySlogger struct{}
-
-func (flySlogger) Debug(v ...any) {
- slog.Debug("fly logs", "vals", fmt.Sprint(v...))
-}
-
-func (flySlogger) Debugf(format string, v ...any) {
- slog.Debug("fly logs", "vals", fmt.Sprintf(format, v...))
-}
diff --git a/cmd/yeet/internal/mkdeb/mkdeb.go b/cmd/yeet/internal/mkdeb/mkdeb.go
index 2d8d663..8f9279a 100644
--- a/cmd/yeet/internal/mkdeb/mkdeb.go
+++ b/cmd/yeet/internal/mkdeb/mkdeb.go
@@ -28,6 +28,9 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
}
}()
+ os.MkdirAll("./var", 0755)
+ os.WriteFile(filepath.Join("./var", ".gitignore"), []byte("*\n!.gitignore"), 0644)
+
if p.Version == "" {
p.Version = internal.GitVersion()
}
@@ -62,6 +65,14 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
contents = append(contents, &files.Content{Type: files.TypeConfig, Source: repoPath, Destination: osPath})
}
+ for repoPath, rpmPath := range p.Documentation {
+ contents = append(contents, &files.Content{
+ Type: files.TypeFile,
+ Source: repoPath,
+ Destination: filepath.Join("/usr/share/doc", p.Name, rpmPath),
+ })
+ }
+
if err := filepath.Walk(dir, func(path string, stat os.FileInfo, err error) error {
if err != nil {
return err
@@ -111,7 +122,7 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
}
foutpath = pkg.ConventionalFileName(info)
- fout, err := os.Create(foutpath)
+ fout, err := os.Create(filepath.Join("./var", foutpath))
if err != nil {
return "", fmt.Errorf("mkdeb: can't create output file: %w", err)
}
@@ -121,7 +132,7 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
return "", fmt.Errorf("mkdeb: can't build package: %w", err)
}
- slog.Debug("built package", "name", p.Name, "version", p.Version, "path", foutpath)
+ slog.Info("built package", "name", p.Name, "arch", p.Goarch, "version", p.Version, "path", fout.Name())
return foutpath, err
}
diff --git a/cmd/yeet/internal/mkrpm/mkrpm.go b/cmd/yeet/internal/mkrpm/mkrpm.go
index b682ad7..33b7937 100644
--- a/cmd/yeet/internal/mkrpm/mkrpm.go
+++ b/cmd/yeet/internal/mkrpm/mkrpm.go
@@ -28,6 +28,9 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
}
}()
+ os.MkdirAll("./var", 0755)
+ os.WriteFile(filepath.Join("./var", ".gitignore"), []byte("*\n!.gitignore"), 0644)
+
if p.Version == "" {
p.Version = internal.GitVersion()
}
@@ -59,7 +62,19 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
}
for repoPath, rpmPath := range p.ConfigFiles {
- contents = append(contents, &files.Content{Type: files.TypeConfig, Source: repoPath, Destination: rpmPath})
+ contents = append(contents, &files.Content{
+ Type: files.TypeConfig,
+ Source: repoPath,
+ Destination: rpmPath,
+ })
+ }
+
+ for repoPath, rpmPath := range p.Documentation {
+ contents = append(contents, &files.Content{
+ Type: files.TypeRPMDoc,
+ Source: repoPath,
+ Destination: filepath.Join("/usr/share/doc", p.Name, rpmPath),
+ })
}
if err := filepath.Walk(dir, func(path string, stat os.FileInfo, err error) error {
@@ -101,7 +116,7 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
if *internal.GPGKeyID != "" {
slog.Debug("using GPG key", "file", *internal.GPGKeyFile, "id", *internal.GPGKeyID, "password", *internal.GPGKeyPassword)
info.Overridables.RPM.Signature.KeyFile = *internal.GPGKeyFile
- info.Overridables.RPM.Signature.KeyID = *&internal.GPGKeyID
+ info.Overridables.RPM.Signature.KeyID = internal.GPGKeyID
info.Overridables.RPM.Signature.KeyPassphrase = *internal.GPGKeyPassword
}
@@ -111,7 +126,7 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
}
foutpath = pkg.ConventionalFileName(info)
- fout, err := os.Create(foutpath)
+ fout, err := os.Create(filepath.Join("./var", foutpath))
if err != nil {
return "", fmt.Errorf("mkrpm: can't create output file: %w", err)
}
@@ -121,7 +136,7 @@ func Build(p pkgmeta.Package) (foutpath string, err error) {
return "", fmt.Errorf("mkrpm: can't build package: %w", err)
}
- slog.Debug("built package", "name", p.Name, "version", p.Version, "path", foutpath)
+ slog.Info("built package", "name", p.Name, "arch", p.Goarch, "version", p.Version, "path", fout.Name())
return foutpath, err
}
diff --git a/cmd/yeet/internal/pkgmeta/package.go b/cmd/yeet/internal/pkgmeta/package.go
index b5d7fcb..056af3b 100644
--- a/cmd/yeet/internal/pkgmeta/package.go
+++ b/cmd/yeet/internal/pkgmeta/package.go
@@ -12,8 +12,9 @@ type Package struct {
Depends []string `json:"depends"`
Recommends []string `json:"recommends"`
- EmptyDirs []string `json:"emptyDirs"` // rpm destination path
- ConfigFiles map[string]string `json:"configFiles"` // repo-relative source path, rpm destination path
+ EmptyDirs []string `json:"emptyDirs"` // rpm destination path
+ ConfigFiles map[string]string `json:"configFiles"` // repo-relative source path, rpm destination path
+ Documentation map[string]string `json:"documentation"` // repo-relative source path, file in /usr/share/doc/$Name
Build func(out string) `json:"build"`
}
diff --git a/cmd/yeet/var/.gitignore b/cmd/yeet/var/.gitignore
new file mode 100644
index 0000000..c96a04f
--- /dev/null
+++ b/cmd/yeet/var/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore \ No newline at end of file
diff --git a/cmd/yeet/yeetfile.js b/cmd/yeet/yeetfile.js
index da0f265..7969ef7 100644
--- a/cmd/yeet/yeetfile.js
+++ b/cmd/yeet/yeetfile.js
@@ -1,15 +1,41 @@
go.install();
-["amd64", "arm64"].forEach(goarch => {
- [deb, rpm].forEach(method => method.build({
- name: "yeet",
- description: "Yeet out actions with maximum haste!",
- homepage: "https://within.website",
- license: "CC0",
- goarch,
-
- build: (out) => {
- go.build("-o", `${out}/usr/bin/yeet`);
- },
- }));
-}); \ No newline at end of file
+yeet.setenv("GOARM", "7");
+
+[
+ // "386",
+ "amd64",
+ // "arm",
+ "arm64",
+ // "loong64",
+ // "mips",
+ // "mips64",
+ // "mips64le",
+ // "mipsle",
+ "riscv64",
+ // "ppc64",
+ // "ppc64le",
+ // "s390x",
+]
+ .forEach(goarch => {
+ [
+ deb,
+ rpm,
+ ]
+ .forEach(method => method.build({
+ name: "yeet",
+ description: "Yeet out actions with maximum haste!",
+ homepage: "https://within.website",
+ license: "CC0",
+ goarch,
+
+ documentation: {
+ "README.md": "README.md",
+ "../../LICENSE": "LICENSE",
+ },
+
+ build: (out) => {
+ go.build("-o", `${out}/usr/bin/yeet`);
+ },
+ }));
+ }); \ No newline at end of file