src-rev/jenkins: adapted src-rev to handle packages from a file

the file autorev-packages.inc holds holds all recipes with a
SRCREV set to AUTOREV.
When releasing this file shall be used as base which recipes to
update.

BugzID: 75209
Signed-off-by: Marc Mattmueller <marc.mattmueller@netmodule.com>
This commit is contained in:
Marc Mattmueller 2021-10-13 11:37:41 +02:00 committed by Gitea
parent 0704618e91
commit 6848564543
3 changed files with 42 additions and 19 deletions

View File

@ -70,7 +70,7 @@ def cleanupAutoRevIncludeFile(versionParam) {
def updateSourceRevisions() {
println "update source revisions to head..."
sh(returnStdout: true, script: "bash -c '. ./env.image-ostree > /dev/null && cd ../ && ./src-rev.sh -v -d -r -l ./srcrev.log'")
sh(returnStdout: true, script: "bash -c '. ./env.image-ostree > /dev/null && cd ../ && ./src-rev.sh -v -d -r -l ./srcrev.log -a ./autorev-packages.inc'")
}

View File

@ -111,7 +111,7 @@ def updateMachineSrcRevs(machine) {
println "update source revisions for ${env.MACHINE} to head..."
sh("echo '==> ${env.MACHINE} =======================' >> ./${env.SOURCE_REVISION_UPDATE_LOG}")
sh("bash -c '. ./env.image-ostree > /dev/null && cd ../'")
sh(returnStdout: true, script: "./src-rev.sh -v -d -r -l ./srcrev.log")
sh(returnStdout: true, script: "./src-rev.sh -v -d -r -l ./srcrev.log -a ./autorev-packages.inc")
sh("cat ./srcrev.log >> ./${env.SOURCE_REVISION_UPDATE_LOG}")
}

View File

@ -6,10 +6,11 @@ SCRIPT_NAME=$(basename ${SCRIPT_PATHNAME})
SCRIPT_PATH=$(dirname ${SCRIPT_PATHNAME})
YOCTO_DIR="${YOCTO_DIR:-$SCRIPT_PATH}"
export LOGFILE=/dev/null
export IS_REPLACE_SRCREV=false
export IS_VERBOSE=false
export IS_DISPLAY=false
LOGFILE=/dev/null
IS_REPLACE_SRCREV=false
IS_VERBOSE=false
IS_DISPLAY=false
LIST=""
#**********************************************************************************************
# local helper functions
@ -18,13 +19,19 @@ export IS_DISPLAY=false
function printUsage()
{
echo -e "\nUsage: ${SCRIPT_NAME} [OPTIONS]\n"
echo -e "find the source revision of the packages within the netmodule meta layers and"
echo -e "display/replace them with the latest hashes."
echo -e "NOTE: there is a list containing packages set to AUTOREV. Use option -a to handle"
echo -e "only revisions of this list. Otherwise we might get incompatible versions of 3rd"
echo -e "party packages.\n"
echo -e ""
echo -e " OPTIONS:"
echo -e " -r|--replace replace SRCREVs"
echo -e " -d|--display display found SRVREVs"
echo -e " -l|--log=LOGFILE write command output to LOGFILE (default = $LOGFILE)"
echo -e " -h|--help Show this help"
echo -e " -v|--verbose Set script to verbose"
echo -e " OPTIONS:"
echo -e " -r|--replace replace SRCREVs"
echo -e " -d|--display display found SRVREVs"
echo -e " -a|--autorev-list=LIST handle only revisions of LIST (e.g. autorev-packages.inc)"
echo -e " -l|--log=LOGFILE write command output to LOGFILE (default = $LOGFILE)"
echo -e " -h|--help show this help"
echo -e " -v|--verbose set script to verbose"
}
#----------------------------------------------------------------------------------------------
function logMessage()
@ -55,18 +62,28 @@ function checkingEnvironment()
fi
}
#----------------------------------------------------------------------------------------------
function getBBFiles()
{
if [[ "${LIST}" == "" ]]; then
files=$(find ${YOCTO_DIR}/meta-netmodule* -name "*.bb" | xargs -i sh -c "grep -q SRCREV {} && echo {}")
else
files=$(cat $LIST | grep "#" | cut -d'#' -f2)
fi
echo "${files}"
}
#----------------------------------------------------------------------------------------------
function displayItem()
{
local bbfile="${1}"
local recipeName="${2}"
local revision="${3}"
printMessage "Recipe: $recipe"
printMessage "New Revision: $newrev"
printMessage "Recipe: $recipeName"
printMessage "New Revision: $revision"
printMessage "BB File: $bbfile"
if [[ "${IS_DISPLAY}" == "true" && "${IS_VERBOSE}" == "false" ]]; then
echo "Recipe: $recipe"
echo "New Revision: $newrev"
echo "Recipe: $recipeName"
echo "New Revision: $revision"
echo "BB File: $bbfile"
fi
}
@ -75,7 +92,7 @@ function displayItem()
#**********************************************************************************************
# main
#**********************************************************************************************
O=$(getopt -o hl:vrd --long help,log:,verbose,replace,display -- "$@") || exit 1
O=$(getopt -o hl:a:vrd --long help,log:,autorev-list:,verbose,replace,display -- "$@")
if [ $? != 0 ]; then
echo "ERROR: Could not parse command line options"
exit 1
@ -96,6 +113,11 @@ while true; do
export IS_REPLACE_SRCREV=true
shift
;;
-a|--autorev-list)
export LIST="${2}"
export LIST=$(realpath "${LIST}")
shift 2
;;
-l|--log)
export LOGFILE="${2}"
export LOGFILE=$(realpath "${LOGFILE}")
@ -118,8 +140,8 @@ done
echo "${SCRIPT_NAME} called with ${SCRIPT_PARAMS}" > $LOGFILE
checkingEnvironment
printMessage "> get bbfiles..."
bbfiles=$(find ${YOCTO_DIR}/meta-netmodule* -name "*.bb" | xargs -i sh -c "grep -q SRCREV {} && echo {}")
printMessage "> get bbfiles (LIST='${LIST}')..."
bbfiles=$(getBBFiles)
logMessage "${bbfiles}"
printMessage "> getting recipes residing in bbfiles..."
@ -128,6 +150,7 @@ logMessage "${recipes}"
printMessage "> getting check-upgrade-status..."
newcommits=$(devtool check-upgrade-status $recipes 2>&1 | grep "new commits")
logMessage "${newcommits}"
IFS=$'\n'
for newcommit in $newcommits; do