From 9858ef75a61da7303b2cc60e476c9782c7c78f80 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:12:50 +0100 Subject: [PATCH 01/35] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 27 +++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 302b4f8..e93ed4b 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -54,7 +54,7 @@ def doCheck(checkpathlist, build_variant = "") { return result } -def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { +def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { def result = 0 def destFolder = "" def srcFile = "" @@ -71,9 +71,12 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } else { echo "No build variant" - destFolder = "${exportfolder}/${project}" + destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + if (partdest) { + destFolder += "/" + partdest + } } dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" @@ -146,7 +149,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') @@ -162,32 +165,26 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, project, variants, exportpathlist, destpart) = appInfo if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" timeout(time: 10, unit: 'MINUTES') { if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" """ } } @@ -195,7 +192,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." } @@ -214,7 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - result = doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } From 231f87a98d58b1267978e1c14581e32b2cc0dc96 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:38:21 +0100 Subject: [PATCH 02/35] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e93ed4b..bb79b36 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -79,10 +79,11 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } } dir (destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolder}" + cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true @@ -93,7 +94,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } else { result = bat( script: """ - copy "${srcFileExpanded}" "${destFolder}" + copy "${srcFileExpanded}" "${destFolderExpanded}" if errorlevel 1 EXIT /b 1 """, returnStatus: true @@ -209,12 +210,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } } } } From 08f6b9b0d9b93d3d267e7862122f7657cfed9732 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:49:24 +0100 Subject: [PATCH 03/35] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index bb79b36..9ebe541 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -78,8 +78,8 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { destFolder += "/" + partdest } } - dir (destFolder) { - def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + dir (destFolderExpanded) { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ From 63c4ae0b608be0febc86dbfb5f9f998bbf51d345 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:05:02 +0100 Subject: [PATCH 04/35] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ebe541..b3e25bd 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -62,18 +62,16 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { - echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - destFolder = "${exportfolder}/${build_variant}" srcFile = "${WORKSPACE}/${exportpath}" srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + destFolder = "${exportfolder}" if (partdest) { destFolder += "/" + partdest } @@ -165,7 +163,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } - for (appInfo in apps ) { + for (appInfo in apps) { (build, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { From c6eade9db243490c5a21a0d6d99b9187a3cb40a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:20:48 +0100 Subject: [PATCH 05/35] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b3e25bd..721a024 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, project, variants, exportpathlist, destpart) = appInfo + (build, export, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,9 +191,11 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } else { @@ -208,17 +210,19 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } } From 8307a878e8590d0a662e5d0a564427c79b93ac9b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:43:26 +0100 Subject: [PATCH 06/35] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 721a024..77124d7 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, export, project, variants, exportpathlist, destpart) = appInfo + (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,7 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - if (export) { + if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." @@ -210,7 +210,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (export) { + if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { From 69f2b9031ad426bcccb3acc85f2845b2055291a9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:52:24 +0100 Subject: [PATCH 07/35] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 77124d7..e3d2ffb 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -191,6 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } + echo "Doing export: ${doexport}" if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { @@ -202,7 +203,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { - echo "Build failed - Waiting for a while" + echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') error "Build failed..." } @@ -210,6 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { + echo "Doing export: ${doexport}" if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) @@ -231,7 +233,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } catch (Exception e) { // doKillLeftovers() - error "Build failed - Killing leftovers" + error "Exception: ${e.message()}\nBuild failed - Killing leftovers" } } } From 9eec8e8822a25af77b13b533943d337858eec0e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:32:08 +0100 Subject: [PATCH 08/35] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 133 +++++++++++--------- 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e3d2ffb..b5b5401 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,6 +147,74 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } +def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing build and export project: ${project} : ${doexport}" + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" + """ + } + } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } + echo "Doing export: ${doexport}" + if (doexport) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } + } + } +} + +def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing export only project: ${project} : ${doexport}" + if (doexport) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + } + } +} + // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] @@ -166,74 +234,15 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" - """ - } - } - result = doCheck(exportpathlist, build_variant) - if (result != 0) { - error "Failed to check files...." - } - echo "Doing export: ${doexport}" - if (doexport) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } - } - } + doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } else { - echo "Doing export: ${doexport}" - if (doexport) { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - } - } + doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } } catch (Exception e) { // doKillLeftovers() - error "Exception: ${e.message()}\nBuild failed - Killing leftovers" + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" } } } From 3702a176238222d7b7faf30b55ae53a12fb34a0a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:39:32 +0100 Subject: [PATCH 09/35] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b5b5401..0de368c 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -234,7 +234,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) + doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) } else { doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) From 71b5f14aebcd7f1d151ec65ec412ce045b8b45a4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:46:24 +0100 Subject: [PATCH 10/35] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 0de368c..3070e4e 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { +// try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } - } catch (Exception e) { - echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } +// } catch (Exception e) { +// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" +// sleep(time: 4, unit: 'SECONDS') +// error "Build failed..." +// } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - try { +// try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -240,10 +240,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } - } catch (Exception e) { - // doKillLeftovers() - error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" - } +// } catch (Exception e) { +// // doKillLeftovers() +// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" +// } } } From 26ccb7c61103daae6805b9054ef0bb5f6136f8f9 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:59:14 +0100 Subject: [PATCH 11/35] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 3070e4e..779c235 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -194,7 +194,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 } } -def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing export only project: ${project} : ${doexport}" if (doexport) { if (!variants) { @@ -232,6 +232,8 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { + def Boolean build + def Boolean doexport (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) From 82fc5b6e05e9932527420aa318628f4e2a83a5f2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 18:37:16 +0100 Subject: [PATCH 12/35] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 779c235..9ab8df3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) -// try { + try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } -// } catch (Exception e) { -// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" -// sleep(time: 4, unit: 'SECONDS') -// error "Build failed..." -// } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { -// try { + try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -242,10 +242,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } -// } catch (Exception e) { -// // doKillLeftovers() -// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" -// } + } catch (Exception e) { + // doKillLeftovers() + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" + } } } From a0f4bcac3f89c19e0d2744fd8816dc819fc429c6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:24:14 +0100 Subject: [PATCH 13/35] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packaging/debian.groovy diff --git a/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..d55b6a9 --- /dev/null +++ b/packaging/debian.groovy @@ -0,0 +1,49 @@ +class DebRootDefinitions { + String PACKAGE_PREFIX + String PACKAGE_FOLDER_NAME + String PACKAGE_NAME + + String DEBPATH + + String ETC + String GIS_OPT_BIN + String GIS_OPT_LIB + String GIS_OPT_SCRIPTS_APP + String GIS_OPT_SCRIPTS_EL + String GIS_OPT_WWW + String GIS_OPT_OTHER + String GIS_OPT_LOGIC + String GIS_OPT_PRINTHEAD + + String USR_BIN + String USR_LIB_ARCH + String LIB_FIRMWARE + String HTTP_DEV_DIV + String LIB_SYSTEMD + + DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + PACKAGE_PREFIX = packageprefix + PACKAGE_FOLDER_NAME = packageprefix + buildstamp + PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + + DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + + ETC = "${DEBPATH}/etc" + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + + USR_BIN = "${DEBPATH}/usr/bin" + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + } +} + +return this; \ No newline at end of file From 0b7491ef4913a06b16dcc8dd598857bda23b9fe2 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:39:05 +0100 Subject: [PATCH 14/35] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index d55b6a9..127173e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,4 @@ -class DebRootDefinitions { +class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -21,7 +21,7 @@ class DebRootDefinitions { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" @@ -46,4 +46,8 @@ class DebRootDefinitions { } } +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) +} + return this; \ No newline at end of file From 99bc0a33fc5d0e2e7a8130656a71c7622de381db Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:47:37 +0100 Subject: [PATCH 15/35] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 127173e..84ba090 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH String ETC @@ -26,6 +27,7 @@ class DebRootDefinition { PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" From 3b5b2d11819ca02b472fc39fc27a55129a5a7e79 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:59:08 +0100 Subject: [PATCH 16/35] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 84ba090..9340180 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,5 @@ class DebRootDefinition { + String ROOTPATH String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -23,12 +24,13 @@ class DebRootDefinition { String LIB_SYSTEMD DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" - PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" - DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" + DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" From 6f37f6256364bc748d5de6e4096a9c748e30e7ae Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 14:42:12 +0100 Subject: [PATCH 17/35] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9340180..a7de1f0 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -54,4 +54,30 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix, Strin return new DebRootDefinition(rootpath, packageprefix, buildstamp) } +def buildPackage(String packageout, DebRootDefinition packagedefs) { + sh """#!/bin/bash + # Exit if any command fails + set -e + + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + """ +} + return this; \ No newline at end of file From b2cbec1d7cf8faf0b920b122662037e0c021639b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:08:54 +0100 Subject: [PATCH 18/35] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index a7de1f0..25d06a2 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -12,6 +12,7 @@ class DebRootDefinition { String GIS_OPT_LIB String GIS_OPT_SCRIPTS_APP String GIS_OPT_SCRIPTS_EL + String GIS_OPT_SCRIPTS_CONTROL String GIS_OPT_WWW String GIS_OPT_OTHER String GIS_OPT_LOGIC @@ -37,6 +38,7 @@ class DebRootDefinition { GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" From 653623282ec8dad33944edd51d1d3661decd9d63 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 14:57:02 +0100 Subject: [PATCH 19/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 109 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 publish/package.groovy diff --git a/publish/package.groovy b/publish/package.groovy new file mode 100644 index 0000000..3efe70b --- /dev/null +++ b/publish/package.groovy @@ -0,0 +1,109 @@ +pipeline { + agent { label "${AGENT_LABEL}" } + stages { + stage('Initial setup') { + steps { + script { + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) + } + } + } + stage('Checkout dependencies') { + steps { + script { + configurationhelper = autobuilder.configurationhelper() + + PYTHONURL = 'git@hydra:tools/python.git' + if (isUnix()) { + PYTHONBRANCH = "origin/3.6.3_linux" + } + else { + PYTHONBRANCH = "origin/3.6.3_windows" + } + PYTHONDIR = "${WORKSPACE}/python" + PYTHONROOTDIR = 'python' + configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR) + if (isUnix()) { + env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3" + } + else { + env.PYTHON = "${PYTHONDIR}/ver/python.exe" + } + } + } + } + stage('Clean exports') { + steps { + script { + PACKAGEDEST = "${WORKSPACE}/package" + cleanfolders = [ + PACKAGEDEST, + ] + cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") + cleaner.clean(cleanfolders) + } + } + } + stage('Copying package artifacts') { + steps { + script { + packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + } + } + } + stage('Aptly environment') { + steps { + script { + echo "Aptly config file is ${APTLY_CONFIG_FILE}" + sh """!/#bin/bash + aptly config show + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + stage('Create repo - if not already there') { + steps { + script { + echo "Repo name is ${REPO_NAME}" + sh """!/#bin/bash + aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + if [ \$? -ne 0 ]; then + echo "aptly repo ${REPO_NAME} does not exist; Creating it" + aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + fi + """ + } + } + } + stage('Create snapshot - if not already there') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """!/#bin/bash + # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + """ + } + } + } + } + post { + always { + echo 'Post-build' + } + failure { + echo 'Failed build' + } + unstable { + echo 'Unstable build' + } + success { + echo 'Succeeded build' + } + } +} + From 0d396b78b9a208804ca9cba33f92c80020ddb586 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:10:03 +0100 Subject: [PATCH 20/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index 3efe70b..da6791c 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -47,6 +47,7 @@ pipeline { stage('Copying package artifacts') { steps { script { + importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) } } From fc780b39ac0e77a8b887906c9e9b11369ba7262e Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:11:54 +0100 Subject: [PATCH 21/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index da6791c..bf48231 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -56,7 +56,7 @@ pipeline { steps { script { echo "Aptly config file is ${APTLY_CONFIG_FILE}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly config show if [ \$? -ne 0 ]; then exit 1; fi """ @@ -67,7 +67,7 @@ pipeline { steps { script { echo "Repo name is ${REPO_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" @@ -84,7 +84,7 @@ pipeline { echo "Snapshot name is ${SNAPSHOT_NAME}" FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" - sh """!/#bin/bash + sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" """ From 11c4c7ab0e21a8530ca2fcf09a9cfb3fbc9c0426 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:17:50 +0100 Subject: [PATCH 22/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/publish/package.groovy b/publish/package.groovy index bf48231..8626a61 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -87,6 +87,7 @@ pipeline { sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" """ } } From 9da4613bfca89e156ab90454c8b0e4af62a52e0f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:41:19 +0100 Subject: [PATCH 23/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index 8626a61..5fe46e8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -49,6 +49,7 @@ pipeline { script { importer = load("${autobuilder.commonscripts()}/import/importer.groovy") packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST) + PACKAGE_FOLDER = "${PACKAGEDEST}/package" } } } @@ -78,6 +79,17 @@ pipeline { } } } + stage('Add/update package in snapshot') { + steps { + script { + echo "Package folder is ${PACKAGE_FOLDER}" + sh """#!/bin/bash -v + aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } stage('Create snapshot - if not already there') { steps { script { @@ -86,8 +98,11 @@ pipeline { echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v # This errors if the snapshot exists already; Ignore it + aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From acb477c98433989ddf77a6098b046276b34aa110 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:42:28 +0100 Subject: [PATCH 24/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 5fe46e8..253f22e 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly snapshot -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 691c3bb58eb4fc0e3647405688c48397e861c8f1 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:44:26 +0100 Subject: [PATCH 25/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 253f22e..99a2bdf 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" add -force-replace "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 6684ef24f0fe98fee8b65fe9b0323c3f632ea271 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:46:25 +0100 Subject: [PATCH 26/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index 99a2bdf..b3256a8 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -84,7 +84,7 @@ pipeline { script { echo "Package folder is ${PACKAGE_FOLDER}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${PACKAGE_FOLDER}" + aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi """ } From e4b42daad4ba89c2704138c84b033eb35bc3d7c0 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 27 Aug 2019 15:51:48 +0100 Subject: [PATCH 27/35] HMBXR5601-827 - Add package publish operations --- publish/package.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/publish/package.groovy b/publish/package.groovy index b3256a8..eac8553 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -86,6 +86,8 @@ pipeline { sh """#!/bin/bash -v aptly repo -config="${APTLY_CONFIG_FILE}" -force-replace add "${REPO_NAME}" "${PACKAGE_FOLDER}" if [ \$? -ne 0 ]; then exit 1; fi + aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } From 95c87fad2b6374d0aec64804a3f268a0ab6e89aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:22:15 +0100 Subject: [PATCH 28/35] HMBXR5601-827 - Publish package --- publish/package.groovy | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index eac8553..8e91143 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -92,7 +92,7 @@ pipeline { } } } - stage('Create snapshot - if not already there') { + stage('Create snapshot') { steps { script { echo "Snapshot name is ${SNAPSHOT_NAME}" @@ -109,6 +109,21 @@ pipeline { } } } + stage('Publish snapshot') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } } post { always { From f7e227ce0175b0d7cc3d818b9d5997149264363a Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:29:06 +0100 Subject: [PATCH 29/35] HMBXR5601-827 - Publish package --- publish/package.groovy | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 8e91143..2a84034 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -79,7 +79,20 @@ pipeline { } } } - stage('Add/update package in snapshot') { + stage('Drop published repo - if any') { + steps { + script { + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } + + stage('Add/update package in repo') { steps { script { echo "Package folder is ${PACKAGE_FOLDER}" @@ -112,12 +125,7 @@ pipeline { stage('Publish snapshot') { steps { script { - echo "Snapshot name is ${SNAPSHOT_NAME}" - FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" - echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" sh """#!/bin/bash -v - # This errors if the published repo exists already; Ignore it - aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ From fa69b27231d007ce8c2a3e5882a360bc3d7f33ab Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 11:36:05 +0100 Subject: [PATCH 30/35] HMBXR5601-827 - Show more status; Handle component areas of published repos --- publish/package.groovy | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/publish/package.groovy b/publish/package.groovy index 2a84034..00f5923 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -69,12 +69,14 @@ pipeline { script { echo "Repo name is ${REPO_NAME}" sh """#!/bin/bash -v - aptly repo -config="${APTLY_CONFIG_FILE}" show "${REPO_NAME}" + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" if [ \$? -ne 0 ]; then echo "aptly repo ${REPO_NAME} does not exist; Creating it" aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi fi + aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi """ } } @@ -116,7 +118,7 @@ pipeline { aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}" aptly snapshot -config="${APTLY_CONFIG_FILE}" create "${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}" if [ \$? -ne 0 ]; then exit 1; fi - aptly snapshot -config="${APTLY_CONFIG_FILE}" show "${FULL_SNAPSHOT_NAME}" + aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}" if [ \$? -ne 0 ]; then exit 1; fi """ } @@ -126,7 +128,11 @@ pipeline { steps { script { sh """#!/bin/bash -v - aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" -force-overwrite snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" list + if [ \$? -ne 0 ]; then exit 1; fi + aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" if [ \$? -ne 0 ]; then exit 1; fi """ } From 5c86cf641de5ad239511216363ded7574c917ed3 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 3 Sep 2019 17:22:13 +0100 Subject: [PATCH 31/35] HMBXR5601-827 - Change names of packages to be neutral and without buildstamps to make future jobs easier --- packaging/debian.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 25d06a2..57d84fb 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -27,8 +27,8 @@ class DebRootDefinition { DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix - PACKAGE_FOLDER_NAME = packageprefix + buildstamp - PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_FOLDER_NAME = packageprefix + PACKAGE_NAME = packageprefix + "_armhf.deb" PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" From 78ed8a7e50e09f589cedc6ced581e764df80b7f4 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:35:37 +0100 Subject: [PATCH 32/35] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- packaging/debian.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 57d84fb..9799ba9 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -24,7 +24,7 @@ class DebRootDefinition { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix) { ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix @@ -52,8 +52,8 @@ class DebRootDefinition { } } -def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { - return new DebRootDefinition(rootpath, packageprefix, buildstamp) +def DebRootDefinition debDefinition(String rootpath, String packageprefix) { + return new DebRootDefinition(rootpath, packageprefix) } def buildPackage(String packageout, DebRootDefinition packagedefs) { From c10055c58c6b3980a992965a8de821d40777e797 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:40:02 +0100 Subject: [PATCH 33/35] HMBXR5601-827 - Use release tag rather than build number to make each package unique --- meta/folder.groovy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/folder.groovy b/meta/folder.groovy index ddc99c4..6967def 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -722,6 +722,10 @@ class MetaInfo extends GISJsonSerialised { return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber } + String releasetagfordebpackage() { + return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber + } + Map putwithshortestoffsetpath(Map releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) { if (releasemetacollection.containsKey(uniquestring)) { def existingentry = releasemetacollection[uniquestring] From b83050abc00d2e1efda12d60710ba2554297e458 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 08:56:49 +0100 Subject: [PATCH 34/35] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 4c380a6..7a9c397 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -19,21 +19,15 @@ def main(argv): print("Converting incidences of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert)) - filecopy = filetoconvert + ".orig" - try: - shutil.move(filetoconvert, filecopy) - except FileNotFoundError: - print("Could not find file: {0}\n".format(filetoconvert)) - return 1 + with open(filetoconvert,'r') as c: + fileread = c.read() count = 0 with open(filetoconvert, 'x') as f: - with open(filecopy,'r') as c: - fileread = c.read() - print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) - converted = fileread.replace(pattern, substitute) - count = converted.count(substitute) - print("Confirmed %s instances of %s post-conversion"%(count,substitute)) + print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) + converted = fileread.replace(pattern, substitute) + count = converted.count(substitute) + print("Confirmed %s instances of %s post-conversion"%(count,substitute)) f.write(converted) if count == 0: From 383fe72e7bf827509f4fc9fe70f023fa886b602b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 5 Sep 2019 09:00:42 +0100 Subject: [PATCH 35/35] HMBXR5601-827 - Versionstamper.py is leaving excess files in package --- versionstamping/versionstamper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 7a9c397..1a65e6d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -23,7 +23,7 @@ def main(argv): fileread = c.read() count = 0 - with open(filetoconvert, 'x') as f: + with open(filetoconvert, 'w') as f: print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern)) converted = fileread.replace(pattern, substitute) count = converted.count(substitute)