aboutsummaryrefslogtreecommitdiff
path: root/cmd/yeet/internal
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/yeet/internal
parentd035c875a14f5ea10a3f6f95453a0f6b4bac77b6 (diff)
downloadx-45b660e400c72c7a5a641889386d445ffe1ce202.tar.xz
x-45b660e400c72c7a5a641889386d445ffe1ce202.zip
cmd/yeet: fixups
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/yeet/internal')
-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
3 files changed, 35 insertions, 8 deletions
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"`
}