aboutsummaryrefslogtreecommitdiff
path: root/src/package.nim
diff options
context:
space:
mode:
authorkitsunyan2018-03-17 20:55:48 +0000
committerkitsunyan2018-03-17 20:55:48 +0000
commit75b2f60bf15a9d49859b262a47da30ec70614a5e (patch)
tree5de302585fb93359f2427e5a2acbdf1162edbab2 /src/package.nim
parent8d0508a73cd984fa532ff9f29cbedba5d0e0aa81 (diff)
Check conflicting targets before building
Diffstat (limited to 'src/package.nim')
-rw-r--r--src/package.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/package.nim b/src/package.nim
index 483c058..5683d5f 100644
--- a/src/package.nim
+++ b/src/package.nim
@@ -162,6 +162,24 @@ proc isProvidedBy*(package: PackageReference, by: PackageReference): bool =
else:
false
+proc toPackageReference*(dependency: ptr AlpmDependency): PackageReference =
+ let op = case dependency.depmod:
+ of AlpmDepMod.eq: some(ConstraintOperation.eq)
+ of AlpmDepMod.ge: some(ConstraintOperation.ge)
+ of AlpmDepMod.le: some(ConstraintOperation.le)
+ of AlpmDepMod.gt: some(ConstraintOperation.gt)
+ of AlpmDepMod.lt: some(ConstraintOperation.lt)
+ else: none(ConstraintOperation)
+
+ let description = if dependency.desc != nil: some($dependency.desc) else: none(string)
+ ($dependency.name, description, op.map(o => (o, $dependency.version)))
+
+template toPackageReference*(pkg: ptr AlpmPackage): PackageReference =
+ ($pkg.name, none(string), some((ConstraintOperation.eq, $pkg.version)))
+
+template toPackageReference*(pkg: PackageInfo): PackageReference =
+ (pkg.name, none(string), some((ConstraintOperation.eq, pkg.version)))
+
proc parseSrcInfoKeys(srcInfo: string):
tuple[baseSeq: ref seq[SrcInfoPair], table: OrderedTable[string, ref seq[SrcInfoPair]]] =
var table = initOrderedTable[string, ref seq[SrcInfoPair]]()