aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aur.nim10
-rw-r--r--src/common.nim70
-rw-r--r--src/feature/syncinfo.nim36
-rw-r--r--src/feature/syncinstall.nim183
-rw-r--r--src/feature/syncsource.nim7
-rw-r--r--src/package.nim82
6 files changed, 191 insertions, 197 deletions
diff --git a/src/aur.nim b/src/aur.nim
index 7d38fad..f4d6c91 100644
--- a/src/aur.nim
+++ b/src/aur.nim
@@ -34,10 +34,8 @@ proc parseRpcPackageInfo(obj: JsonNode, repo: string): Option[RpcPackageInfo] =
let popularity = obj["Popularity"].getFloat(0)
if base.len > 0 and name.len > 0:
- some(RpcPackageInfo(repo: repo, base: base, name: name, version: version,
- description: description, maintainer: maintainer,
- firstSubmitted: firstSubmitted, lastModified: lastModified, outOfDate: outOfDate,
- votes: votes, popularity: popularity, gitUrl: gitUrl(base), gitSubdir: none(string)))
+ some((repo, base, name, version, description, maintainer, firstSubmitted, lastModified,
+ outOfDate, votes, popularity, gitUrl(base), none(string)))
else:
none(RpcPackageInfo)
@@ -113,11 +111,11 @@ proc getAurPackageInfos*(pkgs: seq[string], repo: string, arch: string, useTimeo
let infos = lc[x | (y <- parsed, x <- y.infos), PackageInfo]
let errors = lc[x | (y <- parsed, x <- y.error), string]
- let table = infos.map(i => (i.name, i)).toTable
+ 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 additionalPkgInfos = infos.filter(i => not (i.name in names))
+ 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 5bd9e63..4412952 100644
--- a/src/common.nim
+++ b/src/common.nim
@@ -29,8 +29,8 @@ type
SyncPackageTarget* = object of PackageTarget
foundInfos*: seq[SyncFoundInfo]
- FullPackageTarget*[T] = object of SyncPackageTarget
- pkgInfo*: Option[T]
+ FullPackageTarget* = object of SyncPackageTarget
+ rpcInfo*: Option[RpcPackageInfo]
LookupBaseGroup = tuple[
base: string,
@@ -95,26 +95,18 @@ proc packageTargets*(args: seq[Argument], parseDestination: bool): seq[PackageTa
proc isAurTargetSync*(target: SyncPackageTarget, aurRepo: string): bool =
target.foundInfos.len == 0 and (target.repo.isNone or target.repo == some(aurRepo))
-proc isAurTargetFull*[T: RpcPackageInfo](target: FullPackageTarget[T], aurRepo: string): bool =
+proc isAurTargetFull*(target: SyncPackageTarget, aurRepo: string): bool =
target.foundInfos.len > 0 and target.foundInfos[0].repo == aurRepo
-proc filterNotFoundSyncTargetsInternal(syncTargets: seq[SyncPackageTarget],
- pkgInfoReferencesTable: Table[string, PackageReference],
- upToDateNeededTable: Table[string, PackageReference],
+proc filterNotFoundSyncTargets*(syncTargets: seq[SyncPackageTarget],
+ rpcInfos: seq[RpcPackageInfo], upToDateNeededTable: Table[string, PackageReference],
aurRepo: string): seq[SyncPackageTarget] =
- # collect packages which were found neither in sync DB nor in AUR
+ let pkgInfoReferencesTable = rpcInfos.map(i => (i.name, i.toPackageReference)).toTable
syncTargets.filter(t => not (upToDateNeededTable.opt(t.reference.name)
.map(r => t.reference.isProvidedBy(r, true)).get(false)) and t.foundInfos.len == 0 and
not (t.isAurTargetSync(aurRepo) and pkgInfoReferencesTable.opt(t.reference.name)
.map(r => t.reference.isProvidedBy(r, true)).get(false)))
-proc filterNotFoundSyncTargets*[T: RpcPackageInfo](syncTargets: seq[SyncPackageTarget],
- pkgInfos: seq[T], upToDateNeededTable: Table[string, PackageReference],
- aurRepo: string): seq[SyncPackageTarget] =
- let pkgInfoReferencesTable = pkgInfos.map(i => (i.name, i.toPackageReference)).toTable
- filterNotFoundSyncTargetsInternal(syncTargets,
- pkgInfoReferencesTable, upToDateNeededTable, aurRepo)
-
proc printSyncNotFound*(config: Config, notFoundTargets: seq[SyncPackageTarget]) =
let dbs = config.common.dbs.toSet
@@ -186,27 +178,29 @@ proc findSyncTargets*(handle: ptr AlpmHandle, dbs: seq[ptr AlpmDatabase],
let checkAurNames = syncTargets.filter(t => t.isAurTargetSync(aurRepo)).map(t => t.reference.name)
(syncTargets, checkAurNames)
-proc mapAurTargets*[T: RpcPackageInfo](targets: seq[SyncPackageTarget],
- pkgInfos: seq[T], aurRepo: string): seq[FullPackageTarget[T]] =
- let aurTable = pkgInfos.map(i => (i.name, i)).toTable
+proc mapAurTargets*(targets: seq[SyncPackageTarget], rpcInfos: seq[RpcPackageInfo],
+ aurRepo: string): seq[FullPackageTarget] =
+ let aurTable = rpcInfos.map(i => (i.name, i)).toTable
- targets.map(proc (target: SyncPackageTarget): FullPackageTarget[T] =
+ targets.map(proc (target: SyncPackageTarget): FullPackageTarget =
let res = if target.foundInfos.len == 0 and aurTable.hasKey(target.reference.name): (block:
- let pkgInfo = aurTable[target.reference.name]
- if target.reference.isProvidedBy(pkgInfo.toPackageReference, true):
- some(((aurRepo, some((pkgInfo.base, pkgInfo.version, none(string)))), pkgInfo))
+ let rpcInfo = aurTable[target.reference.name]
+ if target.reference.isProvidedBy(rpcInfo.toPackageReference, true):
+ some(((aurRepo, some((rpcInfo.base, rpcInfo.version, none(string)))), rpcInfo))
else:
- none((SyncFoundInfo, T)))
+ none((SyncFoundInfo, RpcPackageInfo)))
else:
- none((SyncFoundInfo, T))
+ none((SyncFoundInfo, RpcPackageInfo))
if res.isSome:
- let (syncInfo, pkgInfo) = res.get
- FullPackageTarget[T](reference: target.reference, repo: target.repo,
- destination: target.destination, foundInfos: @[syncInfo], pkgInfo: some(pkgInfo))
+ let (syncInfo, rpcInfo) = res.get
+ FullPackageTarget(reference: target.reference, repo: target.repo,
+ destination: target.destination, foundInfos: @[syncInfo],
+ rpcInfo: some(rpcInfo))
else:
- FullPackageTarget[T](reference: target.reference, repo: target.repo,
- destination: target.destination, foundInfos: target.foundInfos, pkgInfo: none(T)))
+ FullPackageTarget(reference: target.reference, repo: target.repo,
+ destination: target.destination, foundInfos: target.foundInfos,
+ rpcInfo: none(RpcPackageInfo)))
proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptional: bool,
assumeExplicit: HashSet[string]): (seq[PackageReference], HashSet[string], HashSet[string],
@@ -463,8 +457,8 @@ proc obtainSrcInfo*(path: string): string =
proc reloadPkgInfos*(config: Config, path: string, pkgInfos: seq[PackageInfo]): seq[PackageInfo] =
let srcInfo = obtainSrcInfo(path)
- let res = parseSrcInfo(pkgInfos[0].repo, srcInfo, config.common.arch,
- pkgInfos[0].gitUrl, pkgInfos[0].gitSubdir)
+ let res = parseSrcInfo(pkgInfos[0].rpc.repo, srcInfo, config.common.arch,
+ pkgInfos[0].rpc.gitUrl, pkgInfos[0].rpc.gitSubdir)
if res.len > 0:
res
else:
@@ -611,7 +605,7 @@ proc obtainBuildPkgInfosInternal(config: Config, bases: seq[LookupBaseGroup],
let srcInfo = obtainSrcInfo(repoPath.unsafeGet & "/" & git.path)
let pkgInfos = parseSrcInfo(repo, srcInfo, config.common.arch,
git.url, some(git.path))
- .filter(i => i.version == version)
+ .filter(i => i.rpc.version == version)
(pkgInfos, repoPath)
else:
(newSeq[PackageInfo](), none(string))
@@ -628,7 +622,7 @@ proc obtainBuildPkgInfosInternal(config: Config, bases: seq[LookupBaseGroup],
let pkgInfos = lc[x | (y <- pkgInfosWithPaths, x <- y.pkgInfos), PackageInfo]
let paths = lc[x | (y <- pkgInfosWithPaths, x <- y.path), string]
- let pkgInfosTable = pkgInfos.map(i => (i.name, i)).toTable
+ let pkgInfosTable = pkgInfos.map(i => (i.rpc.name, i)).toTable
let foundPkgInfos = lc[x | (y <- pacmanTargetNames,
x <- pkgInfosTable.opt(y)), PackageInfo]
@@ -642,11 +636,11 @@ proc obtainBuildPkgInfosInternal(config: Config, bases: seq[LookupBaseGroup],
discard rmdir(config.tmpRoot(dropPrivileges))
(foundPkgInfos, paths, errorMessages)
-proc obtainBuildPkgInfos*[T: RpcPackageInfo](config: Config,
- pacmanTargets: seq[FullPackageTarget[T]], progressCallback: (int, int) -> void,
- dropPrivileges: bool): (seq[PackageInfo], seq[string], seq[string]) =
+proc obtainBuildPkgInfos*(config: Config, pacmanTargets: seq[FullPackageTarget],
+ progressCallback: (int, int) -> void, dropPrivileges: bool):
+ (seq[PackageInfo], seq[string], seq[string]) =
let bases = pacmanTargets
- .map(proc (target: FullPackageTarget[T]): LookupBaseGroup =
+ .map(proc (target: FullPackageTarget): LookupBaseGroup =
let info = target.foundInfos[0]
let pkg = info.pkg.get
(pkg.base, pkg.version, pkg.arch.get, info.repo))
@@ -740,11 +734,11 @@ proc cloneAurReposWithPackageInfos*(config: Config, rpcInfos: seq[RpcPackageInfo
cloneNext(index + 1, addPkgInfos ^& pkgInfos, paths, errors)
let (fullPkgInfos, paths, errors) = cloneNext(0, nil, nil, nil)
- let pkgInfosTable = fullPkgInfos.map(i => (i.name, i)).toTable
+ 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 additionalPkgInfos = fullPkgInfos.filter(i => not (i.name in names))
+ let additionalPkgInfos = fullPkgInfos.filter(i => not (i.rpc.name in names))
discard rmdir(config.tmpRoot(dropPrivileges))
(resultPkgInfos, additionalPkgInfos, paths, errors)
diff --git a/src/feature/syncinfo.nim b/src/feature/syncinfo.nim
index 83f900b..39d682a 100644
--- a/src/feature/syncinfo.nim
+++ b/src/feature/syncinfo.nim
@@ -1,5 +1,5 @@
import
- future, options, posix, sequtils, strutils, times,
+ future, options, posix, sequtils, strutils, tables, times,
"../args", "../aur", "../common", "../config", "../format", "../package",
"../pacman", "../utils",
"../wrapper/alpm"
@@ -57,16 +57,16 @@ proc formatDate(date: int64): Option[string] =
if res > 0: some(buffer.toString(none(int))) else: none(string)
proc handleTarget(config: Config, padding: int, args: seq[Argument],
- target: FullPackageTarget[PackageInfo]): int =
+ target: FullPackageTarget, pkgInfoOption: Option[PackageInfo]): int =
if target.foundInfos.len > 0:
- if isAurTargetFull[PackageInfo](target, config.aurRepo):
- let pkgInfo = target.pkgInfo.unsafeGet
+ if isAurTargetFull(target, config.aurRepo):
+ let pkgInfo = pkgInfoOption.get
printPackageInfo(padding, config.color,
(trp"Repository", @[config.aurRepo], false),
- (trp"Name", @[pkgInfo.name], false),
- (trp"Version", @[pkgInfo.version], false),
- (trp"Description", toSeq(pkgInfo.description.items), false),
+ (trp"Name", @[pkgInfo.rpc.name], false),
+ (trp"Version", @[pkgInfo.rpc.version], false),
+ (trp"Description", toSeq(pkgInfo.rpc.description.items), false),
(trp"Architecture", pkgInfo.archs, false),
(trp"URL", toSeq(pkgInfo.url.items), false),
(trp"Licenses", pkgInfo.licenses, false),
@@ -76,11 +76,14 @@ proc handleTarget(config: Config, padding: int, args: seq[Argument],
formatDeps(trp"Optional Deps", config, pkgInfo.optional),
formatDeps(trp"Conflicts With", config, pkgInfo.conflicts),
formatDeps(trp"Replaces", config, pkgInfo.replaces),
- (tr"Maintainer", toSeq(pkgInfo.maintainer.items()), false),
- (tr"First Submitted", toSeq(pkgInfo.firstSubmitted.map(formatDate).flatten.items()), false),
- (tr"Last Modified", toSeq(pkgInfo.lastModified.map(formatDate).flatten.items()), false),
- (tr"Out Of Date", toSeq(pkgInfo.outOfDate.map(formatDate).flatten.items()), false),
- (tr"Rating", @[formatPkgRating(pkgInfo.votes, pkgInfo.popularity)], false))
+ (tr"Maintainer", toSeq(pkgInfo.rpc.maintainer.items()), false),
+ (tr"First Submitted", toSeq(pkgInfo.rpc.firstSubmitted
+ .map(formatDate).flatten.items()), false),
+ (tr"Last Modified", toSeq(pkgInfo.rpc.lastModified
+ .map(formatDate).flatten.items()), false),
+ (tr"Out Of Date", toSeq(pkgInfo.rpc.outOfDate
+ .map(formatDate).flatten.items()), false),
+ (tr"Rating", @[formatPkgRating(pkgInfo.rpc.votes, pkgInfo.rpc.popularity)], false))
0
elif target.reference.constraint.isSome:
@@ -112,10 +115,10 @@ proc handleSyncInfo*(args: seq[Argument], config: Config): int =
config.aurRepo, config.common.arch, config.common.downloadTimeout)
for e in aerrors: printError(config.color, e)
- let fullTargets = mapAurTargets[PackageInfo](syncTargets, pkgInfos, config.aurRepo)
+ let fullTargets = mapAurTargets(syncTargets, pkgInfos.map(p => p.rpc), config.aurRepo)
let code = min(aerrors.len, 1)
- if fullTargets.filter(t => isAurTargetFull[PackageInfo](t, config.aurRepo) or
+ if fullTargets.filter(t => isAurTargetFull(t, config.aurRepo) or
t.repo == some(config.aurRepo) or t.reference.constraint.isSome).len == 0:
if code == 0:
pacmanExec(false, config.color, callArgs)
@@ -125,6 +128,9 @@ proc handleSyncInfo*(args: seq[Argument], config: Config): int =
else:
let finalArgs = callArgs.filter(arg => not arg.isTarget)
let padding = pacmanInfoStrings.map(s => s.trp).computeMaxLength
+ let pkgInfosTable = pkgInfos.map(i => (i.rpc.toPackageReference, i)).toTable
- let codes = code & lc[handleTarget(config, padding, finalArgs, x) | (x <- fullTargets), int]
+ let codes = code & lc[handleTarget(config, padding, finalArgs, x,
+ x.rpcInfo.map(i => pkgInfosTable.opt(i.toPackageReference)).flatten) |
+ (x <- fullTargets), int]
codes.filter(c => c != 0).optFirst.get(0)
diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim
index 903dba1..19fd3ce 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.name | (a <- ordered, b <- a, c <- b), string].toSet
+ let orderedNamesSet = lc[c.rpc.name | (a <- ordered, b <- a, c <- b), string].toSet
proc hasBuildDependency(pkgInfos: seq[PackageInfo]): bool =
for pkgInfo in pkgInfos:
@@ -74,7 +74,7 @@ proc orderInstallation(ordered: seq[seq[seq[PackageInfo]]], grouped: seq[seq[Pac
for satres in satisfied.opt(reference):
if satres.buildPkgInfo.isSome and
not (satres.buildPkgInfo.unsafeGet in pkgInfos) and
- not (satres.buildPkgInfo.unsafeGet.name in orderedNamesSet):
+ not (satres.buildPkgInfo.unsafeGet.rpc.name in orderedNamesSet):
return true
return false
@@ -94,7 +94,7 @@ proc orderInstallation(ordered: seq[seq[seq[PackageInfo]]], grouped: seq[seq[Pac
proc orderInstallation(pkgInfos: seq[PackageInfo],
satisfied: Table[PackageReference, SatisfyResult]): seq[seq[seq[PackageInfo]]] =
- let grouped = pkgInfos.groupBy(i => i.base).map(p => p.values)
+ let grouped = pkgInfos.groupBy(i => i.rpc.base).map(p => p.values)
orderInstallation(@[], grouped, satisfied)
.map(x => x.filter(s => s.len > 0))
@@ -120,7 +120,7 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle, dbs: seq[ptr AlpmD
if res.buildPkgInfo.isSome:
let pkgInfo = res.buildPkgInfo.unsafeGet
if satref == reference or reference
- .isProvidedBy(pkgInfo.toPackageReference, nodepsCount == 0):
+ .isProvidedBy(pkgInfo.rpc.toPackageReference, nodepsCount == 0):
return some(pkgInfo)
for provides in pkgInfo.provides:
if reference.isProvidedBy(provides, nodepsCount == 0) and
@@ -130,7 +130,7 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle, dbs: seq[ptr AlpmD
proc findInAdditional(reference: PackageReference): Option[PackageInfo] =
for pkgInfo in additionalPkgInfos:
- if reference.isProvidedBy(pkgInfo.toPackageReference, nodepsCount == 0):
+ if reference.isProvidedBy(pkgInfo.rpc.toPackageReference, nodepsCount == 0):
return some(pkgInfo)
for provides in pkgInfo.provides:
if reference.isProvidedBy(provides, nodepsCount == 0) and
@@ -182,11 +182,11 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle, dbs: seq[ptr AlpmD
else:
let pkgInfo = findInSatisfied(reference)
if pkgInfo.isSome:
- some((false, pkgInfo.unsafeGet.name, pkgInfo))
+ some((false, pkgInfo.unsafeGet.rpc.name, pkgInfo))
else:
let pkgInfo = findInAdditional(reference)
if pkgInfo.isSome:
- some((false, pkgInfo.unsafeGet.name, pkgInfo))
+ some((false, pkgInfo.unsafeGet.rpc.name, pkgInfo))
else:
let syncName = findInDatabases(reference, false, true)
if syncName.isSome:
@@ -221,8 +221,8 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle, dbs: seq[ptr AlpmD
for e in cerrors: printError(config.color, e)
(pkgInfos, additionalPkgInfos, paths))
- let acceptedPkgInfos = pkgInfos.filter(i => not config.ignored(i.name, i.groups))
- let aurTable = acceptedPkgInfos.map(i => (i.name, i)).toTable
+ let acceptedPkgInfos = pkgInfos.filter(i => not config.ignored(i.rpc.name, i.groups))
+ let aurTable = acceptedPkgInfos.map(i => (i.rpc.name, i)).toTable
let aurResult = aurCheck.map(proc (reference: PackageReference): ReferenceResult =
if aurTable.hasKey(reference.name):
(reference, some((false, reference.name, some(aurTable[reference.name]))))
@@ -259,8 +259,8 @@ proc findDependencies(config: Config, handle: ptr AlpmHandle,
dbs: seq[ptr AlpmDatabase], pkgInfos: seq[PackageInfo], additionalPkgInfos: seq[PackageInfo],
nodepsCount: int, assumeInstalled: seq[PackageReference], printMode: bool, noaur: bool):
(Table[PackageReference, SatisfyResult], seq[PackageReference], seq[string]) =
- let satisfied = pkgInfos.map(p => ((p.name, none(string), none(VersionConstraint)),
- (false, p.name, some(p)))).toTable
+ let satisfied = pkgInfos.map(p => ((p.rpc.name, none(string), none(VersionConstraint)),
+ (false, p.rpc.name, some(p)))).toTable
let unsatisfied = lc[x | (i <- pkgInfos, x <- i.allDepends), PackageReference].deduplicate
findDependencies(config, handle, dbs, satisfied, unsatisfied, @[],
additionalPkgInfos, @[], nodepsCount, assumeInstalled, printMode, noaur)
@@ -279,7 +279,7 @@ proc printUnsatisfied(config: Config,
if reference in unsatisfied:
printError(config.color,
trp("unable to satisfy dependency '%s' required by %s\n") %
- [$reference, pkgInfo.name])
+ [$reference, pkgInfo.rpc.name])
template dropPrivilegesAndChdir(path: Option[string], body: untyped): int =
if dropPrivileges():
@@ -385,9 +385,9 @@ proc editLoop(config: Config, repo: string, base: string, repoPath: string,
proc buildLoop(config: Config, pkgInfos: seq[PackageInfo], skipDeps: bool,
noconfirm: bool, noextract: bool): (Option[BuildResult], int, bool) =
- let base = pkgInfos[0].base
+ let base = pkgInfos[0].rpc.base
let repoPath = repoPath(config.tmpRootInitial, base)
- let gitSubdir = pkgInfos[0].gitSubdir
+ let gitSubdir = pkgInfos[0].rpc.gitSubdir
let buildPath = buildPath(repoPath, gitSubdir)
let confFileEnv = getEnv("MAKEPKG_CONF")
@@ -460,9 +460,9 @@ proc buildLoop(config: Config, pkgInfos: seq[PackageInfo], skipDeps: bool,
type ResultInfo = tuple[name: string, baseIndex: int, pkgInfo: Option[PackageInfo]]
- let resultPkgInfosTable = resultPkgInfos.map(i => (i.name, i)).toTable
+ let resultPkgInfosTable = resultPkgInfos.map(i => (i.rpc.name, i)).toTable
let resultByNames: seq[ResultInfo] = pkgInfos
- .map(i => (i.name, i.baseIndex, resultPkgInfosTable.opt(i.name)))
+ .map(i => (i.rpc.name, i.baseIndex, resultPkgInfosTable.opt(i.rpc.name)))
let resultByIndices: seq[ResultInfo] = if pkgInfos[0].baseCount == resultPkgInfos.len:
resultByNames.map(res => (block:
@@ -482,21 +482,21 @@ 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.name).toSet
+ let filterNames = targetPkgInfos.map(r => r.pkgInfo.rpc.name).toSet
let additionalPkgInfos: seq[ReplacePkgInfo] = resultPkgInfos
- .filter(i => not (i.name in filterNames))
+ .filter(i => not (i.rpc.name in filterNames))
.map(i => (none(string), i))
(some(($confExt, targetPkgInfos & additionalPkgInfos)), 0, false)
proc buildFromSources(config: Config, commonArgs: seq[Argument],
pkgInfos: seq[PackageInfo], skipDeps: bool, noconfirm: bool): (Option[BuildResult], int) =
- let base = pkgInfos[0].base
+ let base = pkgInfos[0].rpc.base
let repoPath = repoPath(config.tmpRootInitial, base)
- let gitSubdir = pkgInfos[0].gitSubdir
+ let gitSubdir = pkgInfos[0].rpc.gitSubdir
proc loop(noextract: bool, showEditLoop: bool): (Option[BuildResult], int) =
let res = if showEditLoop and not noconfirm:
- editLoop(config, pkgInfos[0].repo, base, repoPath, gitSubdir, false, noconfirm)
+ editLoop(config, pkgInfos[0].rpc.repo, base, repoPath, gitSubdir, false, noconfirm)
else:
'n'
@@ -561,12 +561,12 @@ proc installGroupFromSources(config: Config, commonArgs: seq[Argument],
proc formatArchiveFile(pkgInfo: PackageInfo, ext: string): string =
let arch = if pkgInfo.archs.len > 0: config.common.arch else: "any"
- config.tmpRootInitial & "/" & pkgInfo.name & "-" & pkgInfo.version & "-" & arch & ext
+ config.tmpRootInitial & "/" & pkgInfo.rpc.name & "-" & pkgInfo.rpc.version & "-" & arch & ext
let allFiles = lc[(r.name, formatArchiveFile(r.pkgInfo, br.ext)) |
(br <- buildResults, r <- br.replacePkgInfos), tuple[name: Option[string], file: string]]
let filesTable = allFiles.filter(f => f.name.isSome).map(f => (f.name.unsafeGet, f.file)).toTable
- let install = lc[(i.name, x) | (g <- basePackages, i <- g, x <- filesTable.opt(i.name)),
+ let install = lc[(i.rpc.name, x) | (g <- basePackages, i <- g, x <- filesTable.opt(i.rpc.name)),
tuple[name: string, file: string]]
proc handleTmpRoot(clear: bool) =
@@ -641,9 +641,9 @@ proc installGroupFromSources(config: Config, commonArgs: seq[Argument],
else:
let cachePath = config.userCacheInitial.cache(CacheKind.repositories)
for pkgInfos in basePackages:
- let repo = pkgInfos[0].repo
+ let repo = pkgInfos[0].rpc.repo
if repo == config.aurRepo:
- let base = pkgInfos[0].base
+ let base = pkgInfos[0].rpc.base
let fullName = bareFullName(BareKind.pkg, base)
let bareRepoPath = repoPath(cachePath, fullName)
let tag = createViewTag(repo, base)
@@ -662,16 +662,16 @@ proc installGroupFromSources(config: Config, commonArgs: seq[Argument],
run(gitCmd, "-C", bareRepoPath, "tag", tag)
handleTmpRoot(true)
- let installedAs = lc[(r.name.unsafeGet, r.pkgInfo.name) | (br <- buildResults,
+ let installedAs = lc[(r.name.unsafeGet, r.pkgInfo.rpc.name) | (br <- buildResults,
r <- br.replacePkgInfos, r.name.isSome), (string, string)]
(installedAs, 0)
proc deduplicatePkgInfos(pkgInfos: seq[PackageInfo],
config: Config, printWarning: bool): seq[PackageInfo] =
pkgInfos.foldl(block:
- if a.map(t => t.name).contains(b.name):
+ if a.map(i => i.rpc.name).contains(b.rpc.name):
if printWarning:
- printWarning(config.color, trp("skipping target: %s\n") % [b.name])
+ printWarning(config.color, trp("skipping target: %s\n") % [b.rpc.name])
a
else:
a & b,
@@ -694,9 +694,9 @@ proc resolveDependencies(config: Config, pkgInfos: seq[PackageInfo],
(false, satisfied, newSeq[string](),
newSeq[seq[seq[PackageInfo]]](), newSeq[string]())
else:
- let buildAndAurNamesSet = pkgInfos.map(i => i.name).toSet
+ let buildAndAurNamesSet = pkgInfos.map(i => i.rpc.name).toSet
let fullPkgInfos = (pkgInfos & lc[i | (s <- satisfied.values,
- i <- s.buildPkgInfo, not (i.name in buildAndAurNamesSet)), PackageInfo])
+ i <- s.buildPkgInfo, not (i.rpc.name in buildAndAurNamesSet)), PackageInfo])
.deduplicatePkgInfos(config, false)
let additionalPacmanTargets = lc[x.name | (x <- satisfied.values,
@@ -711,7 +711,7 @@ proc confirmViewAndImportKeys(config: Config, basePackages: seq[seq[seq[PackageI
let installedVersions = installed.map(i => (i.name, i.version)).toTable
printPackages(config.color, config.common.verbosePkgLists,
- lc[(i.name, i.repo, installedVersions.opt(i.name), i.version) |
+ lc[(i.rpc.name, i.rpc.repo, installedVersions.opt(i.rpc.name), i.rpc.version) |
(g <- basePackages, b <- g, i <- b), PackageInstallFormat]
.sorted((a, b) => cmp(a.name, b.name)))
let input = printColonUserChoice(config.color,
@@ -723,8 +723,8 @@ proc confirmViewAndImportKeys(config: Config, basePackages: seq[seq[seq[PackageI
proc checkNext(index: int, skipEdit: bool, skipKeys: bool): int =
if index < flatBasePackages.len:
let pkgInfos = flatBasePackages[index]
- let repo = pkgInfos[0].repo
- let base = pkgInfos[0].base
+ let repo = pkgInfos[0].rpc.repo
+ let base = pkgInfos[0].rpc.base
let repoPath = repoPath(config.tmpRootInitial, base)
let aur = repo == config.aurRepo
@@ -735,19 +735,20 @@ proc confirmViewAndImportKeys(config: Config, basePackages: seq[seq[seq[PackageI
for e in error: printError(config.color, e)
if comments.len > 0:
let commentsReversed = toSeq(comments.reversed)
- printComments(config.color, pkgInfos[0].maintainer, commentsReversed)
+ printComments(config.color, pkgInfos[0].rpc.maintainer, commentsReversed)
let editRes = if skipEdit or noconfirm:
'n'
else: (block:
let defaultYes = aur and not config.viewNoDefault
- editLoop(config, repo, base, repoPath, pkgInfos[0].gitSubdir, defaultYes, noconfirm))
+ editLoop(config, repo, base, repoPath, pkgInfos[0].rpc.gitSubdir,
+ defaultYes, noconfirm))
if editRes == 'a':
1
else:
let resultPkgInfos = reloadPkgInfos(config,
- repoPath & "/" & pkgInfos[0].gitSubdir.get("."), pkgInfos)
+ repoPath & "/" & pkgInfos[0].rpc.gitSubdir.get("."), pkgInfos)
let pgpKeys = lc[x | (p <- resultPkgInfos, x <- p.pgpKeys), string].deduplicate
proc keysLoop(index: int, skipKeys: bool): char =
@@ -837,7 +838,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.name).toSet
+ let acceptedSet = acceptedPkgInfos.map(i => i.rpc.name).toSet
if upgradeCount > 0 and not noaur and config.printAurNotFound:
let rpcInfoTable = rpcInfos.map(i => (i.name, i)).toTable
@@ -863,42 +864,42 @@ proc printAllWarnings(config: Config, installed: seq[Installed], rpcInfos: seq[R
for pkgInfo in pkgInfos:
let installedTable = installed.map(i => (i.name, i)).toTable
- if not (pkgInfo.name in acceptedSet):
- if not (pkgInfo.name in targetNamesSet) and upgradeCount > 0 and
- installedTable.hasKey(pkgInfo.name):
- let installedVersion = installedTable[pkgInfo.name].version
- let newVersion = pkgInfo.version
+ if not (pkgInfo.rpc.name in acceptedSet):
+ if not (pkgInfo.rpc.name in targetNamesSet) and upgradeCount > 0 and
+ installedTable.hasKey(pkgInfo.rpc.name):
+ let installedVersion = installedTable[pkgInfo.rpc.name].version
+ let newVersion = pkgInfo.rpc.version
if vercmp(newVersion, installedVersion) < 0:
printWarning(config.color, tra("%s: ignoring package downgrade (%s => %s)\n") %
- [pkgInfo.name, installedVersion, newVersion])
+ [pkgInfo.rpc.name, installedVersion, newVersion])
else:
printWarning(config.color, tra("%s: ignoring package upgrade (%s => %s)\n") %
- [pkgInfo.name, installedVersion, newVersion])
+ [pkgInfo.rpc.name, installedVersion, newVersion])
else:
- printWarning(config.color, trp("skipping target: %s\n") % [pkgInfo.name])
- elif pkgInfo.repo == config.aurRepo:
- if pkgInfo.maintainer.isNone:
- printWarning(config.color, tr"$# is orphaned" % [pkgInfo.name])
- if installedTable.hasKey(pkgInfo.name):
- let installedVersion = installedTable[pkgInfo.name].version
- let newVersion = pkgInfo.version
- if vercmp(newVersion, installedVersion) < 0 and not pkgInfo.name.isVcs:
+ printWarning(config.color, trp("skipping target: %s\n") % [pkgInfo.rpc.name])
+ elif pkgInfo.rpc.repo == config.aurRepo:
+ if pkgInfo.rpc.maintainer.isNone:
+ printWarning(config.color, tr"$# is orphaned" % [pkgInfo.rpc.name])
+ if installedTable.hasKey(pkgInfo.rpc.name):
+ let installedVersion = installedTable[pkgInfo.rpc.name].version
+ let newVersion = pkgInfo.rpc.version
+ if vercmp(newVersion, installedVersion) < 0 and not pkgInfo.rpc.name.isVcs:
printWarning(config.color,
tra("%s: downgrading from version %s to version %s\n") %
- [pkgInfo.name, installedVersion, newVersion])
+ [pkgInfo.rpc.name, installedVersion, newVersion])
proc filterIgnoresAndConflicts(config: Config, pkgInfos: seq[PackageInfo],
targetNamesSet: HashSet[string], installed: Table[string, Installed],
printMode: bool, noconfirm: bool): (seq[PackageInfo], seq[PackageInfo]) =
let acceptedPkgInfos = pkgInfos.filter(pkgInfo => (block:
- let instGroups = lc[x | (i <- installed.opt(pkgInfo.name),
+ let instGroups = lc[x | (i <- installed.opt(pkgInfo.rpc.name),
x <- i.groups), string]
- if config.ignored(pkgInfo.name, (instGroups & pkgInfo.groups).deduplicate):
- if pkgInfo.name in targetNamesSet:
+ if config.ignored(pkgInfo.rpc.name, (instGroups & pkgInfo.groups).deduplicate):
+ if pkgInfo.rpc.name in targetNamesSet:
if not printMode:
let input = printColonUserChoice(config.color,
- trp"%s is in IgnorePkg/IgnoreGroup. Install anyway?" % [pkgInfo.name],
+ trp"%s is in IgnorePkg/IgnoreGroup. Install anyway?" % [pkgInfo.rpc.name],
['y', 'n'], 'y', 'n', noconfirm, 'y')
input != 'n'
else:
@@ -909,15 +910,15 @@ proc filterIgnoresAndConflicts(config: Config, pkgInfos: seq[PackageInfo],
true))
let nonConflicingPkgInfos = acceptedPkgInfos.foldl(block:
- let conflictsWith = lc[p | (p <- a, p.name != b.name and
- (lc[0 | (c <- b.conflicts, c.isProvidedBy(p.toPackageReference, true)), int].len > 0 or
- lc[0 | (c <- p.conflicts, c.isProvidedBy(b.toPackageReference, true)), int].len > 0)),
+ let conflictsWith = lc[p | (p <- a, p.rpc.name != b.rpc.name and
+ (lc[0 | (c <- b.conflicts, c.isProvidedBy(p.rpc.toPackageReference, true)), int].len > 0 or
+ lc[0 | (c <- p.conflicts, c.isProvidedBy(b.rpc.toPackageReference, true)), int].len > 0)),
PackageInfo]
if not printMode and conflictsWith.len > 0:
for conflict in conflictsWith:
printWarning(config.color,
tra("removing '%s' from target list because it conflicts with '%s'\n") %
- [b.name, conflict.name])
+ [b.rpc.name, conflict.rpc.name])
a
else:
a & b,
@@ -936,11 +937,11 @@ proc checkNeeded(installed: Table[string, Installed],
(true, 0)
proc obtainAurPackageInfos(config: Config, rpcInfos: seq[RpcPackageInfo],
- rpcAurTargets: seq[FullPackageTarget[RpcPackageInfo]], installed: Table[string, Installed],
+ rpcAurTargets: seq[FullPackageTarget], installed: Table[string, Installed],
printMode: bool, needed: bool, upgradeCount: int): (seq[PackageInfo], seq[PackageInfo],
seq[string], seq[Installed], seq[LocalIsNewer], seq[string]) =
let targetRpcInfoPairs: seq[tuple[rpcInfo: RpcPackageInfo, upgradeable: bool]] =
- rpcAurTargets.map(t => t.pkgInfo.get).map(i => (i, installed
+ rpcAurTargets.map(t => t.rpcInfo.get).map(i => (i, installed
.checkNeeded(i.name, i.version, true).needed))
let upToDateNeeded: seq[Installed] = if needed:
@@ -997,12 +998,12 @@ proc obtainAurPackageInfos(config: Config, rpcInfos: seq[RpcPackageInfo],
(pkgInfos, additionalPkgInfos, paths, upToDateNeeded, localIsNewerSeq, errors)
-proc obtainPacmanBuildTargets(config: Config, pacmanTargets: seq[FullPackageTarget[PackageInfo]],
+proc obtainPacmanBuildTargets(config: Config, pacmanTargets: seq[FullPackageTarget],
installedTable: Table[string, Installed], printMode: bool, needed: bool, build: bool):
(bool, seq[PackageInfo], seq[(string, string)], seq[string], seq[string]) =
let (neededPacmanBuildTargets, buildUpToDateNeeded) = if not printMode and
build and needed: (block:
- let neededPairs: seq[tuple[target: FullPackageTarget[PackageInfo],
+ let neededPairs: seq[tuple[target: FullPackageTarget,
skipVersion: Option[string]]] = pacmanTargets.map(target => (block:
let version = target.foundInfos[0].pkg.get.version
if installedTable.checkNeeded(target.reference.name, version, true).needed:
@@ -1027,7 +1028,7 @@ proc obtainPacmanBuildTargets(config: Config, pacmanTargets: seq[FullPackageTarg
let (buildPkgInfos, buildPaths, obtainErrorMessages) = if checkPacmanBuildPkgInfos: (block:
echo(tr"checking official repositories...")
let (update, terminate) = createCloneProgress(config, pacmanTargets.len, false, printMode)
- let res = obtainBuildPkgInfos[PackageInfo](config, pacmanTargets, update, true)
+ let res = obtainBuildPkgInfos(config, pacmanTargets, update, true)
terminate()
res)
else:
@@ -1035,8 +1036,7 @@ proc obtainPacmanBuildTargets(config: Config, pacmanTargets: seq[FullPackageTarg
(checkPacmanBuildPkgInfos, buildPkgInfos, buildUpToDateNeeded, buildPaths, obtainErrorMessages)
-proc obtainInstalledWithAur(config: Config,
- rpcAurTargets: seq[FullPackageTarget[RpcPackageInfo]]): (seq[Installed], seq[string]) =
+proc obtainInstalledWithAur(config: Config): (seq[Installed], seq[string]) =
withAlpmConfig(config, true, handle, dbs, errors):
for e in errors: printError(config.color, e)
@@ -1053,13 +1053,13 @@ proc obtainInstalledWithAur(config: Config,
(installed, checkAurUpgradeNames)
proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget],
- rpcFullTargets: seq[FullPackageTarget[RpcPackageInfo]], printHeader: bool,
+ 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](),
newSeq[PackageInfo](), newSeq[PackageInfo](), newSeq[string]())
- let (installed, checkAurUpgradeNames) = obtainInstalledWithAur(config, rpcFullTargets)
+ let (installed, checkAurUpgradeNames) = obtainInstalledWithAur(config)
let checkAur = not noaur and checkAurUpgradeNames.len > 0 and upgradeCount > 0
if not printMode and (checkAur or build) and printHeader:
@@ -1076,9 +1076,9 @@ proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget],
@[]
let installedTable = installed.map(i => (i.name, i)).toTable
- let rpcAurTargets = rpcFullTargets.filter(t => t.isAurTargetFull(config.aurRepo))
+ let rpcAurTargets = fullTargets.filter(t => t.isAurTargetFull(config.aurRepo))
- let targetRpcInfos = lc[x | (t <- rpcAurTargets, x <- t.pkgInfo), RpcPackageInfo]
+ let targetRpcInfos = lc[x | (t <- rpcAurTargets, x <- t.rpcInfo), RpcPackageInfo]
let targetRpcInfoNames = targetRpcInfos.map(i => i.name).toSet
let rpcInfos = targetRpcInfos & upgradeRpcInfos.filter(i => not (i.name in targetRpcInfoNames))
@@ -1090,7 +1090,7 @@ proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget],
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, config.aurRepo)
+ aurPkgInfos.map(p => p.rpc), upToDateNeededTable, config.aurRepo)
if notFoundTargets.len > 0:
clearPaths(aurPaths)
@@ -1099,7 +1099,8 @@ proc resolveBuildTargets(config: Config, syncTargets: seq[SyncPackageTarget],
else:
let fullTargets = mapAurTargets(syncTargets
.filter(t => not (upToDateNeededTable.opt(t.reference.name)
- .map(r => t.reference.isProvidedBy(r, true)).get(false))), aurPkgInfos, config.aurRepo)
+ .map(r => t.reference.isProvidedBy(r, true)).get(false))),
+ aurPkgInfos.map(p => p.rpc), config.aurRepo)
let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t, config.aurRepo))
let aurTargets = fullTargets.filter(t => isAurTargetFull(t, config.aurRepo))
@@ -1134,9 +1135,9 @@ proc assumeInstalled(args: seq[Argument]): seq[PackageReference] =
r.constraint.unsafeGet.operation == ConstraintOperation.eq)
proc handleInstall(args: seq[Argument], config: Config, syncTargets: seq[SyncPackageTarget],
- rpcFullTargets: seq[FullPackageTarget[RpcPackageInfo]], upgradeCount: int, nodepsCount: int,
+ fullTargets: seq[FullPackageTarget], upgradeCount: int, nodepsCount: int,
wrapUpgrade: bool, noconfirm: bool, needed: bool, build: bool, noaur: bool): int =
- let pacmanTargets = rpcFullTargets.filter(t => not isAurTargetFull(t, config.aurRepo))
+ let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t, config.aurRepo))
let workDirectPacmanTargets = if build: @[] else: pacmanTargets.map(`$`)
@@ -1152,7 +1153,7 @@ proc handleInstall(args: seq[Argument], config: Config, syncTargets: seq[SyncPac
directCode
else:
let (resolveTargetsCode, installed, targetNamesSet, pkgInfos, additionalPkgInfos,
- initialPaths) = resolveBuildTargets(config, syncTargets, rpcFullTargets,
+ initialPaths) = resolveBuildTargets(config, syncTargets, fullTargets,
directSome or wrapUpgrade, false, upgradeCount, noconfirm, needed, noaur, build)
if resolveTargetsCode != 0:
@@ -1264,20 +1265,20 @@ proc handleInstall(args: seq[Argument], config: Config, syncTargets: seq[SyncPac
else:
code
else:
- let aurTargets = rpcFullTargets.filter(t => isAurTargetFull(t, config.aurRepo))
+ let aurTargets = fullTargets.filter(t => isAurTargetFull(t, config.aurRepo))
if (not noaur and (aurTargets.len > 0 or upgradeCount > 0)) or build:
echo(trp(" there is nothing to do\n"))
clearPaths(paths)
0
proc handlePrint(args: seq[Argument], config: Config, syncTargets: seq[SyncPackageTarget],
- rpcFullTargets: seq[FullPackageTarget[RpcPackageInfo]], upgradeCount: int, nodepsCount: int,
+ fullTargets: seq[FullPackageTarget], upgradeCount: int, nodepsCount: int,
needed: bool, build: bool, noaur: bool, printFormat: string): int =
- let pacmanTargets = rpcFullTargets.filter(t => not isAurTargetFull(t, config.aurRepo))
+ let pacmanTargets = fullTargets.filter(t => not isAurTargetFull(t, config.aurRepo))
let directPacmanTargets = pacmanTargets.map(`$`)
let (resolveTargetsCode, _, _, pkgInfos, additionalPkgInfos, _) = resolveBuildTargets(config,
- syncTargets, rpcFullTargets, false, true, upgradeCount, true, needed, noaur, build)
+ syncTargets, fullTargets, false, true, upgradeCount, true, needed, noaur, build)
if resolveTargetsCode != 0:
resolveTargetsCode
@@ -1311,11 +1312,11 @@ proc handlePrint(args: seq[Argument], config: Config, syncTargets: seq[SyncPacka
if code == 0:
proc printWithFormat(pkgInfo: PackageInfo) =
echo(printFormat
- .replace("%n", pkgInfo.name)
- .replace("%v", pkgInfo.version)
+ .replace("%n", pkgInfo.rpc.name)
+ .replace("%v", pkgInfo.rpc.version)
.replace("%r", config.aurRepo)
.replace("%s", "0")
- .replace("%l", pkgInfo.gitUrl))
+ .replace("%l", pkgInfo.rpc.gitUrl))
for installGroup in basePackages:
for pkgInfos in installGroup:
@@ -1326,7 +1327,7 @@ proc handlePrint(args: seq[Argument], config: Config, syncTargets: seq[SyncPacka
code
proc resolveAurTargets(config: Config, targets: seq[PackageTarget], printMode: bool, noaur: bool,
- build: bool): (int, seq[SyncPackageTarget], seq[FullPackageTarget[RpcPackageInfo]]) =
+ build: bool): (int, seq[SyncPackageTarget], seq[FullPackageTarget]) =
let (syncTargets, checkAurTargetNames) = withAlpmConfig(config, true, handle, dbs, errors):
for e in errors: printError(config.color, e)
findSyncTargets(handle, dbs, targets, config.aurRepo, not build, not build)
@@ -1348,10 +1349,10 @@ proc resolveAurTargets(config: Config, targets: seq[PackageTarget], printMode: b
if rpcNotFoundTargets.len > 0:
printSyncNotFound(config, rpcNotFoundTargets)
- (1, syncTargets, newSeq[FullPackageTarget[RpcPackageInfo]]())
+ (1, syncTargets, newSeq[FullPackageTarget]())
else:
- let rpcFullTargets = mapAurTargets(syncTargets, rpcInfos, config.aurRepo)
- (0, syncTargets, rpcFullTargets)
+ let fullTargets = mapAurTargets(syncTargets, rpcInfos, config.aurRepo)
+ (0, syncTargets, fullTargets)
proc handleSyncInstall*(args: seq[Argument], config: Config): int =
let printModeArg = args.check(%%%"print")
@@ -1380,7 +1381,7 @@ proc handleSyncInstall*(args: seq[Argument], config: Config): int =
let noconfirm = args.noconfirm
withAur():
- let (code, syncTargets, rpcFullTargets) = resolveAurTargets(config, targets,
+ let (code, syncTargets, fullTargets) = resolveAurTargets(config, targets,
printFormat.isSome, noaur, build)
let pacmanArgs = callArgs.filterExtensions(true, true,
@@ -1389,8 +1390,8 @@ proc handleSyncInstall*(args: seq[Argument], config: Config): int =
if code != 0:
code
elif printFormat.isSome:
- handlePrint(pacmanArgs, config, syncTargets, rpcFullTargets,
+ handlePrint(pacmanArgs, config, syncTargets, fullTargets,
upgradeCount, nodepsCount, needed, build, noaur, printFormat.unsafeGet)
else:
- handleInstall(pacmanArgs, config, syncTargets, rpcFullTargets,
+ handleInstall(pacmanArgs, config, syncTargets, fullTargets,
upgradeCount, nodepsCount, wrapUpgrade, noconfirm, needed, build, noaur)
diff --git a/src/feature/syncsource.nim b/src/feature/syncsource.nim
index b25d25d..20ff56f 100644
--- a/src/feature/syncsource.nim
+++ b/src/feature/syncsource.nim
@@ -109,12 +109,11 @@ proc copyFiles(config: Config, quiet: bool, results: seq[CloneResult]): List[str
copyNext(0, nil)
-proc cloneAndCopy(config: Config, quiet: bool,
- fullTargets: seq[FullPackageTarget[RpcPackageInfo]]): int =
+proc cloneAndCopy(config: Config, quiet: bool, fullTargets: seq[FullPackageTarget]): int =
let baseTargets = fullTargets.foldl(block:
let bases = a.map(x => x.base)
if b.isAurTargetFull(config.aurRepo):
- let rpcInfo = b.pkgInfo.get
+ let rpcInfo = b.rpcInfo.get
if rpcInfo.base in bases:
a
else:
@@ -179,5 +178,5 @@ proc handleSyncSource*(args: seq[Argument], config: Config): int =
printSyncNotFound(config, notFoundTargets)
1
else:
- let fullTargets = mapAurTargets[RpcPackageInfo](syncTargets, rpcInfos, config.aurRepo)
+ let fullTargets = mapAurTargets(syncTargets, rpcInfos, config.aurRepo)
cloneAndCopy(config, quiet, fullTargets)
diff --git a/src/package.nim b/src/package.nim
index 7ad89bd..0534234 100644
--- a/src/package.nim
+++ b/src/package.nim
@@ -22,36 +22,39 @@ type
constraint: Option[VersionConstraint]
]
- RpcPackageInfo* = object of RootObj
- repo*: string
- base*: string
- name*: string
- version*: string
- description*: Option[string]
- maintainer*: Option[string]
- firstSubmitted*: Option[int64]
- lastModified*: Option[int64]
- outOfDate*: Option[int64]
- votes*: int
- popularity*: float
- gitUrl*: string
- gitSubdir*: Option[string]
-
- PackageInfo* = object of RpcPackageInfo
- baseIndex*: int
- baseCount*: int
- archs*: seq[string]
- url*: Option[string]
- licenses*: seq[string]
- groups*: seq[string]
- pgpKeys*: seq[string]
- depends*: seq[PackageReference]
- makeDepends*: seq[PackageReference]
- checkDepends*: seq[PackageReference]
- optional*: seq[PackageReference]
- provides*: seq[PackageReference]
- conflicts*: seq[PackageReference]
- replaces*: seq[PackageReference]
+ RpcPackageInfo* = tuple[
+ repo: string,
+ base: string,
+ name: string,
+ version: string,
+ description: Option[string],
+ maintainer: Option[string],
+ firstSubmitted: Option[int64],
+ lastModified: Option[int64],
+ outOfDate: Option[int64],
+ votes: int,
+ popularity: float,
+ gitUrl: string,
+ gitSubdir: Option[string]
+ ]
+
+ PackageInfo* = tuple[
+ rpc: RpcPackageInfo,
+ baseIndex: int,
+ baseCount: int,
+ archs: seq[string],
+ url: Option[string],
+ licenses: seq[string],
+ groups: seq[string],
+ pgpKeys: seq[string],
+ depends: seq[PackageReference],
+ makeDepends: seq[PackageReference],
+ checkDepends: seq[PackageReference],
+ optional: seq[PackageReference],
+ provides: seq[PackageReference],
+ conflicts: seq[PackageReference],
+ replaces: seq[PackageReference]
+ ]
GitRepo* = tuple[
url: string,
@@ -305,19 +308,12 @@ proc parseSrcInfoName(repo: string, name: string, baseIndex: int, baseCount: int
let info = rpcInfos.filter(i => i.name == name).optLast
- lc[PackageInfo(baseIndex: baseIndex, baseCount: baseCount,
- repo: repo, base: b, name: name, version: v, description: description,
- archs: archs, url: url, licenses: licenses, groups: groups, pgpKeys: pgpKeys,
- depends: depends, makeDepends: makeDepends, checkDepends: checkDepends,
- optional: optional, provides: provides, conflicts: conflicts, replaces: replaces,
- maintainer: info.map(i => i.maintainer).flatten,
- firstSubmitted: info.map(i => i.firstSubmitted).flatten,
- lastModified: info.map(i => i.lastModified).flatten,
- outOfDate: info.map(i => i.outOfDate).flatten,
- votes: info.map(i => i.votes).get(0),
- popularity: info.map(i => i.popularity).get(0),
- gitUrl: gitUrl, gitSubdir: gitSubdir) |
- (b <- base, v <- versionFull), PackageInfo].optLast
+ lc[((repo, b, name, v, description, info.map(i => i.maintainer).flatten,
+ info.map(i => i.firstSubmitted).flatten, info.map(i => i.lastModified).flatten,
+ info.map(i => i.outOfDate).flatten, info.map(i => i.votes).get(0),
+ info.map(i => i.popularity).get(0), gitUrl, gitSubdir), baseIndex, baseCount,
+ archs, url, licenses, groups, pgpKeys, depends, makeDepends, checkDepends,
+ optional, provides, conflicts, replaces) | (b <- base, v <- versionFull), PackageInfo].optLast
proc parseSrcInfo*(repo: string, srcInfo: string, arch: string, gitUrl: string,
gitSubdir: Option[string], rpcInfos: seq[RpcPackageInfo] = @[]): seq[PackageInfo] =