From d884cac14c0dc2dfb713f2aa307d54fa32695ee4 Mon Sep 17 00:00:00 2001 From: kitsunyan Date: Sat, 14 Apr 2018 17:38:20 +0300 Subject: Extract arrays only for pkgname instead of pkgbase & pkgname --- src/package.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/package.nim b/src/package.nim index c3ab6f4..70fe2eb 100644 --- a/src/package.nim +++ b/src/package.nim @@ -215,10 +215,16 @@ proc parseSrcInfoName(repo: string, name: string, baseIndex: int, baseCount: int rpcInfos: seq[RpcPackageInfo], baseSeq: ref seq[SrcInfoPair], nameSeq: ref seq[SrcInfoPair], arch: string, gitUrl: string, gitBranch: Option[string], gitCommit: Option[string], gitPath: Option[string]): Option[PackageInfo] = - let pairs = baseSeq[] & nameSeq[] - proc collect(keyName: string): seq[string] = + proc collectFromPairs(pairs: seq[SrcInfoPair], keyName: string): seq[string] = lc[x.value | (x <- pairs, x.key == keyName), string] + proc collect(keyName: string): seq[string] = + let res = collectFromPairs(nameSeq[], keyName) + if res.len == 0: + collectFromPairs(baseSeq[], keyName) + else: + res + proc splitConstraint(name: string): PackageReference = var matches: array[3, string] -- cgit v1.2.3-70-g09d2