diff --git a/proto_package.go b/proto_package.go index 1e2505e..9cf650f 100644 --- a/proto_package.go +++ b/proto_package.go @@ -336,8 +336,14 @@ func (p *ProtoPackage) setupBuildDir() (string, error) { return "", err } + gitlabPath := reReplaceSinglePlus.ReplaceAllString(p.Pkgbase, "$1-$2") + gitlabPath = reReplaceRemainingPlus.ReplaceAllString(gitlabPath, "plus") + gitlabPath = reReplaceSpecialChars.ReplaceAllString(gitlabPath, "-") + gitlabPath = reReplaceUnderscore.ReplaceAllString(gitlabPath, "-") + gitlabPath = reReplaceTree.ReplaceAllString(gitlabPath, "unix-tree") + cmd := exec.Command("git", "clone", "--depth", "1", "--branch", p.State.TagVer, - fmt.Sprintf("https://gitlab.archlinux.org/archlinux/packaging/packages/%s.git", p.Pkgbase), buildDir) + fmt.Sprintf("https://gitlab.archlinux.org/archlinux/packaging/packages/%s.git", gitlabPath), buildDir) res, err := cmd.CombinedOutput() log.Debug(string(res)) if err != nil { diff --git a/utils.go b/utils.go index 4e6379d..84c1635 100644 --- a/utils.go +++ b/utils.go @@ -36,15 +36,20 @@ const ( ) var ( - reVar = regexp.MustCompile(`(?mU)^#?[^\S\r\n]*(\w+)[^\S\r\n]*=[^\S\r\n]*([("])([^)"]*)([)"])[^\S\r\n]*$`) - reEnvClean = regexp.MustCompile(`(?m) ([\s\\]+) `) - rePkgRel = regexp.MustCompile(`(?m)^pkgrel\s*=\s*(.+)$`) - rePkgFile = regexp.MustCompile(`^(.+)(?:-.+){2}-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`) - reLdError = regexp.MustCompile(`(?mi).*collect2: error: ld returned (\d+) exit status.*`) - reDownloadError = regexp.MustCompile(`(?m)^error: could not rename .+$`) - rePortError = regexp.MustCompile(`(?m)^OSError: \x5bErrno 98\x5d Address already in use$`) - reSigError = regexp.MustCompile(`(?m)^error: .*: signature from .* is invalid$`) - reRustLTOError = regexp.MustCompile(`(?m)^error: options \x60-C (.+)\x60 and \x60-C lto\x60 are incompatible$`) + reVar = regexp.MustCompile(`(?mU)^#?[^\S\r\n]*(\w+)[^\S\r\n]*=[^\S\r\n]*([("])([^)"]*)([)"])[^\S\r\n]*$`) + reEnvClean = regexp.MustCompile(`(?m) ([\s\\]+) `) + rePkgRel = regexp.MustCompile(`(?m)^pkgrel\s*=\s*(.+)$`) + rePkgFile = regexp.MustCompile(`^(.+)(?:-.+){2}-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`) + reLdError = regexp.MustCompile(`(?mi).*collect2: error: ld returned (\d+) exit status.*`) + reDownloadError = regexp.MustCompile(`(?m)^error: could not rename .+$`) + rePortError = regexp.MustCompile(`(?m)^OSError: \x5bErrno 98\x5d Address already in use$`) + reSigError = regexp.MustCompile(`(?m)^error: .*: signature from .* is invalid$`) + reRustLTOError = regexp.MustCompile(`(?m)^error: options \x60-C (.+)\x60 and \x60-C lto\x60 are incompatible$`) + reReplaceSinglePlus = regexp.MustCompile(`(?m)([a-zA-Z0-9]+)\+([a-zA-Z]+)`) + reReplaceRemainingPlus = regexp.MustCompile(`(?m)\+`) + reReplaceSpecialChars = regexp.MustCompile(`(?m)[^a-zA-Z0-9_\-.]`) + reReplaceUnderscore = regexp.MustCompile(`(?m)[_\-]{2,}`) + reReplaceTree = regexp.MustCompile(`(?m)^tree$`) ) type Conf struct {