From 635ad7f462419a48e199df698caf09225ca1a52d Mon Sep 17 00:00:00 2001 From: kitsunyan Date: Tue, 13 Mar 2018 21:04:57 +0300 Subject: 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. --- lib/bisect.nim | 38 +++++--------------------------------- src/common.nim | 12 ++---------- 2 files changed, 7 insertions(+), 43 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 diff --git a/src/common.nim b/src/common.nim index e17c802..8ef6dba 100644 --- a/src/common.nim +++ b/src/common.nim @@ -376,16 +376,8 @@ proc cloneRepo*(config: Config, basePackages: seq[PackageInfo]): (int, Option[st let code = forkWait(() => execResult(gitCmd, "-C", repoPath, "reset", "-q", "--hard", gitCommit.unsafeGet)) (code, none(string)) - elif aur: (block: - let commit = bisectVersion(repoPath, config.debug, none(string), - "srcinfo", basePackages[0].gitPath.get("."), basePackages[0].version) - - if commit.isSome: - let code = forkWait(() => execResult(gitCmd, "-C", repoPath, - "reset", "-q", "--hard", commit.unsafeGet)) - (code, none(string)) - else: - (1, none(string))) + elif aur: + (0, none(string)) else: (1, none(string)) else: -- cgit v1.2.3-70-g09d2