aboutsummaryrefslogtreecommitdiff
path: root/src/package.nim
diff options
context:
space:
mode:
authorkitsunyan2018-04-28 20:01:40 +0000
committerkitsunyan2018-04-28 20:01:40 +0000
commit8a3beef91b8d6baebd941d4378e6ebbd0dd70906 (patch)
tree464b885c016599563030713fc87819f46a02a477 /src/package.nim
parent047ab2c2dbf27bf74bd3d60c0ec80e4fbcbf197e (diff)
Don't clone official packages twice
Diffstat (limited to 'src/package.nim')
-rw-r--r--src/package.nim20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/package.nim b/src/package.nim
index 30ff2f8..4d0fba6 100644
--- a/src/package.nim
+++ b/src/package.nim
@@ -49,9 +49,7 @@ type
conflicts*: seq[PackageReference]
replaces*: seq[PackageReference]
gitUrl*: string
- gitBranch*: Option[string]
- gitCommit*: Option[string]
- gitPath*: Option[string]
+ gitSubdir*: Option[string]
GitRepo* = tuple[
url: string,
@@ -124,8 +122,8 @@ proc lookupGitRepo*(repo: string, base: string, arch: string): Option[GitRepo] =
template repoPath*(tmpRoot: string, base: string): string =
tmpRoot & "/" & base
-template buildPath*(repoPath: string, gitPath: Option[string]): string =
- gitPath.map(p => repoPath & "/" & p).get(repoPath)
+template buildPath*(repoPath: string, gitSubdir: Option[string]): string =
+ gitSubdir.map(p => repoPath & "/" & p).get(repoPath)
template allDepends*(pkgInfo: PackageInfo): seq[PackageReference] =
pkgInfo.depends & pkgInfo.makeDepends & pkgInfo.checkDepends
@@ -232,8 +230,7 @@ proc parseSrcInfoKeys(srcInfo: string):
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] =
+ arch: string, gitUrl: string, gitSubdir: Option[string]): Option[PackageInfo] =
proc collectFromPairs(pairs: seq[SrcInfoPair], keyName: string): seq[string] =
lc[x.value | (x <- pairs, x.key == keyName), string]
@@ -288,17 +285,16 @@ proc parseSrcInfoName(repo: string, name: string, baseIndex: int, baseCount: int
lastModified: info.map( i => i.lastModified).flatten,
votes: info.map(i => i.votes).get(0),
popularity: info.map(i => i.popularity).get(0),
- gitUrl: gitUrl, gitBranch: gitBranch, gitCommit: gitCommit, gitPath: gitPath) |
+ gitUrl: gitUrl, gitSubdir: gitSubdir) |
(b <- base, v <- versionFull), PackageInfo].optLast
-proc parseSrcInfo*(repo: string, srcInfo: string, arch: string,
- gitUrl: string, gitBranch: Option[string], gitCommit: Option[string],
- gitPath: Option[string], rpcInfos: seq[RpcPackageInfo] = @[]): seq[PackageInfo] =
+proc parseSrcInfo*(repo: string, srcInfo: string, arch: string, gitUrl: string,
+ gitSubdir: Option[string], rpcInfos: seq[RpcPackageInfo] = @[]): seq[PackageInfo] =
let parsed = parseSrcInfoKeys(srcInfo)
toSeq(parsed.table.namedPairs).foldl(a & toSeq(parseSrcInfoName(repo, b.key,
a.len, parsed.table.len, rpcInfos, parsed.baseSeq, b.value, arch,
- gitUrl, gitBranch, gitCommit, gitPath).items), newSeq[PackageInfo]())
+ gitUrl, gitSubdir).items), newSeq[PackageInfo]())
proc `$`*(reference: PackageReference): string =
reference.constraint