yay/vcs.go

54 lines
1.2 KiB
Go
Raw Normal View History

package main
2017-05-01 01:23:03 +00:00
2017-05-01 01:34:40 +00:00
import (
2018-08-02 22:30:48 +00:00
"sync"
2018-03-22 18:23:20 +00:00
"github.com/leonelquinteros/gotext"
2020-08-01 07:55:08 +00:00
"github.com/Jguer/yay/v10/pkg/db"
2020-07-10 00:36:45 +00:00
"github.com/Jguer/yay/v10/pkg/dep"
"github.com/Jguer/yay/v10/pkg/query"
"github.com/Jguer/yay/v10/pkg/settings"
"github.com/Jguer/yay/v10/pkg/stringset"
"github.com/Jguer/yay/v10/pkg/text"
2017-05-01 01:34:40 +00:00
)
2017-05-01 01:23:03 +00:00
2017-10-14 16:11:47 +00:00
// createDevelDB forces yay to create a DB of the existing development packages
func createDevelDB(config *settings.Configuration, dbExecutor db.Executor) error {
2018-08-02 22:30:48 +00:00
var mux sync.Mutex
var wg sync.WaitGroup
2018-03-22 18:23:20 +00:00
2020-08-01 07:55:08 +00:00
_, remoteNames, err := query.GetPackageNamesBySource(dbExecutor)
if err != nil {
return err
}
2020-07-10 00:36:45 +00:00
info, err := query.AURInfoPrint(remoteNames, config.RequestSplitN)
2018-03-22 18:23:20 +00:00
if err != nil {
return err
}
2018-03-25 21:31:20 +00:00
2020-07-10 00:36:45 +00:00
bases := dep.GetBases(info)
toSkip := pkgbuildsToSkip(bases, stringset.FromSlice(remoteNames))
_, err = downloadPkgbuilds(bases, toSkip, config.BuildDir)
if err != nil {
return err
}
srcinfos, err := parseSrcinfoFiles(bases, false)
if err != nil {
return err
}
2018-03-22 18:23:20 +00:00
for i := range srcinfos {
for iP := range srcinfos[i].Packages {
2018-08-02 22:30:48 +00:00
wg.Add(1)
go savedInfo.Update(srcinfos[i].Packages[iP].Pkgname, srcinfos[i].Source, &mux, &wg)
2018-03-22 18:23:20 +00:00
}
}
2018-08-02 22:30:48 +00:00
wg.Wait()
text.OperationInfoln(gotext.Get("GenDB finished. No packages were installed"))
return err
2017-05-01 01:23:03 +00:00
}