diff options
author | kitsunyan | 2018-04-23 15:19:22 +0000 |
---|---|---|
committer | kitsunyan | 2018-04-23 15:19:22 +0000 |
commit | b548155b950bf43d9d8de23c3b08efceff4be02a (patch) | |
tree | 7b6255f3280ee9f513d85491c19b7b8db345dffa /src | |
parent | 6ffcd68b64f4199b33c8fdd5377cc932466d22de (diff) |
Filter repeating targets
Diffstat (limited to 'src')
-rw-r--r-- | src/feature/syncinstall.nim | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim index ecca6ef..ae781fe 100644 --- a/src/feature/syncinstall.nim +++ b/src/feature/syncinstall.nim @@ -891,6 +891,17 @@ proc filterIgnoresAndConflicts(config: Config, pkgInfos: seq[PackageInfo], (nonConflicingPkgInfos, acceptedPkgInfos) +proc deduplicatePkgInfos(targets: seq[PackageInfo], + config: Config, print: bool): seq[PackageInfo] = + targets.foldl(block: + if a.map(t => t.name).contains(b.name): + if not print: + printWarning(config.color, trp("skipping target: %s\n") % [b.name]) + a + else: + a & b, + newSeq[PackageInfo]()) + proc checkNeeded(installed: Table[string, Installed], name: string, version: string, downgrade: bool): tuple[needed: bool, vercmp: int] = if installed.hasKey(name): @@ -1134,9 +1145,10 @@ proc handleSyncInstall*(args: seq[Argument], config: Config): int = tra("%s: downgrading from version %s to version %s\n") % [pkgInfo.name, installedVersion, newVersion]) - let buildAndAurTargetSet = finalPkgInfos.map(i => i.name).toSet - let fullPkgInfos = finalPkgInfos & lc[i | (s <- satisfied.values, - i <- s.buildPkgInfo, not (i.name in buildAndAurTargetSet)), PackageInfo].deduplicate + let buildAndAurNamesSet = finalPkgInfos.map(i => i.name).toSet + let fullPkgInfos = (finalPkgInfos & lc[i | (s <- satisfied.values, + i <- s.buildPkgInfo, not (i.name in buildAndAurNamesSet)), PackageInfo]) + .deduplicatePkgInfos(config, printFormat.isSome) let directPacmanTargets = pacmanTargets.map(`$`) let additionalPacmanTargets = lc[x.name | (x <- satisfied.values, |