SyncInfo serves as a pacman -Si for repo packages and AUR packages.
(ctx context.Context, run *runtime.Runtime, cmdArgs *parser.Arguments, pkgS []string, dbExecutor db.Executor, )
| 35 | |
| 36 | // SyncInfo serves as a pacman -Si for repo packages and AUR packages. |
| 37 | func syncInfo(ctx context.Context, run *runtime.Runtime, |
| 38 | cmdArgs *parser.Arguments, pkgS []string, dbExecutor db.Executor, |
| 39 | ) error { |
| 40 | var ( |
| 41 | remoteAurPkgs []aur.Pkg |
| 42 | err error |
| 43 | missing = false |
| 44 | ) |
| 45 | |
| 46 | pkgS = query.RemoveInvalidTargets(run.Logger, pkgS, run.Cfg.Mode) |
| 47 | |
| 48 | expandedPackages := []string{} |
| 49 | for _, pkg := range pkgS { |
| 50 | groupPackages := dbExecutor.PackagesFromGroup(pkg) |
| 51 | if len(groupPackages) > 0 { |
| 52 | for _, p := range groupPackages { |
| 53 | expandedPackages = append(expandedPackages, p.Name()) |
| 54 | } |
| 55 | } else { |
| 56 | expandedPackages = append(expandedPackages, pkg) |
| 57 | } |
| 58 | } |
| 59 | pkgS = expandedPackages |
| 60 | |
| 61 | aurS, repoS := packageSlices(pkgS, run.Cfg, dbExecutor) |
| 62 | |
| 63 | if len(repoS) == 0 && len(aurS) == 0 { |
| 64 | if run.Cfg.Mode != parser.ModeRepo { |
| 65 | aurS = dbExecutor.InstalledRemotePackageNames() |
| 66 | } |
| 67 | |
| 68 | if run.Cfg.Mode != parser.ModeAUR { |
| 69 | repoS = dbExecutor.InstalledSyncPackageNames() |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | if len(aurS) != 0 { |
| 74 | noDB := make([]string, 0, len(aurS)) |
| 75 | |
| 76 | for _, pkg := range aurS { |
| 77 | _, name := text.SplitDBFromName(pkg) |
| 78 | noDB = append(noDB, name) |
| 79 | } |
| 80 | |
| 81 | remoteAurPkgs, err = run.AURClient.Get(ctx, &aur.Query{ |
| 82 | Needles: noDB, |
| 83 | By: aur.Name, |
| 84 | }) |
| 85 | if err != nil { |
| 86 | run.Logger.Errorln(err) |
| 87 | } |
| 88 | |
| 89 | // Check for any missing packages and print errors for any not found |
| 90 | found := mapset.NewThreadUnsafeSet[string]() |
| 91 | for i := range remoteAurPkgs { |
| 92 | found.Add(remoteAurPkgs[i].Name) |
| 93 | } |
| 94 |
no test coverage detected