diff options
-rw-r--r-- | src/args.nim | 2 | ||||
-rw-r--r-- | src/aur.nim | 2 | ||||
-rw-r--r-- | src/common.nim | 24 | ||||
-rw-r--r-- | src/config.nim | 2 | ||||
-rw-r--r-- | src/feature/localquery.nim | 2 | ||||
-rw-r--r-- | src/feature/syncinstall.nim | 21 | ||||
-rw-r--r-- | src/package.nim | 16 | ||||
-rw-r--r-- | src/pacman.nim | 12 |
8 files changed, 41 insertions, 40 deletions
diff --git a/src/args.nim b/src/args.nim index 5018b12..fd03ee0 100644 --- a/src/args.nim +++ b/src/args.nim @@ -168,7 +168,7 @@ iterator items*(op: OptionPair): OptionKey = proc filter*(args: seq[Argument], removeMatches: bool, keepTargets: bool, pairs: varargs[OptionPair]): seq[Argument] = let pairsSeq = @pairs - let argsSet = lc[x | (y <- pairsSeq, x <- y), OptionKey].toSet + let argsSet = lc[x | (y <- pairsSeq, x <- y), OptionKey].toHashSet args.filter(arg => (arg.isShort and (removeMatches xor (arg.key, false) in argsSet)) or (arg.isLong and (removeMatches xor (arg.key, true) in argsSet)) or diff --git a/src/aur.nim b/src/aur.nim index 781029c..399183c 100644 --- a/src/aur.nim +++ b/src/aur.nim @@ -114,7 +114,7 @@ proc getAurPackageInfos*(pkgs: seq[string], repo: string, arch: string, useTimeo let table = infos.map(i => (i.rpc.name, i)).toTable let pkgInfos = lc[x | (p <- pkgs, x <- table.opt(p)), PackageInfo] - let names = rpcInfos.map(i => i.name).toSet + let names = rpcInfos.map(i => i.name).toHashSet let additionalPkgInfos = infos.filter(i => not (i.rpc.name in names)) (pkgInfos, additionalPkgInfos, errors) diff --git a/src/common.nim b/src/common.nim index 6b436b4..8db3a79 100644 --- a/src/common.nim +++ b/src/common.nim @@ -113,7 +113,7 @@ proc filterNotFoundSyncTargets*(syncTargets: seq[SyncPackageTarget], .map(r => s.target.reference.isProvidedBy(r, true)).get(false))) proc printSyncNotFound*(config: Config, notFoundTargets: seq[SyncPackageTarget]) = - let dbs = config.common.dbs.toSet + let dbs = config.common.dbs.toHashSet for sync in notFoundTargets: if sync.target.repo.isNone or sync.target.repo == some(config.aurRepo) or @@ -224,11 +224,11 @@ proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptiona reference let depends = toSeq(pkg.depends.items) - .map(d => d.toPackageReference).toSet + .map(d => d.toPackageReference).toHashSet let optional = toSeq(pkg.optional.items) - .map(d => d.toPackageReference).toSet + .map(d => d.toPackageReference).toHashSet let provides = toSeq(pkg.provides.items) - .map(d => d.toPackageReference).map(fixProvides).toSet + .map(d => d.toPackageReference).map(fixProvides).toHashSet installed.add(pkg.toPackageReference) if pkg.reason == AlpmReason.explicit: @@ -238,7 +238,7 @@ proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptiona if provides.len > 0: alternatives.add($pkg.name, provides) - (installed, explicit.toSet + assumeExplicit, dependsTable, alternatives) + (installed, explicit.toHashSet + assumeExplicit, dependsTable, alternatives) let providedBy = lc[(y, x.key) | (x <- alternatives.namedPairs, y <- x.value), tuple[reference: PackageReference, name: string]] @@ -251,19 +251,19 @@ proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptiona x <- y.value, withOptional or not x.optional), PackageReference] let indirect = lc[x.name | (y <- direct, x <- providedBy, - y.isProvidedBy(x.reference, true)), string].toSet + y.isProvidedBy(x.reference, true)), string].toHashSet - let checkNext = (direct.map(p => p.name).toSet + indirect) - full + let checkNext = (direct.map(p => p.name).toHashSet + indirect) - full if checkNext.len > 0: findRequired(withOptional, full, checkNext) else: full - let installedNames = installed.map(i => i.name).toSet + let installedNames = installed.map(i => i.name).toHashSet proc findOrphans(withOptional: bool): HashSet[string] = - let required = findRequired(withOptional, initSet[string](), explicit) + let required = findRequired(withOptional, initHashSet[string](), explicit) installedNames - required - let withOptionalSet = if withOptional: findOrphans(true) else: initSet[string]() - let withoutOptionalSet = if withoutOptional: findOrphans(false) else: initSet[string]() + let withOptionalSet = if withOptional: findOrphans(true) else: initHashSet[string]() + let withoutOptionalSet = if withoutOptional: findOrphans(false) else: initHashSet[string]() (installed, withOptionalSet, withoutOptionalSet, alternatives) @@ -740,7 +740,7 @@ proc cloneAurReposWithPackageInfos*(config: Config, rpcInfos: seq[RpcPackageInfo let pkgInfosTable = fullPkgInfos.map(i => (i.rpc.name, i)).toTable let resultPkgInfos = lc[x | (y <- rpcInfos, x <- pkgInfosTable.opt(y.name)), PackageInfo] - let names = rpcInfos.map(i => i.name).toSet + let names = rpcInfos.map(i => i.name).toHashSet let additionalPkgInfos = fullPkgInfos.filter(i => not (i.rpc.name in names)) discard rmdir(config.tmpRoot(dropPrivileges)) diff --git a/src/config.nim b/src/config.nim index d9caf5e..e8be1fc 100644 --- a/src/config.nim +++ b/src/config.nim @@ -98,7 +98,7 @@ proc readConfigFile*(configFile: string): (table, wasError) proc ignored*(config: Config, name: string, groups: openArray[string]): bool = - name in config.common.ignorePkgs or (config.common.ignoreGroups * groups.toSet).len > 0 + name in config.common.ignorePkgs or (config.common.ignoreGroups * groups.toHashSet).len > 0 proc get*(colorMode: ColorMode): bool = case colorMode: diff --git a/src/feature/localquery.nim b/src/feature/localquery.nim index 1d58bdc..adc48c9 100644 --- a/src/feature/localquery.nim +++ b/src/feature/localquery.nim @@ -6,7 +6,7 @@ import proc handleQueryOrphans*(args: seq[Argument], config: Config): int = let (installed, orphans, _, alternatives) = withAlpmConfig(config, false, handle, dbs, errors): for e in errors: printError(config.color, e) - queryUnrequired(handle, true, false, initSet[string]()) + queryUnrequired(handle, true, false, initHashSet[string]()) let targets = args.packageTargets(false) diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim index fef4f82..7aba043 100644 --- a/src/feature/syncinstall.nim +++ b/src/feature/syncinstall.nim @@ -66,7 +66,7 @@ proc isVcs(name: string): bool = proc orderInstallation(ordered: seq[seq[seq[PackageInfo]]], grouped: seq[seq[PackageInfo]], satisfied: Table[PackageReference, SatisfyResult]): seq[seq[seq[PackageInfo]]] = - let orderedNamesSet = lc[c.rpc.name | (a <- ordered, b <- a, c <- b), string].toSet + let orderedNamesSet = lc[c.rpc.name | (a <- ordered, b <- a, c <- b), string].toHashSet proc hasBuildDependency(pkgInfos: seq[PackageInfo]): bool = for pkgInfo in pkgInfos: @@ -482,7 +482,7 @@ proc buildLoop(config: Config, pkgInfos: seq[PackageInfo], skipDeps: bool, else: let targetPkgInfos: seq[ReplacePkgInfo] = resultByIndices .map(i => (some(i.name), i.pkgInfo.get)) - let filterNames = targetPkgInfos.map(r => r.pkgInfo.rpc.name).toSet + let filterNames = targetPkgInfos.map(r => r.pkgInfo.rpc.name).toHashSet let additionalPkgInfos: seq[ReplacePkgInfo] = resultPkgInfos .filter(i => not (i.rpc.name in filterNames)) .map(i => (none(string), i)) @@ -694,7 +694,7 @@ proc resolveDependencies(config: Config, pkgInfos: seq[PackageInfo], (false, satisfied, newSeq[string](), newSeq[seq[seq[PackageInfo]]](), newSeq[string]()) else: - let buildAndAurNamesSet = pkgInfos.map(i => i.rpc.name).toSet + let buildAndAurNamesSet = pkgInfos.map(i => i.rpc.name).toHashSet let fullPkgInfos = (pkgInfos & lc[i | (s <- satisfied.values, i <- s.buildPkgInfo, not (i.rpc.name in buildAndAurNamesSet)), PackageInfo]) .deduplicatePkgInfos(config, false) @@ -836,7 +836,7 @@ proc printAllWarnings(config: Config, installed: seq[Installed], rpcInfos: seq[R pkgInfos: seq[PackageInfo], acceptedPkgInfos: seq[PackageInfo], upToDateNeeded: seq[Installed], buildUpToDateNeeded: seq[(string, string)], localIsNewerSeq: seq[LocalIsNewer], targetNamesSet: HashSet[string], upgradeCount: int, noaur: bool) = - let acceptedSet = acceptedPkgInfos.map(i => i.rpc.name).toSet + let acceptedSet = acceptedPkgInfos.map(i => i.rpc.name).toHashSet if upgradeCount > 0 and not noaur and config.printAurNotFound: let rpcInfoTable = rpcInfos.map(i => (i.name, i)).toTable @@ -1054,7 +1054,7 @@ proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget], fullTargets: seq[FullPackageTarget], printHeader: bool, printMode: bool, upgradeCount: int, noconfirm: bool, needed: bool, noaur: bool, build: bool): (int, seq[Installed], HashSet[string], seq[PackageInfo], seq[PackageInfo], seq[string]) = - template errorResult: untyped = (1, newSeq[Installed](), initSet[string](), + template errorResult: untyped = (1, newSeq[Installed](), initHashSet[string](), newSeq[PackageInfo](), newSeq[PackageInfo](), newSeq[string]()) let (installed, checkAurUpgradeNames) = obtainInstalledWithAur(config) @@ -1077,7 +1077,7 @@ proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget], let rpcAurTargets = fullTargets.filter(f => f.isAurTargetFull(config.aurRepo)) let targetRpcInfos = lc[x | (t <- rpcAurTargets, x <- t.rpcInfo), RpcPackageInfo] - let targetRpcInfoNames = targetRpcInfos.map(i => i.name).toSet + let targetRpcInfoNames = targetRpcInfos.map(i => i.name).toHashSet let rpcInfos = targetRpcInfos & upgradeRpcInfos.filter(i => not (i.name in targetRpcInfoNames)) let (aurPkgInfos, additionalPkgInfos, aurPaths, upToDateNeeded, localIsNewerSeq, aperrors) = @@ -1114,7 +1114,8 @@ proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget], else: let pkgInfos = (buildPkgInfos & aurPkgInfos) .deduplicatePkgInfos(config, not printMode) - let targetNamesSet = (pacmanTargets & aurTargets).map(f => f.sync.target.reference.name).toSet + let targetNamesSet = (pacmanTargets & aurTargets) + .map(f => f.sync.target.reference.name).toHashSet let (finalPkgInfos, acceptedPkgInfos) = filterIgnoresAndConflicts(config, pkgInfos, targetNamesSet, installedTable, printMode, noconfirm) @@ -1174,14 +1175,14 @@ proc handleInstall(args: seq[Argument], config: Config, syncTargets: seq[SyncPac clearPaths(paths) confirmAndResolveCode else: - let explicitsNamesSet = installed.filter(i => i.explicit).map(i => i.name).toSet - let depsNamesSet = installed.filter(i => not i.explicit).map(i => i.name).toSet + let explicitsNamesSet = installed.filter(i => i.explicit).map(i => i.name).toHashSet + let depsNamesSet = installed.filter(i => not i.explicit).map(i => i.name).toHashSet let keepNames = explicitsNamesSet + depsNamesSet + targetNamesSet let explicits = if args.check(%%%"asexplicit"): targetNamesSet + explicitsNamesSet + depsNamesSet elif args.check(%%%"asdeps"): - initSet[string]() + initHashSet[string]() else: explicitsNamesSet + (targetNamesSet - depsNamesSet) diff --git a/src/package.nim b/src/package.nim index 5f31ede..5b87184 100644 --- a/src/package.nim +++ b/src/package.nim @@ -73,26 +73,26 @@ type const packageRepos: seq[PackageRepo] = @[ - (["arch", "parabola"].toSet, - ["core", "extra", "testing"].toSet, + (["arch", "parabola"].toHashSet, + ["core", "extra", "testing"].toHashSet, ("https://git.archlinux.org/svntogit/packages.git", none(string), some("packages/${BASE}"), "repos/${REPO}-${ARCH}")), - (["arch", "parabola"].toSet, - ["community", "community-testing", "multilib", "multilib-testing"].toSet, + (["arch", "parabola"].toHashSet, + ["community", "community-testing", "multilib", "multilib-testing"].toHashSet, ("https://git.archlinux.org/svntogit/community.git", none(string), some("packages/${BASE}"), "repos/${REPO}-${ARCH}")), - (["parabola"].toSet, + (["parabola"].toHashSet, ["libre", "libre-testing", "libre-multilib", "libre-multilib-testing", "nonprism", "nonprism-testing", "nonprism-multilib", "nonprism-multilib-testing", - "pcr", "pcr-testing", "pcr-multilib", "pcr-multilib-testing"].toSet, + "pcr", "pcr-testing", "pcr-multilib", "pcr-multilib-testing"].toHashSet, ("https://git.parabola.nu/abslibre.git", some("parabola"), none(string), "${REPO}/${BASE}")) ] static: # test only single match available - let osSet = lc[x | (r <- packageRepos, x <- r.os), string].toSet - let repoSet = lc[x | (r <- packageRepos, x <- r.repo), string].toSet + let osSet = lc[x | (r <- packageRepos, x <- r.os), string].toHashSet + let repoSet = lc[x | (r <- packageRepos, x <- r.repo), string].toHashSet for os in osSet: for repo in repoSet: let osValue = os diff --git a/src/pacman.nim b/src/pacman.nim index b58482c..857581f 100644 --- a/src/pacman.nim +++ b/src/pacman.nim @@ -171,7 +171,7 @@ const databaseOptions & filesOptions optionsWithParameter*: HashSet[OptionKey] = - calculateOptionsWithParameter(allOptions).toSet + calculateOptionsWithParameter(allOptions).toHashSet syncConflictingOptions*: seq[ConflictingOptions] = @[ ("asdeps", @["asexplicit"]), @@ -236,7 +236,7 @@ proc filterExtensions*(args: seq[Argument], removeMatches: bool, keepTargets: bo let optsFilter = if removeMatches: lc[x | (y <- optsSeq, x <- y), CommandOption] else: (block: - let pairs = lc[x.pair | (y <- optsSeq, x <- y), OptionPair].toSet + let pairs = lc[x.pair | (y <- optsSeq, x <- y), OptionPair].toHashSet lc[x | (x <- allOptions, not (x.pair in pairs)), CommandOption]) let argsSeq = lc[x.pair | (x <- optsFilter, x.extension), OptionPair] @@ -302,8 +302,8 @@ proc createConfigFromTable(table: Table[string, string], dbs: seq[string]): Pacm let verbosePkgLists = table.hasKey("VerbosePkgLists") let downloadTimeout = not table.hasKey("DisableDownloadTimeout") let arch = table.opt("Architecture").get("auto") - let ignorePkgs = table.opt("IgnorePkg").get("").splitWhitespace.toSet - let ignoreGroups = table.opt("IgnoreGroup").get("").splitWhitespace.toSet + let ignorePkgs = table.opt("IgnorePkg").get("").splitWhitespace.toHashSet + let ignoreGroups = table.opt("IgnoreGroup").get("").splitWhitespace.toHashSet let archFinal = if arch.len == 0 or arch == "auto": getMachineName().get(arch) else: arch if archFinal.len == 0 or archFinal == "auto": @@ -347,9 +347,9 @@ proc obtainPacmanConfig*(args: seq[Argument]): PacmanConfig = let debug = args.check(%%%"debug") let progressBar = not args.check(%%%"noprogressbar") let ignorePkgs = lc[x | (y <- getAll(%%%"ignore"), - x <- y.split(',')), string].toSet + x <- y.split(',')), string].toHashSet let ignoreGroups = lc[x | (y <- getAll(%%%"ignoregroup"), - x <- y.split(',')), string].toSet + x <- y.split(',')), string].toHashSet let hasKeyserver = forkWaitRedirect(() => (block: if dropPrivileges(): |