MCPcopy
hub / github.com/Jguer/yay / createDevelDB

Function createDevelDB

vcs.go:33–75  ·  view source on GitHub ↗

createDevelDB forces yay to create a DB of the existing development packages.

(ctx context.Context, run *runtime.Runtime, dbExecutor db.Executor)

Source from the content-addressed store, hash-verified

31
32// createDevelDB forces yay to create a DB of the existing development packages.
33func createDevelDB(ctx context.Context, run *runtime.Runtime, dbExecutor db.Executor) error {
34 remoteNames := dbExecutor.InstalledRemotePackageNames()
35
36 run.QueryBuilder.Execute(ctx, dbExecutor, remoteNames)
37 info, err := run.AURClient.Get(ctx, &aur.Query{
38 Needles: remoteNames,
39 By: aur.Name,
40 Contains: false,
41 })
42 if err != nil {
43 return err
44 }
45
46 preper := workdir.NewPreparerWithoutHooks(dbExecutor, run.CmdBuilder, run.Cfg, run.Logger.Child("workdir"), false)
47
48 mapInfo := infoToInstallInfo(info)
49 pkgBuildDirsByBase, err := preper.Run(ctx, run, mapInfo)
50 if err != nil {
51 return err
52 }
53
54 srcinfos, err := srcinfo.ParseSrcinfoFilesByBase(run.Logger.Child("srcinfo"), pkgBuildDirsByBase, false)
55 if err != nil {
56 return err
57 }
58
59 var wg sync.WaitGroup
60 for i := range srcinfos {
61 for iP := range srcinfos[i].Packages {
62 wg.Add(1)
63
64 go func(baseIndex string, packageIndex int) {
65 run.VCSStore.Update(ctx, srcinfos[baseIndex].Packages[packageIndex].Pkgname, srcinfos[baseIndex].Source)
66 wg.Done()
67 }(i, iP)
68 }
69 }
70
71 wg.Wait()
72 run.Logger.OperationInfoln(gotext.Get("GenDB finished. No packages were installed"))
73
74 return nil
75}

Callers 1

handleYayFunction · 0.85

Calls 11

NewPreparerWithoutHooksFunction · 0.92
ParseSrcinfoFilesByBaseFunction · 0.92
infoToInstallInfoFunction · 0.85
ChildMethod · 0.80
OperationInfolnMethod · 0.80
ExecuteMethod · 0.65
GetMethod · 0.65
UpdateMethod · 0.65
RunMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected