mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2025-01-09 09:50:55 +00:00
19 lines
446 B
Go
19 lines
446 B
Go
package misc
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/rocky-linux/srpmproc/pkg/data"
|
|
"regexp"
|
|
)
|
|
|
|
func GetTagImportRegex(pd *data.ProcessData) *regexp.Regexp {
|
|
branchRegex := fmt.Sprintf("%s%d%s", pd.ImportBranchPrefix, pd.Version, pd.BranchSuffix)
|
|
if !pd.StrictBranchMode {
|
|
branchRegex += "(?:.+|)"
|
|
} else {
|
|
branchRegex += "(?:-stream-.+|)"
|
|
}
|
|
regex := fmt.Sprintf("refs/tags/(imports/(%s)/(.*))", branchRegex)
|
|
|
|
return regexp.MustCompile(regex)
|
|
}
|