aboutsummaryrefslogtreecommitdiff
path: root/lib/bisect.nim
diff options
context:
space:
mode:
authorkitsunyan2018-03-13 18:04:57 +0000
committerkitsunyan2018-03-13 18:04:57 +0000
commit635ad7f462419a48e199df698caf09225ca1a52d (patch)
tree1d3328784d0468e1878dacc50ac74d105786ccdb /lib/bisect.nim
parent7306b66419c8e3f1785f2bb22d6851c827f7b671 (diff)
Don't bisect AUR packages
Since .SRCINFO might be changed without version change, bisecting becomes not suitable for finding the commit. Some packagers forget to update pkgrel or even .SRCINFO making changes to PKGBUILD, so bisecting can do more harm than good.
Diffstat (limited to 'lib/bisect.nim')
-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