Commit ef9cfd2c authored by Nong Hoang Tu's avatar Nong Hoang Tu

New version check using uscan parser

parent 7094afe9
Pipeline #2117 canceled with stages
No preview for this file type
import json
import os
import strutils
import modules / [core, logutils, cmpVer, updateutils, cloneutils]
import modules / [core, logutils, verutils, updateutils, cloneutils]
var
conf: JsonNode
......@@ -38,24 +37,29 @@ proc updateProject(prjName, sessionLog: string): int =
discard updater.srcPull()
if fileExists(updater.path & "/debian/watch"):
var version: string
let cmpResult = cmpVersionWatch(updater, version)
# version is not empty -> we are having different version of local
# and server
if cmpResult == OUTOFDATED:
if not isEmptyOrWhitespace(version):
updater.logInfo("Get version from updater: " & version)
if not updater.srcUpdate():
return ERR
if not updater.genChangeLog(version):
return ERR
if not updater.genTag():
return ERR
if not updater.srcPush():
return ERR
return COMPLETED
let
uscanCheck = parseVersionByUscan(updater.path)
serverVer = uscanCheck[0]
localVer = uscanCheck[1]
if serverVer == "" or localVer == "":
updater.logError("Can't get version from output. Could be updated")
return UPTODATED
updater.logInfo("Server version: " & serverVer)
updater.logInfo("Local version: " & localVer)
if serverVer != localVer:
updater.logInfo("Different version [" & localVer & "] [" & serverVer & "]")
if not updater.srcUpdate():
return ERR
if not updater.genChangeLog(serverVer):
return ERR
if not updater.genTag():
return ERR
if not updater.srcPush():
return ERR
return COMPLETED
else:
return cmpResult
updater.logInfo("Same version from local and server")
return UPTODATED
else:
discard # TODO update file using customized
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment