Convert bat to powershell; Remove debug

This commit is contained in:
Dan Hawkins 2021-06-30 23:04:07 +01:00
commit efc2ce75ed
5 changed files with 33 additions and 30 deletions

View file

@ -1,7 +1,6 @@
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
echo "I am here 2"
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
}
@ -13,12 +12,7 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
echo "I am here 1"
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
echo("I am here 4")
}
return this

View file

@ -10,31 +10,41 @@ def comparefiles(importedjsonfile, currentjsonfile) {
}
else {
// Jq and diffutils can be installed on windows with chocolatey
bat """
REM echo Checking utilities exist
REM set
REM echo %PATH%
where jq
if errorlevel 1 EXIT /b 1
where diff
if errorlevel 1 EXIT /b 1
powershell """
# echo Checking utilities exist
# set
# echo %PATH%
try {
if (Get-Command jq) {}
}
catch {
echo "jq is unavailable"
exit $false
}
try {
if (Get-Command diff) {}
}
catch {
echo "diff is unavailable"
exit $false
}
REM echo Sorting json in files to compare
REM jq -S sorts json output
# echo Sorting json in files to compare
# jq -S sorts json output
jq -S . "${importedjsonfile}" > temp1.txt
if errorlevel 1 EXIT /b 1
if (\$lastexitcode -ge 1) { exit 1 }
jq -S . "${importedjsonfile}" > temp2.txt
if errorlevel 1 EXIT /b 1
if (\$lastexitcode -ge 1) { exit 1 }
REM echo Diffing sorted json files
# echo Diffing sorted json files
diff -c temp1.txt temp2.txt
set el=%errorlevel%
\$el = \$lastexitcode
del temp1.txt
del temp2.txt
Remove-Item temp1.txt
Remove-Item temp2.txt
REM echo Diffing result: %el%
if %el% GEQ 1 EXIT /b 1
# echo Diffing result: \$el
if (\$el -ge 1) { exit 1 }
"""
}
}

View file

@ -526,7 +526,6 @@ class MetaInfo extends GISJsonSerialised {
}
void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) {
script.echo("I am here 3")
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
configurationinfo.add(ci)

View file

@ -13,7 +13,7 @@ def stamp(convertdetails) {
"""
}
else {
bat """
powershell """
"${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
"""
}

View file

@ -28,7 +28,7 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
}
else {
changecount = bat(returnStdout: true, script: "@git rev-list HEAD --count").trim().toInteger()
changecount = powershell(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
}
echo "Change count: ${changecount}"
def int mvnp1 = maxversionnumber() + 1
@ -39,21 +39,21 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
}
else {
gitrevision = bat(returnStdout: true, script: "@git rev-parse HEAD").trim()
gitrevision = powershell(returnStdout: true, script: "git rev-parse HEAD").trim()
}
echo "Revision: ${gitrevision}"
if (isUnix()) {
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
}
else {
remoteinfo = bat(returnStdout: true, script: "@git remote show origin").trim()
remoteinfo = powershell(returnStdout: true, script: "git remote show origin").trim()
}
echo "Remote info: ${remoteinfo}"
if (isUnix()) {
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
}
else {
remoteurl = bat(returnStdout: true, script: "@git config --get remote.origin.url").trim()
remoteurl = powershell(returnStdout: true, script: "git config --get remote.origin.url").trim()
}
echo "Remote URL: ${remoteurl}"
}