From cc75c2dd6cfbaa301e2b1890256ddb367b0bf151 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 11 Sep 2025 18:39:59 -0500 Subject: [PATCH] fixes for packages without control files --- readControlFile.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/readControlFile.go b/readControlFile.go index b53a79d..6518ca1 100644 --- a/readControlFile.go +++ b/readControlFile.go @@ -3,6 +3,7 @@ package main import ( "bufio" "os" + "path/filepath" "strings" "unicode" @@ -34,7 +35,6 @@ func readControlFile(repo *gitpb.Repo) error { log.Warn("readControlFile() could not find the file") // return errors.New("'control': file not found") // if this happens, make up a fake control file - pairs["Maintainer"] = "go-deb build" pairs["Architecture"] = "amd64" // TODO: figure this out pairs["Recommends"] = "" pairs["Source"] = "notsure" @@ -43,6 +43,21 @@ func readControlFile(repo *gitpb.Repo) error { } else { pairs["Description"] = me.repo.GetGoPath() } + if repo.Control == nil { + repo.Control = make(map[string]string) + } + for key, value := range pairs { + repo.Control[key] = value + } + if os.Getenv("GIT_AUTHOR_NAME") != "" { + author := log.Sprintf("%s <%s>", os.Getenv("GIT_AUTHOR_NAME"), os.Getenv("GIT_AUTHOR_EMAIL")) + repo.Control["Packager"] = author + } + _, fname := filepath.Split(repo.GetFullPath()) + repo.Control["Package"] = fname + repo.Control["Version"] = trimNonNumericPrefix(repo.GetCurrentVersion()) + repo.Control["URL"] = repo.URL + return nil } defer file.Close()