forked from ALHP/ALHP.GO
added workaround for pacsift printing warnings for valid pacman options
This commit is contained in:
@@ -445,6 +445,8 @@ func (p *ProtoPackage) isAvailable(h *alpm.Handle) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildManager.alpmMutex.Lock()
|
buildManager.alpmMutex.Lock()
|
||||||
|
defer buildManager.alpmMutex.Unlock()
|
||||||
|
|
||||||
var pkg alpm.IPackage
|
var pkg alpm.IPackage
|
||||||
switch {
|
switch {
|
||||||
case p.Srcinfo != nil:
|
case p.Srcinfo != nil:
|
||||||
@@ -458,14 +460,16 @@ func (p *ProtoPackage) isAvailable(h *alpm.Handle) bool {
|
|||||||
res, err = cmd.Output()
|
res, err = cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("error getting packages from pacsift for %s: %v", p.Pkgbase, err)
|
log.Warningf("error getting packages from pacsift for %s: %v", p.Pkgbase, err)
|
||||||
buildManager.alpmMutex.Unlock()
|
|
||||||
return false
|
return false
|
||||||
} else if len(res) == 0 {
|
} else if len(res) == 0 {
|
||||||
buildManager.alpmMutex.Unlock()
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(strings.Split(strings.TrimSpace(string(res)), "\n")) > 0 {
|
|
||||||
pacsiftLines := strings.Split(strings.TrimSpace(string(res)), "\n")
|
// workaround for https://github.com/andrewgregory/pacutils/issues/66
|
||||||
|
// TODO: remove once fixed
|
||||||
|
rRes := reReplacePacsiftWarning.ReplaceAllString(string(res), "")
|
||||||
|
if len(strings.Split(strings.TrimSpace(rRes), "\n")) > 0 {
|
||||||
|
pacsiftLines := strings.Split(strings.TrimSpace(rRes), "\n")
|
||||||
|
|
||||||
var splitPkgs []string
|
var splitPkgs []string
|
||||||
for _, line := range pacsiftLines {
|
for _, line := range pacsiftLines {
|
||||||
@@ -478,11 +482,9 @@ func (p *ProtoPackage) isAvailable(h *alpm.Handle) bool {
|
|||||||
pkg, err = dbs.FindSatisfier(splitPkgs[0])
|
pkg, err = dbs.FindSatisfier(splitPkgs[0])
|
||||||
} else {
|
} else {
|
||||||
log.Warningf("error getting packages from pacsift for %s", p.Pkgbase)
|
log.Warningf("error getting packages from pacsift for %s", p.Pkgbase)
|
||||||
buildManager.alpmMutex.Unlock()
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buildManager.alpmMutex.Unlock()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("error resolving %s: %v", p.Pkgbase, err)
|
log.Debugf("error resolving %s: %v", p.Pkgbase, err)
|
||||||
return false
|
return false
|
||||||
|
31
utils.go
31
utils.go
@@ -36,21 +36,22 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
reVar = regexp.MustCompile(`(?mU)^#?[^\S\r\n]*(\w+)[^\S\r\n]*=[^\S\r\n]*([("])([^)"]*)([)"])[^\S\r\n]*$`)
|
reVar = regexp.MustCompile(`(?mU)^#?[^\S\r\n]*(\w+)[^\S\r\n]*=[^\S\r\n]*([("])([^)"]*)([)"])[^\S\r\n]*$`)
|
||||||
reEnvClean = regexp.MustCompile(`(?m) ([\s\\]+) `)
|
reEnvClean = regexp.MustCompile(`(?m) ([\s\\]+) `)
|
||||||
rePkgRel = regexp.MustCompile(`(?m)^pkgrel\s*=\s*(.+)$`)
|
rePkgRel = regexp.MustCompile(`(?m)^pkgrel\s*=\s*(.+)$`)
|
||||||
rePkgFile = regexp.MustCompile(`^(.+)(?:-.+){2}-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`)
|
rePkgFile = regexp.MustCompile(`^(.+)(?:-.+){2}-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`)
|
||||||
reLdError = regexp.MustCompile(`(?mi).*collect2: error: ld returned (\d+) exit status.*`)
|
reLdError = regexp.MustCompile(`(?mi).*collect2: error: ld returned (\d+) exit status.*`)
|
||||||
reDownloadError = regexp.MustCompile(`(?m)^error: could not rename .+$`)
|
reDownloadError = regexp.MustCompile(`(?m)^error: could not rename .+$`)
|
||||||
reDownloadError2 = regexp.MustCompile(`(?m)^error: failed retrieving file '.+' from .*: The requested URL returned error: .+$`)
|
reDownloadError2 = regexp.MustCompile(`(?m)^error: failed retrieving file '.+' from .*: The requested URL returned error: .+$`)
|
||||||
rePortError = regexp.MustCompile(`(?m)^OSError: \x5bErrno 98\x5d Address already in use$`)
|
rePortError = regexp.MustCompile(`(?m)^OSError: \x5bErrno 98\x5d Address already in use$`)
|
||||||
reSigError = regexp.MustCompile(`(?m)^error: .*: signature from .* is invalid$`)
|
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$`)
|
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]+)`)
|
reReplaceSinglePlus = regexp.MustCompile(`(?m)([a-zA-Z0-9]+)\+([a-zA-Z]+)`)
|
||||||
reReplaceRemainingPlus = regexp.MustCompile(`(?m)\+`)
|
reReplaceRemainingPlus = regexp.MustCompile(`(?m)\+`)
|
||||||
reReplaceSpecialChars = regexp.MustCompile(`(?m)[^a-zA-Z0-9_\-.]`)
|
reReplaceSpecialChars = regexp.MustCompile(`(?m)[^a-zA-Z0-9_\-.]`)
|
||||||
reReplaceUnderscore = regexp.MustCompile(`(?m)[_\-]{2,}`)
|
reReplaceUnderscore = regexp.MustCompile(`(?m)[_\-]{2,}`)
|
||||||
reReplaceTree = regexp.MustCompile(`(?m)^tree$`)
|
reReplaceTree = regexp.MustCompile(`(?m)^tree$`)
|
||||||
|
reReplacePacsiftWarning = regexp.MustCompile(`^warning:.*\n`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type Conf struct {
|
type Conf struct {
|
||||||
|
Reference in New Issue
Block a user