forked from ALHP/ALHP.GO
try locking alpm db
This commit is contained in:
2
main.go
2
main.go
@@ -523,11 +523,13 @@ func (b *BuildManager) syncWorker() {
|
||||
}
|
||||
|
||||
// fetch updates between sync runs
|
||||
b.alpmMutex.Lock()
|
||||
check(alpmHandle.Release())
|
||||
setupChroot()
|
||||
var err error
|
||||
alpmHandle, err = initALPM(filepath.Join(conf.Basedir.Chroot, pristineChroot), filepath.Join(conf.Basedir.Chroot, pristineChroot, "/var/lib/pacman"))
|
||||
check(err)
|
||||
b.alpmMutex.Unlock()
|
||||
|
||||
pkgBuilds, err := Glob(filepath.Join(conf.Basedir.Upstream, "/**/PKGBUILD"))
|
||||
check(err)
|
||||
|
3
utils.go
3
utils.go
@@ -61,6 +61,7 @@ type BuildManager struct {
|
||||
failedMutex sync.RWMutex
|
||||
buildProcesses []*os.Process
|
||||
buildProcMutex sync.RWMutex
|
||||
alpmMutex sync.RWMutex
|
||||
}
|
||||
|
||||
type Conf struct {
|
||||
@@ -498,7 +499,9 @@ func isMirrorLatest(h *alpm.Handle, buildPkg *BuildPackage) (bool, alpm.IPackage
|
||||
allDepends = append(allDepends, buildPkg.Srcinfo.MakeDepends...)
|
||||
|
||||
for _, dep := range allDepends {
|
||||
buildManager.alpmMutex.Lock()
|
||||
pkg, err := dbs.FindSatisfier(dep.Value)
|
||||
buildManager.alpmMutex.Unlock()
|
||||
if err != nil {
|
||||
return false, nil, "", UnableToSatisfyError{err}
|
||||
}
|
||||
|
Reference in New Issue
Block a user