mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-18 08:58:30 +00:00
Add support for unusual NVRs to yumrepofs
Signed-off-by: Mustafa Gezen <mustafa@ctrliq.com>
This commit is contained in:
parent
d3e5d9ea92
commit
6848798e1b
@ -357,6 +357,8 @@ func (c *Controller) RpmImportActivity(ctx context.Context, req *peridotpb.RpmIm
|
||||
if nvr == "" && rpmObj.Architecture() == "i686" {
|
||||
nvr = realNvr
|
||||
}
|
||||
|
||||
break
|
||||
} else {
|
||||
if nvr != rpmObj.SourceRPM() && nvr != fmt.Sprintf("%s.rpm", realNvr) {
|
||||
return nil, fmt.Errorf("only include RPMs from one package")
|
||||
@ -367,7 +369,12 @@ func (c *Controller) RpmImportActivity(ctx context.Context, req *peridotpb.RpmIm
|
||||
return nil, fmt.Errorf("invalid SNVR: %s", nvr)
|
||||
}
|
||||
|
||||
nvrMatch := rpmutils.NVR().FindStringSubmatch(nvr)
|
||||
var nvrMatch []string
|
||||
if rpmutils.NVRUnusualRelease().MatchString(nvr) {
|
||||
nvrMatch = rpmutils.NVRUnusualRelease().FindStringSubmatch(nvr)
|
||||
} else {
|
||||
nvrMatch = rpmutils.NVR().FindStringSubmatch(nvr)
|
||||
}
|
||||
srcNvra := fmt.Sprintf("%s-%s-%s.src", nvrMatch[1], nvrMatch[2], nvrMatch[3])
|
||||
|
||||
beginTx, err := c.db.Begin()
|
||||
|
@ -227,8 +227,13 @@ func GenerateArchMapForArtifacts(artifacts models.TaskArtifacts, project *models
|
||||
for i, artifact := range artifacts {
|
||||
var name string
|
||||
var arch string
|
||||
if rpmutils.NVR().MatchString(filepath.Base(artifact.Name)) {
|
||||
nvr := rpmutils.NVR().FindStringSubmatch(filepath.Base(artifact.Name))
|
||||
base := strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm")
|
||||
if rpmutils.NVRUnusualRelease().MatchString(base) {
|
||||
nvr := rpmutils.NVRUnusualRelease().FindStringSubmatch(base)
|
||||
name = nvr[1]
|
||||
arch = nvr[4]
|
||||
} else if rpmutils.NVR().MatchString(base) {
|
||||
nvr := rpmutils.NVR().FindStringSubmatch(base)
|
||||
name = nvr[1]
|
||||
arch = nvr[4]
|
||||
}
|
||||
@ -324,7 +329,6 @@ func GenerateArchMapForArtifacts(artifacts models.TaskArtifacts, project *models
|
||||
artifactArchMap[arch] = append(artifactArchMap[arch], &newArtifact)
|
||||
}
|
||||
} else {
|
||||
arch := artifact.Arch
|
||||
if composetools.IsDebugPackage(name) {
|
||||
arch = arch + "-debug"
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import "regexp"
|
||||
var (
|
||||
nvr *regexp.Regexp
|
||||
nvrNoArch *regexp.Regexp
|
||||
nvrUnusualRelease *regexp.Regexp
|
||||
epoch *regexp.Regexp
|
||||
module *regexp.Regexp
|
||||
dist *regexp.Regexp
|
||||
@ -56,6 +57,13 @@ func NVRNoArch() *regexp.Regexp {
|
||||
return nvrNoArch
|
||||
}
|
||||
|
||||
func NVRUnusualRelease() *regexp.Regexp {
|
||||
if nvrUnusualRelease == nil {
|
||||
nvrUnusualRelease = regexp.MustCompile("^(\\S+)-([\\w~%.+]+)-(\\w+?)(?:\\.(\\w+))?(?:\\.rpm)?$")
|
||||
}
|
||||
return nvrUnusualRelease
|
||||
}
|
||||
|
||||
func Epoch() *regexp.Regexp {
|
||||
if epoch == nil {
|
||||
epoch = regexp.MustCompile("(\\d+):")
|
||||
|
Loading…
Reference in New Issue
Block a user