aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bisect.nim38
1 files changed, 5 insertions, 33 deletions
diff --git a/lib/bisect.nim b/lib/bisect.nim
index 53d73f1..55d5a60 100644
--- a/lib/bisect.nim
+++ b/lib/bisect.nim
@@ -14,42 +14,13 @@ proc getSourceVersion(relativePath: string): seq[string] =
else:
@[]
-proc getSrcInfoVersion(relativePath: string): seq[string] =
- var file: File
- var epoch = ""
- var pkgver = ""
- var pkgrel = ""
-
- if file.open(relativePath & "/.SRCINFO"):
- try:
- var matches: array[2, string]
- while true:
- let line = file.readLine()
- if line.match(re"[\t\ ]*(\w+)\ =\ (.*)", matches):
- case matches[0]:
- of "epoch":
- epoch = matches[1]
- of "pkgver":
- pkgver = matches[1]
- of "pkgrel":
- pkgrel = matches[1]
- else:
- discard
- except:
- discard
- finally:
- file.close()
-
- @[epoch, pkgver, pkgrel]
-
-let compareMethod = commandLineParams()[0]
-let relativePath = commandLineParams()[1]
-let compareVersion = commandLineParams()[2]
+let params = commandLineParams()
+let compareMethod = params[0]
+let relativePath = params[1]
+let compareVersion = params[2]
let (currentVersion, supported) = if compareMethod == "source":
(getSourceVersion(relativePath), true)
- elif compareMethod == "srcinfo":
- (getSrcInfoVersion(relativePath), true)
else:
(@[], false)
@@ -70,6 +41,7 @@ else:
else:
pkgver & "-" & pkgrel
+ # this output is required by main program
echo(version)
if vercmp(compareVersion, version) > 0:
programResult = 0