diff options
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/syncinfo.nim | 16 | ||||
-rw-r--r-- | src/feature/syncinstall.nim | 38 | ||||
-rw-r--r-- | src/feature/syncsearch.nim | 4 | ||||
-rw-r--r-- | src/feature/syncsource.nim | 10 |
4 files changed, 35 insertions, 33 deletions
diff --git a/src/feature/syncinfo.nim b/src/feature/syncinfo.nim index 2de5bda..483df3c 100644 --- a/src/feature/syncinfo.nim +++ b/src/feature/syncinfo.nim @@ -62,11 +62,11 @@ proc formatDate(date: Option[int64]): seq[string] = proc handleTarget(config: Config, padding: int, args: seq[Argument], target: FullPackageTarget[PackageInfo]): int = if target.foundInfos.len > 0: - if isAurTargetFull[PackageInfo](target): + if isAurTargetFull[PackageInfo](target, config.aurRepo): let pkgInfo = target.pkgInfo.unsafeGet printPackageInfo(padding, config.color, - (trp"Repository", @["aur"], false), + (trp"Repository", @[config.aurRepo], false), (trp"Name", @[pkgInfo.name], false), (trp"Version", @[pkgInfo.version], false), (trp"Description", toSeq(pkgInfo.description.items), false), @@ -93,7 +93,7 @@ proc handleTarget(config: Config, padding: int, args: seq[Argument], pacmanRun(false, config.color, args & ($target, none(string), ArgumentType.target)) else: - if target.repo == some("aur"): + if target.repo == some(config.aurRepo): printError(config.color, trp("package '%s' was not found\n") % [$target]) 1 else: @@ -108,16 +108,16 @@ proc handleSyncInfo*(args: seq[Argument], config: Config): int = let (syncTargets, checkAurNames) = withAlpmConfig(config, true, handle, dbs, errors): for e in errors: printError(config.color, e) - findSyncTargets(handle, dbs, targets, false, false) + findSyncTargets(handle, dbs, targets, config.aurRepo, false, false) - let (pkgInfos, _, aerrors) = getAurPackageInfos(checkAurNames, config.arch) + let (pkgInfos, _, aerrors) = getAurPackageInfos(checkAurNames, config.aurRepo, config.arch) for e in aerrors: printError(config.color, e) - let fullTargets = mapAurTargets[PackageInfo](syncTargets, pkgInfos) + let fullTargets = mapAurTargets[PackageInfo](syncTargets, pkgInfos, config.aurRepo) let code = min(aerrors.len, 1) - if fullTargets.filter(t => isAurTargetFull[PackageInfo](t) or t.repo == some("aur") or - t.reference.constraint.isSome).len == 0: + if fullTargets.filter(t => isAurTargetFull[PackageInfo](t, config.aurRepo) or + t.repo == some(config.aurRepo) or t.reference.constraint.isSome).len == 0: if code == 0: pacmanExec(false, config.color, callArgs) else: diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim index 7d638cc..b583fe6 100644 --- a/src/feature/syncinstall.nim +++ b/src/feature/syncinstall.nim @@ -200,11 +200,12 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle, dbs: seq[ptr AlpmD withAur(): let (pkgInfos, additionalPkgInfos, paths) = if printMode: (block: let (pkgInfos, additionalPkgInfos, aerrors) = - getAurPackageInfos(aurCheck.map(r => r.name), config.arch) + getAurPackageInfos(aurCheck.map(r => r.name), config.aurRepo, config.arch) for e in aerrors: printError(config.color, e) (pkgInfos, additionalPkgInfos, newSeq[string]())) else: (block: - let (rpcInfos, aerrors) = getRpcPackageInfos(aurCheck.map(r => r.name)) + let (rpcInfos, aerrors) = getRpcPackageInfos(aurCheck.map(r => r.name), + config.aurRepo) for e in aerrors: printError(config.color, e) let (pkgInfos, additionalPkgInfos, paths, cerrors) = cloneAurReposWithPackageInfos(config, rpcInfos, not printMode, update, true) @@ -351,7 +352,7 @@ proc editLoop(config: Config, repo: string, base: string, repoPath: string, else: res - let (hasChanges, noTag) = if repo == "aur": (block: + let (hasChanges, noTag) = if repo == config.aurRepo: (block: let revisions = forkWaitRedirect(() => (block: dropPrivilegesAndChdir(none(string)): execResult(gitCmd, "-C", repoPath, "rev-list", tag & "..@"))) @@ -609,7 +610,7 @@ proc installGroupFromSources(config: Config, commonArgs: seq[Argument], let cachePath = config.userCacheInitial.cache(CacheKind.repositories) for pkgInfos in basePackages: let repo = pkgInfos[0].repo - if repo == "aur": + if repo == config.aurRepo: let base = pkgInfos[0].base let fullName = bareFullName(BareKind.pkg, base) let bareRepoPath = repoPath(cachePath, fullName) @@ -696,7 +697,7 @@ proc confirmViewAndImportKeys(config: Config, basePackages: seq[seq[seq[PackageI let base = pkgInfos[0].base let repoPath = repoPath(config.tmpRootInitial, base) - let aur = repo == "aur" + let aur = repo == config.aurRepo if not skipEdit and aur and not noconfirm and config.aurComments: echo(tr"downloading comments from AUR...") @@ -975,7 +976,7 @@ proc handlePrint(args: seq[Argument], config: Config, printFormat: string, echo(printFormat .replace("%n", pkgInfo.name) .replace("%v", pkgInfo.version) - .replace("%r", "aur") + .replace("%r", config.aurRepo) .replace("%s", "0") .replace("%l", pkgInfo.gitUrl)) @@ -1003,7 +1004,7 @@ proc printAllWarnings(config: Config, installed: seq[Installed], rpcInfos: seq[R if upgradeCount == 1: for localIsNewer in localIsNewerSeq: printWarning(config.color, tra("%s: local (%s) is newer than %s (%s)\n") % - [localIsNewer.name, localIsNewer.version, "aur", localIsNewer.aurVersion]) + [localIsNewer.name, localIsNewer.version, config.aurRepo, localIsNewer.aurVersion]) for inst in upToDateNeeded: printWarning(config.color, tra("%s-%s is up to date -- skipping\n") % @@ -1030,7 +1031,7 @@ proc printAllWarnings(config: Config, installed: seq[Installed], rpcInfos: seq[R [pkgInfo.name, installedVersion, newVersion]) else: printWarning(config.color, trp("skipping target: %s\n") % [pkgInfo.name]) - elif pkgInfo.repo == "aur": + elif pkgInfo.repo == config.aurRepo: if pkgInfo.maintainer.isNone: printWarning(config.color, tr"$# is orphaned" % [pkgInfo.name]) if installedTable.hasKey(pkgInfo.name): @@ -1135,10 +1136,10 @@ proc obtainAurPackageInfos(config: Config, rpcInfos: seq[RpcPackageInfo], let (pkgInfos, additionalPkgInfos, paths, errors) = if printMode: (block: let (pkgInfos, additionalPkgInfos, aerrors) = - getAurPackageInfos(fullRpcInfos.map(i => i.name), config.arch) + getAurPackageInfos(fullRpcInfos.map(i => i.name), config.aurRepo, config.arch) (pkgInfos, additionalPkgInfos, newSeq[string](), aerrors.deduplicate)) else: (block: - let (rpcInfos, aerrors) = getRpcPackageInfos(fullRpcInfos.map(i => i.name)) + let (rpcInfos, aerrors) = getRpcPackageInfos(fullRpcInfos.map(i => i.name), config.aurRepo) let (pkgInfos, additionalPkgInfos, paths, cerrors) = cloneAurReposWithPackageInfos(config, rpcInfos, not printMode, update, true) (pkgInfos, additionalPkgInfos, paths, (toSeq(aerrors.items) & cerrors).deduplicate)) @@ -1194,7 +1195,7 @@ proc findSyncTargetsWithInstalled(config: Config, targets: seq[PackageTarget], u withAlpmConfig(config, true, handle, dbs, errors): for e in errors: printError(config.color, e) - let (syncTargets, checkAurNames) = findSyncTargets(handle, dbs, targets, + let (syncTargets, checkAurNames) = findSyncTargets(handle, dbs, targets, config.aurRepo, not build, not build) proc checkReplaceable(name: string): bool = @@ -1247,18 +1248,19 @@ proc resolveBuildTargets(config: Config, targets: seq[PackageTarget], if checkAurNames.len > 0: echo(tr"checking AUR database...") - let (rpcInfos, rerrors) = getRpcPackageInfos(checkAurNames) + let (rpcInfos, rerrors) = getRpcPackageInfos(checkAurNames, config.aurRepo) for e in rerrors: printError(config.color, e) let rpcNotFoundTargets = filterNotFoundSyncTargets(syncTargets, - rpcInfos, initTable[string, PackageReference]()) + rpcInfos, initTable[string, PackageReference](), config.aurRepo) if rpcNotFoundTargets.len > 0: printSyncNotFound(config, rpcNotFoundTargets) errorResult else: let installedTable = installed.map(i => (i.name, i)).toTable - let rpcAurTargets = mapAurTargets(syncTargets, rpcInfos).filter(isAurTargetFull) + let rpcAurTargets = mapAurTargets(syncTargets, rpcInfos, config.aurRepo) + .filter(t => t.isAurTargetFull(config.aurRepo)) let (aurPkgInfos, additionalPkgInfos, aurPaths, upToDateNeeded, localIsNewerSeq, aperrors) = obtainAurPackageInfos(config, rpcInfos, rpcAurTargets, installedTable, @@ -1268,7 +1270,7 @@ proc resolveBuildTargets(config: Config, targets: seq[PackageTarget], let upToDateNeededTable: Table[string, PackageReference] = upToDateNeeded.map(i => (i.name, (i.name, none(string), some((ConstraintOperation.eq, i.version, false))))).toTable let notFoundTargets = filterNotFoundSyncTargets(syncTargets, - aurPkgInfos, upToDateNeededTable) + aurPkgInfos, upToDateNeededTable, config.aurRepo) if notFoundTargets.len > 0: clearPaths(aurPaths) @@ -1277,9 +1279,9 @@ proc resolveBuildTargets(config: Config, targets: seq[PackageTarget], else: let fullTargets = mapAurTargets(syncTargets .filter(t => not (upToDateNeededTable.opt(t.reference.name) - .map(r => t.reference.isProvidedBy(r, true)).get(false))), aurPkgInfos) - let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t)) - let aurTargets = fullTargets.filter(isAurTargetFull) + .map(r => t.reference.isProvidedBy(r, true)).get(false))), aurPkgInfos, config.aurRepo) + let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t, config.aurRepo)) + let aurTargets = fullTargets.filter(t => isAurTargetFull(t, config.aurRepo)) let (checkPacmanBuildPkgInfos, buildPkgInfos, buildUpToDateNeeded, buildPaths, obtainBuildErrorMessages) = obtainPacmanBuildTargets(config, pacmanTargets, installedTable, diff --git a/src/feature/syncsearch.nim b/src/feature/syncsearch.nim index 0b1aeae..7a9199d 100644 --- a/src/feature/syncsearch.nim +++ b/src/feature/syncsearch.nim @@ -11,7 +11,7 @@ proc handleSyncSearch*(args: seq[Argument], config: Config): int = else: let quiet = args.check(%%%"quiet") - let (aurPackages, aerrors) = findAurPackages(args.targets) + let (aurPackages, aerrors) = findAurPackages(args.targets, config.aurRepo) for e in aerrors: printError(config.color, e) type Package = tuple[rpcInfo: RpcPackageInfo, installedVersion: Option[string]] @@ -49,7 +49,7 @@ proc handleSyncSearch*(args: seq[Argument], config: Config): int = if quiet: echo(pkg.rpcInfo.name) else: - printPackageSearch(config.color, "aur", pkg.rpcInfo.name, + printPackageSearch(config.color, config.aurRepo, pkg.rpcInfo.name, pkg.rpcInfo.version, pkg.installedVersion, pkg.rpcInfo.description, some(formatPkgRating(pkg.rpcInfo.votes, pkg.rpcInfo.popularity))) 0 diff --git a/src/feature/syncsource.nim b/src/feature/syncsource.nim index 5c3f35a..df543c7 100644 --- a/src/feature/syncsource.nim +++ b/src/feature/syncsource.nim @@ -113,7 +113,7 @@ proc cloneAndCopy(config: Config, quiet: bool, fullTargets: seq[FullPackageTarget[RpcPackageInfo]]): int = let baseTargets = fullTargets.foldl(block: let bases = a.map(x => x.base) - if b.isAurTargetFull: + if b.isAurTargetFull(config.aurRepo): let rpcInfo = b.pkgInfo.get if rpcInfo.base in bases: a @@ -166,17 +166,17 @@ proc handleSyncSource*(args: seq[Argument], config: Config): int = else: let (syncTargets, checkAurNames) = withAlpmConfig(config, true, handle, dbs, errors): for e in errors: printError(config.color, e) - findSyncTargets(handle, dbs, targets, false, false) + findSyncTargets(handle, dbs, targets, config.aurRepo, false, false) - let (rpcInfos, aerrors) = getRpcPackageInfos(checkAurNames) + let (rpcInfos, aerrors) = getRpcPackageInfos(checkAurNames, config.aurRepo) for e in aerrors: printError(config.color, e) let notFoundTargets = filterNotFoundSyncTargets(syncTargets, - rpcInfos, initTable[string, PackageReference]()) + rpcInfos, initTable[string, PackageReference](), config.aurRepo) if notFoundTargets.len > 0: printSyncNotFound(config, notFoundTargets) 1 else: - let fullTargets = mapAurTargets[RpcPackageInfo](syncTargets, rpcInfos) + let fullTargets = mapAurTargets[RpcPackageInfo](syncTargets, rpcInfos, config.aurRepo) cloneAndCopy(config, quiet, fullTargets) |