Skip to content

Commit

Permalink
Add epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
mindscratch authored Jan 9, 2018
1 parent a9cd160 commit 400856f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rpm/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Package struct {
Version string `json:"version,omitempty"`
Arch string `json:"arch,omitempty"`
Release string `json:"release,omitempty"`
Epoch string `json:"epoch,omitempty"`
Group string `json:"group,omitempty"`
License string `json:"license,omitempty"`
URL string `json:"url,omitempty"`
Expand Down Expand Up @@ -106,6 +107,9 @@ func (p *Package) Normalize(arch string, version string) error {
if p.Release == "" {
p.Release = "1"
}
if p.Epoch == "" {
p.Epoch = "0"
}
if p.Version == "" {
p.Version = version
}
Expand All @@ -120,6 +124,7 @@ func (p *Package) Normalize(arch string, version string) error {
logger.Printf("Arch=%s\n", p.Arch)
logger.Printf("Version=%s\n", p.Version)
logger.Printf("Release=%s\n", p.Release)
logger.Printf("Epoch=%s\n", p.Epoch)
logger.Printf("URL=%s\n", p.URL)
logger.Printf("Summary=%s\n", p.Summary)
logger.Printf("Description=%s\n", p.Description)
Expand Down Expand Up @@ -285,6 +290,9 @@ func (p *Package) GenerateSpecFile(sourceDir string) (string, error) {
if p.Version != "" {
spec += fmt.Sprintf("Version: %s\n", okVersion)
}
if p.Epoch != "0" {
spec += fmt.Sprintf("Epoch: %s\n", p.Epoch)
}
if p.Release != "" {
spec += fmt.Sprintf("Release: %s\n", preRelease)
}
Expand Down

0 comments on commit 400856f

Please sign in to comment.