fix(redhat): fix detection method of changelog scan (#628)

fix(redhat, deepscan): fix detection method of changelog scan
This commit is contained in:
Kota Kanbe
2018-03-29 21:17:44 +09:00
committed by GitHub
parent baa0e897b2
commit ce56261b52
2 changed files with 43 additions and 27 deletions

View File

@@ -604,9 +604,11 @@ func (o *redhat) fillDiffChangelogs(packNames []string) error {
if found {
diff, err := o.getDiffChangelog(pack, changelogs[s])
detectionMethod := models.ChangelogExactMatchStr
var detectionMethod string
if err != nil {
if err == nil {
detectionMethod = models.ChangelogExactMatchStr
} else {
o.log.Debug(err)
// Try without epoch
if index := strings.Index(pack.Version, ":"); 0 < index {
@@ -616,12 +618,24 @@ func (o *redhat) fillDiffChangelogs(packNames []string) error {
if err != nil {
o.log.Debugf("Failed to find the version in changelog: %s-%s-%s",
pack.Name, pack.Version, pack.Release)
detectionMethod = models.FailedToFindVersionInChangelog
if len(diff) == 0 {
detectionMethod = models.FailedToGetChangelog
} else {
detectionMethod = models.FailedToFindVersionInChangelog
diff = ""
}
} else {
o.log.Debugf("Found the version in changelog without epoch: %s-%s-%s",
pack.Name, pack.Version, pack.Release)
detectionMethod = models.ChangelogLenientMatchStr
}
} else {
if len(diff) == 0 {
detectionMethod = models.FailedToGetChangelog
} else {
detectionMethod = models.FailedToFindVersionInChangelog
diff = ""
}
}
}