HMBXR5601-827 - Provide packages with unique filenames so that aptly stops complaining about identical files

This commit is contained in:
Dan Hawkins 2019-09-09 14:48:15 +01:00
commit 2c62802a84
2 changed files with 9 additions and 4 deletions

View file

@ -24,11 +24,12 @@ class DebRootDefinition {
String HTTP_DEV_DIV
String LIB_SYSTEMD
DebRootDefinition(String rootpath, String packageprefix) {
DebRootDefinition(String rootpath, String packageprefix, String buildstamp) {
ROOTPATH = rootpath
PACKAGE_PREFIX = packageprefix
PACKAGE_FOLDER_NAME = packageprefix
PACKAGE_NAME = packageprefix + "_armhf.deb"
UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb"
PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}"
DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}"
@ -56,7 +57,7 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix) {
return new DebRootDefinition(rootpath, packageprefix)
}
def buildPackage(String packageout, DebRootDefinition packagedefs, String password) {
def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) {
try {
sh """#!/bin/bash
# Exit if any command fails
@ -80,6 +81,9 @@ def buildPackage(String packageout, DebRootDefinition packagedefs, String passwo
echo "Building package:"
dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}"
mkdir -v -p "${uniquepackageout}"
cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}"
echo "Showing package:"
dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}"
echo "Showing package contents:"

View file

@ -50,6 +50,7 @@ pipeline {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST)
PACKAGE_FOLDER = "${PACKAGEDEST}/package"
UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage"
}
}
}
@ -97,9 +98,9 @@ pipeline {
stage('Add/update package in repo') {
steps {
script {
echo "Package folder is ${PACKAGE_FOLDER}"
echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}"
sh """#!/bin/bash -v
aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${PACKAGE_FOLDER}"
aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${UNIQUE_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