From 5830e6172da4dadb31c3ccf91e1a3bfce45fff7f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sun, 20 Jun 2021 16:34:32 +0100 Subject: [PATCH 01/27] Print out git checkout options --- versioncontrol/git.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index f5b2ebd..2ac2f82 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -185,6 +185,7 @@ def showsparseitemlist(ArrayList sparseitemlist = new ArrayList( } def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) { + echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}" checkout([ $class: 'GitSCM', userRemoteConfigs: [ From 1c9c8d1744259fecb358c4395eac40824b43d766 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 11:57:04 +0100 Subject: [PATCH 02/27] Debug northey --- versioncontrol/git.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 2ac2f82..addf2da 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -102,6 +102,7 @@ def String checkouttoreporoot(String gitURL) { } def checkgitlfsinstall() { + echo "I am here" if (isUnix()) { sh """ git lfs install @@ -110,10 +111,13 @@ def checkgitlfsinstall() { } else { bat """ + set + git lfs install if errorlevel 1 EXIT /b 1 """ } + echo "I am here 3" } //No credentials specified From 1ca22a8f34e2768e2bdded8fe29116ebb0cfa6a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 12:04:22 +0100 Subject: [PATCH 03/27] Debug northey --- versioncontrol/git.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index addf2da..6e618a3 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -110,6 +110,7 @@ def checkgitlfsinstall() { """ } else { + echo "I am here 2" bat """ set From 2342841709e513a71cd67ad8fd08fd2dee009b58 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 13:40:59 +0100 Subject: [PATCH 04/27] Debug northey --- versioncontrol/git.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 6e618a3..eb63f46 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -111,11 +111,11 @@ def checkgitlfsinstall() { } else { echo "I am here 2" - bat """ - set - + powershell """ + echo "I am here 2.5" + git lfs install - if errorlevel 1 EXIT /b 1 + if ($lastexitcode -ge 1) { exit 1 } """ } echo "I am here 3" From 3ca45690fbb9660caf2655640d839c6cff11106b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 14:04:45 +0100 Subject: [PATCH 05/27] Debug northey --- versioncontrol/git.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index eb63f46..872480c 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -115,7 +115,7 @@ def checkgitlfsinstall() { echo "I am here 2.5" git lfs install - if ($lastexitcode -ge 1) { exit 1 } + if (\$lastexitcode -ge 1) { exit 1 } """ } echo "I am here 3" From 6cef1ceb84e75433486509d7c6ca18dc031966af Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 15:57:50 +0100 Subject: [PATCH 06/27] Remove debug for northey --- versioncontrol/git.groovy | 5 ----- 1 file changed, 5 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 872480c..24aa094 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -102,7 +102,6 @@ def String checkouttoreporoot(String gitURL) { } def checkgitlfsinstall() { - echo "I am here" if (isUnix()) { sh """ git lfs install @@ -110,15 +109,11 @@ def checkgitlfsinstall() { """ } else { - echo "I am here 2" powershell """ - echo "I am here 2.5" - git lfs install if (\$lastexitcode -ge 1) { exit 1 } """ } - echo "I am here 3" } //No credentials specified From 149ece23042c851afe3450013165956a8cabe06b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 17:41:19 +0100 Subject: [PATCH 07/27] Debugging northey --- versioncontrol/git.groovy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 24aa094..1732cff 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -12,7 +12,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() } else { - isshallowclone = bat(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() + isshallowclone = powershell(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() } echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } @@ -89,9 +89,9 @@ def String checkouttoreporoot(String gitURL) { if [ \$? -ne 0 ]; then exit 1; fi """ } else { - bat """ + powershell """ git status - if errorlevel 1 EXIT /b 1 + if (\$lastexitcode -ge 1) { exit 1 } """ } } @@ -222,7 +222,7 @@ def gitinit(String targetDir, String reporootpath) { git init "${targetDir}" """ } else { - bat """ + powershell """ git init "${targetDir}" """ } @@ -246,7 +246,7 @@ def setlfsfetchinclude(String targetDir, ArrayList sparseitemlist) { git config lfs.fetchinclude "${sparseitemliststring}" """ } else { - bat """ + powershell """ git config lfs.fetchinclude "${sparseitemliststring}" """ } @@ -264,7 +264,7 @@ def gitsparserestore(String targetDir) { git reset --hard > /dev/null """ } else { - bat """ + powershell """ git rm -rf . 2> nul git clean -fxd 2> nul git reset --hard 2> nul @@ -312,7 +312,7 @@ def checkRepoExists(String gitURL) { returnStatus: true ) } else { - result = bat( script: """ + result = powershell( script: """ @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY """, returnStatus: true From 4c74502b7557d6d12c534cf5511338ea25d28b0c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 17:43:04 +0100 Subject: [PATCH 08/27] Debugging northey --- versioncontrol/git.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy index 1732cff..5bcb0ba 100644 --- a/versioncontrol/git.groovy +++ b/versioncontrol/git.groovy @@ -12,7 +12,7 @@ def boolean isShallowClonedRepo(String gitrootpath) { isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() } else { - isshallowclone = powershell(returnStdout: true, script: "@git rev-parse --is-shallow-repository").trim().toBoolean() + isshallowclone = powershell(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean() } echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}" } @@ -313,7 +313,7 @@ def checkRepoExists(String gitURL) { ) } else { result = powershell( script: """ - @git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY + git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY """, returnStatus: true ) From 07464ef1b17296f25c7e6f3b8d835ba004aa9408 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 21:37:41 +0100 Subject: [PATCH 09/27] Convert from bat to powershell --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index a2fd4e1..f35919a 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -38,7 +38,7 @@ class ProductInfo extends GISJsonSerialised { pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true) + pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true) } if (pstatus > 0) { script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name") @@ -48,7 +48,7 @@ class ProductInfo extends GISJsonSerialised { sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true) + sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true) } if (sstatus > 0) { script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name") @@ -59,7 +59,7 @@ class ProductInfo extends GISJsonSerialised { vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - vstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) + vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) } if (vstatus > 0) { script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name") From 18addad030ec7724930f4d84db1e647b387135df Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 21:44:23 +0100 Subject: [PATCH 10/27] Convert from bat to powershell --- meta/folder.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index f35919a..704bfc8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -38,7 +38,7 @@ class ProductInfo extends GISJsonSerialised { pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true) + pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , returnStatus: true) } if (pstatus > 0) { script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name") @@ -48,7 +48,7 @@ class ProductInfo extends GISJsonSerialised { sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true) + sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , returnStatus: true) } if (sstatus > 0) { script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name") @@ -59,7 +59,7 @@ class ProductInfo extends GISJsonSerialised { vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true) } else { - vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" > NUL 2> NUL", , returnStatus: true) + vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true) } if (vstatus > 0) { script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name") From 662e2b7526741d1239b06e8af8f1e941be317c3d Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 22:00:02 +0100 Subject: [PATCH 11/27] Debugging --- configuration/configuration.groovy | 6 ++++++ meta/folder.groovy | 1 + 2 files changed, 7 insertions(+) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index 2a7f1ab..b06c931 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -1,6 +1,7 @@ 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) } @@ -12,7 +13,12 @@ def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, St def ArrayList 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 diff --git a/meta/folder.groovy b/meta/folder.groovy index 704bfc8..0fbcc8d 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -526,6 +526,7 @@ 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) From d2e5ef51ba87b11f5b4ae607352387a4b94a4399 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 22:10:09 +0100 Subject: [PATCH 12/27] Debugging --- commandline/commandline.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commandline/commandline.groovy b/commandline/commandline.groovy index df99a75..38f80fa 100644 --- a/commandline/commandline.groovy +++ b/commandline/commandline.groovy @@ -2,8 +2,7 @@ String getCommandOutput(String cmd) { if (isUnix()) { return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim() } else { - return bat(returnStdout: true, script: """ - @echo off + return powershell(returnStdout: true, script: """ ${cmd} """ ).trim() From efc2ce75ed08d164fd02a3ee61b007ec5b68e642 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 23:04:07 +0100 Subject: [PATCH 13/27] Convert bat to powershell; Remove debug --- configuration/configuration.groovy | 6 ---- differences/json.groovy | 46 ++++++++++++++++++------------ meta/folder.groovy | 1 - versionnumbering/do.groovy | 2 +- versionnumbering/generate.groovy | 8 +++--- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy index b06c931..2a7f1ab 100644 --- a/configuration/configuration.groovy +++ b/configuration/configuration.groovy @@ -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 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 diff --git a/differences/json.groovy b/differences/json.groovy index 78df0bd..7f2b662 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -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 } """ } } diff --git a/meta/folder.groovy b/meta/folder.groovy index 0fbcc8d..704bfc8 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -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) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 9f45f70..f2a64ca 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,7 +13,7 @@ def stamp(convertdetails) { """ } else { - bat """ + powershell """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ } diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 71d7bf6..405b7be 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -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}" } From b8b6848c9635c60b6c2582305374284d756eadd6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 30 Jun 2021 23:10:19 +0100 Subject: [PATCH 14/27] Convert bat to powershell; Remove debug --- differences/json.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 7f2b662..7e9b7c3 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -19,14 +19,14 @@ def comparefiles(importedjsonfile, currentjsonfile) { } catch { echo "jq is unavailable" - exit $false + exit \$false } try { if (Get-Command diff) {} } catch { echo "diff is unavailable" - exit $false + exit \$false } # echo Sorting json in files to compare From 564ed643ca64e67f104c0b2dd86d7489f1fd183c Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 00:07:24 +0100 Subject: [PATCH 15/27] Convert bat to powershell; Remove debug --- differences/json.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 7e9b7c3..1b95c7b 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -37,14 +37,17 @@ def comparefiles(importedjsonfile, currentjsonfile) { if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - diff -c temp1.txt temp2.txt - \$el = \$lastexitcode + $str1 = Get-Content "temp1.txt" + $str2 = Get-Content "temp2.txt" + $diff = Compare-Object $str1 $str2 + if ($diff -ne '') { + echo "Difference between JSON files:" + echo $diff + exit 1 + } Remove-Item temp1.txt Remove-Item temp2.txt - - # echo Diffing result: \$el - if (\$el -ge 1) { exit 1 } """ } } From fa9fb620a74ed966ced1728ed6d37afe9e176e56 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 00:11:43 +0100 Subject: [PATCH 16/27] Convert bat to powershell; Remove debug --- differences/json.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 1b95c7b..800f62c 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -37,12 +37,12 @@ def comparefiles(importedjsonfile, currentjsonfile) { if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - $str1 = Get-Content "temp1.txt" - $str2 = Get-Content "temp2.txt" - $diff = Compare-Object $str1 $str2 - if ($diff -ne '') { + \$str1 = Get-Content "temp1.txt" + \$str2 = Get-Content "temp2.txt" + \$diff = Compare-Object \$str1 \$str2 + if (\$diff -ne '') { echo "Difference between JSON files:" - echo $diff + echo \$diff exit 1 } From 9f884b1b53aebbff9a03e5dcea463a8630553270 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 00:24:03 +0100 Subject: [PATCH 17/27] Convert bat to powershell; Remove debug --- differences/json.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 800f62c..82b5293 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -41,8 +41,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { \$str2 = Get-Content "temp2.txt" \$diff = Compare-Object \$str1 \$str2 if (\$diff -ne '') { - echo "Difference between JSON files:" - echo \$diff + echo "Difference between JSON files: \$diff" exit 1 } From 0e5d7b898f7a639813cf818baf6fdcacfcd407e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 07:26:20 +0100 Subject: [PATCH 18/27] Convert bat to powershell: diffing --- differences/json.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 82b5293..b195883 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -39,9 +39,9 @@ def comparefiles(importedjsonfile, currentjsonfile) { # echo Diffing sorted json files \$str1 = Get-Content "temp1.txt" \$str2 = Get-Content "temp2.txt" - \$diff = Compare-Object \$str1 \$str2 - if (\$diff -ne '') { - echo "Difference between JSON files: \$diff" + \$diffed = Compare-Object \$str1 \$str2 + if (\$diffed -ne '') { + Write-Output "Difference between JSON files: \$diffed" exit 1 } From 055270addc35ceab27d791e350e76aec5bee4560 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 07:31:15 +0100 Subject: [PATCH 19/27] Convert bat to powershell: diffing --- differences/json.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index b195883..853e0e0 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -41,7 +41,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { \$str2 = Get-Content "temp2.txt" \$diffed = Compare-Object \$str1 \$str2 if (\$diffed -ne '') { - Write-Output "Difference between JSON files: \$diffed" + Write-Host "Difference between JSON files: " \$diffed exit 1 } From 8811df27c9a63c9217420fe72b2eb85793b765a7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:13:00 +0100 Subject: [PATCH 20/27] Convert bat to powershell: diffing --- differences/json.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index 853e0e0..e3ce38e 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -39,9 +39,9 @@ def comparefiles(importedjsonfile, currentjsonfile) { # echo Diffing sorted json files \$str1 = Get-Content "temp1.txt" \$str2 = Get-Content "temp2.txt" - \$diffed = Compare-Object \$str1 \$str2 - if (\$diffed -ne '') { - Write-Host "Difference between JSON files: " \$diffed + if (\$str1 -ne \$str2) { + Write-Host "Difference between JSON files: " + Compare-Object \$str1 \$str2 exit 1 } From 4339d74109a86e632224ac3b14650e05d88d559a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:37:51 +0100 Subject: [PATCH 21/27] Convert bat to powershell: diffing --- differences/json.groovy | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/differences/json.groovy b/differences/json.groovy index e3ce38e..d61ed26 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -33,20 +33,17 @@ def comparefiles(importedjsonfile, currentjsonfile) { # jq -S sorts json output jq -S . "${importedjsonfile}" > temp1.txt if (\$lastexitcode -ge 1) { exit 1 } - jq -S . "${importedjsonfile}" > temp2.txt + jq -S . "${currentjsonfile}" > temp2.txt if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - \$str1 = Get-Content "temp1.txt" - \$str2 = Get-Content "temp2.txt" - if (\$str1 -ne \$str2) { - Write-Host "Difference between JSON files: " - Compare-Object \$str1 \$str2 - exit 1 - } - + diff.exe -c .\temp1.txt .\temp2.txt + \$lec = \$lastexitcode + Remove-Item temp1.txt Remove-Item temp2.txt + + if (\$lec -ge 1) { exit 1 } """ } } From 35e62958b99a198c857b91524e8916126e6292a8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:41:01 +0100 Subject: [PATCH 22/27] Convert bat to powershell: diffing --- differences/json.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/json.groovy b/differences/json.groovy index d61ed26..0556188 100644 --- a/differences/json.groovy +++ b/differences/json.groovy @@ -37,7 +37,7 @@ def comparefiles(importedjsonfile, currentjsonfile) { if (\$lastexitcode -ge 1) { exit 1 } # echo Diffing sorted json files - diff.exe -c .\temp1.txt .\temp2.txt + diff.exe -c temp1.txt temp2.txt \$lec = \$lastexitcode Remove-Item temp1.txt From f0b0a3a0c1c6bc74efc62d399e6feb756c0d27c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:45:14 +0100 Subject: [PATCH 23/27] Convert bat to powershell: diffing --- differences/file.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/differences/file.groovy b/differences/file.groovy index bfb8407..dd48440 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -10,10 +10,10 @@ def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { } else { // diffutils can be installed on windows with chocolatey - bat """ - REM echo Checking utilities exist - where diff - if errorlevel 1 EXIT /b 1 + powershell """ + # echo Checking utilities exist + # where diff + # if errorlevel 1 EXIT /b 1 diff -c ${wsparameter} "${importedfile}" "${currentfile}" """ From 339d0b57bb3bc27a1c60ddf9cc368b465a2355cb Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 08:51:54 +0100 Subject: [PATCH 24/27] Convert bat to powershell: diffing --- differences/file.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/differences/file.groovy b/differences/file.groovy index dd48440..aa4814a 100644 --- a/differences/file.groovy +++ b/differences/file.groovy @@ -15,7 +15,7 @@ def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) { # where diff # if errorlevel 1 EXIT /b 1 - diff -c ${wsparameter} "${importedfile}" "${currentfile}" + diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}" """ } } From eed40f2192dfc4b9542f0f0c08471a21154c49ea Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 14:10:37 +0100 Subject: [PATCH 25/27] Convert bat to powershell: diffing --- versionnumbering/do.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index f2a64ca..dfbe440 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,6 +13,7 @@ def stamp(convertdetails) { """ } else { + echo """${PYTHON}" -u ""${stampscript}"" -f ""${filetoconvert}"" -p ""${pattern}"" -s ""${replacement""}" powershell """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ From efa3011edc83d62f876c7e3a5d3c6f99a833c2da Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 14:13:14 +0100 Subject: [PATCH 26/27] Convert bat to powershell: diffing --- versionnumbering/do.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index dfbe440..81ba939 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,7 +13,7 @@ def stamp(convertdetails) { """ } else { - echo """${PYTHON}" -u ""${stampscript}"" -f ""${filetoconvert}"" -p ""${pattern}"" -s ""${replacement""}" + echo "\"${PYTHON}\" -u \"${stampscript}\" -f \"${filetoconvert}\" -p \"${pattern}\" -s \"${replacement}\"" powershell """ "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ From 18368ff7377f1fb906710f853ee702775ed67ca7 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 1 Jul 2021 14:21:53 +0100 Subject: [PATCH 27/27] Convert bat to powershell: diffing --- versionnumbering/do.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy index 81ba939..208a60f 100644 --- a/versionnumbering/do.groovy +++ b/versionnumbering/do.groovy @@ -13,9 +13,8 @@ def stamp(convertdetails) { """ } else { - echo "\"${PYTHON}\" -u \"${stampscript}\" -f \"${filetoconvert}\" -p \"${pattern}\" -s \"${replacement}\"" powershell """ - "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" + & "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}" """ } }