Merge remote-tracking branch 'origin/master_packages'
This commit is contained in:
commit
9b7e133ea3
2 changed files with 171 additions and 65 deletions
|
|
@ -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 = ""
|
||||
|
|
@ -62,24 +62,26 @@ def doExport(exportfolder, exportpathlist, project = "", 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}/${project}"
|
||||
srcFileExpanded = "${WORKSPACE}/${exportpath}"
|
||||
}
|
||||
destFolder = "${exportfolder}"
|
||||
if (partdest) {
|
||||
destFolder += "/" + partdest
|
||||
}
|
||||
}
|
||||
dir (destFolder) {
|
||||
echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\""
|
||||
def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
dir (destFolderExpanded) {
|
||||
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
|
||||
|
|
@ -90,7 +92,7 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") {
|
|||
}
|
||||
else {
|
||||
result = bat( script: """
|
||||
copy "${srcFileExpanded}" "${destFolder}"
|
||||
copy "${srcFileExpanded}" "${destFolderExpanded}"
|
||||
if errorlevel 1 EXIT /b 1
|
||||
""",
|
||||
returnStatus: true
|
||||
|
|
@ -145,8 +147,76 @@ 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) {
|
||||
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}/bin") {
|
||||
def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") {
|
||||
toBuild = []
|
||||
if (variantstobuild) {
|
||||
toBuildUntrimmed = variantstobuild.split(',')
|
||||
|
|
@ -161,69 +231,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou
|
|||
addToolchainPath(toolchainfolder)
|
||||
doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder)
|
||||
}
|
||||
for (appInfo in apps ) {
|
||||
(build, cleanbuild, project, variants, exportpathlist) = appInfo
|
||||
for (appInfo in apps) {
|
||||
def Boolean build
|
||||
def Boolean doexport
|
||||
(build, doexport, 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}\"\'"
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
echo Start time: `date`
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'
|
||||
echo End time: `date`
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
result = doCheck(exportpathlist, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to check files...."
|
||||
}
|
||||
result = doExport(exportfolder, exportpathlist, "", build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Not building ${build_variant} variant of project: ${project}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
echo "Build failed - Waiting for a while"
|
||||
sleep(time: 4, unit: 'SECONDS')
|
||||
error "Build failed..."
|
||||
}
|
||||
}
|
||||
}
|
||||
doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
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)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// doKillLeftovers()
|
||||
error "Build failed - Killing leftovers"
|
||||
error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
85
packaging/debian.groovy
Normal file
85
packaging/debian.groovy
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
class DebRootDefinition {
|
||||
String ROOTPATH
|
||||
String PACKAGE_PREFIX
|
||||
String PACKAGE_FOLDER_NAME
|
||||
String PACKAGE_NAME
|
||||
|
||||
String PACKAGE_SOURCE_FOLDER_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_SCRIPTS_CONTROL
|
||||
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
|
||||
|
||||
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}"
|
||||
|
||||
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_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"
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) {
|
||||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue