From eb5df207a21e29e6704fb500a660d75a51c8631b Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Tue, 31 Aug 2021 21:13:22 +0200 Subject: [PATCH] try locking alpm db --- main.go | 2 ++ utils.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/main.go b/main.go index c006ba4..73455ac 100644 --- a/main.go +++ b/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) diff --git a/utils.go b/utils.go index 703d37a..60afe95 100644 --- a/utils.go +++ b/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} }