2021-09-03 21:07:02 +00:00
|
|
|
package misc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2022-04-21 04:30:33 +00:00
|
|
|
"github.com/rocky-linux/srpmproc/pkg/data"
|
2021-09-03 21:07:02 +00:00
|
|
|
"regexp"
|
|
|
|
)
|
|
|
|
|
2022-04-21 04:30:33 +00:00
|
|
|
func GetTagImportRegex(pd *data.ProcessData) *regexp.Regexp {
|
|
|
|
branchRegex := fmt.Sprintf("%s%d%s", pd.ImportBranchPrefix, pd.Version, pd.BranchSuffix)
|
2022-04-21 05:25:44 +00:00
|
|
|
if !pd.StrictBranchMode {
|
2022-04-21 23:44:18 +00:00
|
|
|
branchRegex += "(?:.+|)"
|
2021-09-03 21:07:02 +00:00
|
|
|
}
|
2022-04-21 04:30:33 +00:00
|
|
|
regex := fmt.Sprintf("refs/tags/(imports/(%s)/(.*))", branchRegex)
|
|
|
|
|
|
|
|
return regexp.MustCompile(regex)
|
2021-09-03 21:07:02 +00:00
|
|
|
}
|