github.com/pojntfx/hydrapp/hydrapp@v0.0.0-20240516002902-d08759d6ca9f/pkg/renderers/rpm/spec.go (about) 1 package rpm 2 3 import ( 4 _ "embed" 5 "time" 6 7 "github.com/pojntfx/hydrapp/hydrapp/pkg/renderers" 8 ) 9 10 //go:embed spec.spec 11 var specTemplate string 12 13 type specData struct { 14 AppID string 15 AppName string 16 AppDescription string 17 AppSummary string 18 AppSPDX string 19 AppURL string 20 AppReleases []renderers.Release 21 ExtraPackages []Package 22 GoMain string 23 GoFlags string 24 GoGenerate string 25 BranchTimestampUNIX int64 26 } 27 28 type Package struct { 29 Name string `json:"name" yaml:"name"` 30 Version string `json:"version" yaml:"version"` 31 } 32 33 func NewSpecRenderer( 34 appID string, 35 appName string, 36 appDescription string, 37 appSummary string, 38 appSPDX string, 39 appURL string, 40 appReleases []renderers.Release, 41 extraPackages []Package, 42 goMain string, 43 goFlags string, 44 goGenerate string, 45 branchTimestamp time.Time, 46 ) renderers.Renderer { 47 return renderers.NewRenderer( 48 appID+".spec", 49 specTemplate, 50 specData{appID, appName, appDescription, appSummary, appSPDX, appURL, appReleases, extraPackages, goMain, goFlags, goGenerate, branchTimestamp.Unix()}, 51 ) 52 }