aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitsunyan2018-05-13 00:22:28 +0000
committerkitsunyan2018-05-13 00:22:28 +0000
commitbfabe37c987c2ff1718ea06bffce04dde9316efc (patch)
treed1d6c67675e80d14c4d4f53fc02b5bad2a90358c
parent66508034ce18a0d0e0f569c430a62e22eb311bb2 (diff)
Skip removed packages during upgrade
A depends on B before upgrade, A depends on C after upgrade. C conflicts with B, which was removed from official repositories. In this case, remove B from targets list.
-rw-r--r--src/feature/syncinstall.nim22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim
index 45613f1..a686be4 100644
--- a/src/feature/syncinstall.nim
+++ b/src/feature/syncinstall.nim
@@ -764,8 +764,22 @@ proc handleInstall(args: seq[Argument], config: Config, upgradeCount: int, nodep
let assumeInstalled = args.assumeInstalled
let skipDeps = assumeInstalled.len > 0 or nodepsCount > 0
+ let removedNames = withAlpm(config.root, config.db,
+ config.dbs, config.arch, handle, dbs, errors):
+ for e in errors: printError(config.color, e)
+ let newInstalledNames = lc[$p.name | (p <- handle.local.packages), string].toSet
+ installed.map(i => i.name).filter(n => not (n in newInstalledNames)).toSet
+
+ let (finalPkgInfos, finalAdditionalPkgInfos) = pkgInfos.foldl(block:
+ let (pkgInfos, additionalPkgInfos) = a
+ if b.name in removedNames:
+ (pkgInfos, additionalPkgInfos & b)
+ else:
+ (pkgInfos & b, additionalPkgInfos),
+ (newSeq[PackageInfo](), additionalPkgInfos))
+
let (resolveSuccess, satisfied, additionalPacmanTargets, basePackages, dependencyPaths) =
- resolveDependencies(config, pkgInfos, additionalPkgInfos, false, directSome,
+ resolveDependencies(config, finalPkgInfos, finalAdditionalPkgInfos, false, directSome,
nodepsCount, assumeInstalled, noaur)
let paths = initialPaths & dependencyPaths
@@ -852,10 +866,10 @@ proc handleInstall(args: seq[Argument], config: Config, upgradeCount: int, nodep
removeCode
else:
code
- elif not directSome and not additionalSome:
- echo(trp(" there is nothing to do\n"))
- 0
else:
+ if not directSome and not additionalSome:
+ echo(trp(" there is nothing to do\n"))
+ clearPaths(paths)
0
proc handlePrint(args: seq[Argument], config: Config, printFormat: string,