mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-06 05:31:50 +00:00
bundles: Fix race condition on map.Range
When ranging over the syncmap to add packages to a bundle we were mistakenly ranging over the entire set of bundles and adding all bundle packages to the same bundle (nondeterministically, since we were doing concurrent writes to a syncmap). In reality we just need to range over the repoPkgMap itself and not load it from the syncmap at all. Do this operation before even storing it. Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
+8
-9
@@ -383,16 +383,15 @@ func resolvePackages(numWorkers int, set bundleSet, packagerCmd []string, emptyD
|
||||
|
||||
// TODO: parseNoopInstall may fail, so consider a way to stop the processing
|
||||
// once we find that failure. See how errorCh works in fullfiles.go.
|
||||
bundleRepoPkgs.Store(bundle.Name, parseNoopInstall(outBuf.String()))
|
||||
|
||||
bundleRepoPkgs.Range(func(key, val interface{}) bool {
|
||||
for _, r := range val.(repoPkgMap) {
|
||||
for _, p := range r {
|
||||
bundle.AllPackages[p] = true
|
||||
}
|
||||
rpm := parseNoopInstall(outBuf.String())
|
||||
for _, pkgs := range rpm {
|
||||
// Add packages to bundle's AllPackages
|
||||
for _, pkg := range pkgs {
|
||||
bundle.AllPackages[pkg] = true
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
bundleRepoPkgs.Store(bundle.Name, rpm)
|
||||
|
||||
fmt.Printf("... done with %s\n", bundle.Name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user