fixes for packages without control files
This commit is contained in:
parent
95d1f6fc7c
commit
5dd26dc488
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue