From 06b500355c944970d176c81230f40c76c00977d3 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Mon, 7 Jun 2021 13:55:46 -0400 Subject: Handle duplicate installed versions Adjust mkbom.sh to handle the case where multiple versions of a jar comes pre-installed in OpenDaylight by sorting entries by groupId/artifactId/versionId and then using the latest installed version. Issue-ID: CCSDK-3328 Signed-off-by: Dan Timoney Change-Id: Icd125d65a4a5ca50dd97a877bc85389299ff4fe1 --- tools/mkbom.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 10 deletions(-) (limited to 'tools') diff --git a/tools/mkbom.sh b/tools/mkbom.sh index f2615b84..fcaed72c 100755 --- a/tools/mkbom.sh +++ b/tools/mkbom.sh @@ -10,6 +10,21 @@ pomGroupId=$1 pomArtifactId=$2 pomVersion=$3 +jarlist=/tmp/mkbom-jar-$$ + + + +# Make list of jars +for jar in $(find . -name '*.jar' -print | cut -d'/' -f2- | sort) +do + version=$(echo $jar | rev | cut -d'/' -f2 | rev) + artifactId=$(echo $jar | rev | cut -d'/' -f3 | rev) + groupId=$(echo $jar | rev | cut -d'/' -f4- | rev | tr '/' '.') + echo "$groupId|$artifactId|$version" >> $jarlist +done + + + cat < @@ -35,23 +50,55 @@ cat < END - -for jar in $(find . -name '*.jar' -print | cut -d'/' -f2- | sort) +lastGroupId="UNSET" +lastArtifactId="UNSET" +lastVersion="UNSET" +for ln in $(cat $jarlist | sort -u) do - version=$(echo $jar | rev | cut -d'/' -f2 | rev) - artifactId=$(echo $jar | rev | cut -d'/' -f3 | rev) - groupId=$(echo $jar | rev | cut -d'/' -f4- | rev | tr '/' '.') + groupId=$(echo $ln | cut -d'|' -f1) + artifactId=$(echo $ln | cut -d'|' -f2) + version=$(echo $ln | cut -d'|' -f3) - echo " " - echo " $groupId" - echo " $artifactId" - echo " $version" - echo " " + if [ "$lastGroupId" != "UNSET" ] + then + if [ "$lastGroupId" != "$groupId" -o "$lastArtifactId" != "$artifactId" ] + then + echo " " + echo " $lastGroupId" + echo " $lastArtifactId" + echo " $lastVersion" + echo " " + fi + fi + lastGroupId=$groupId + lastArtifactId=$artifactId + lastVersion=$version done +echo " " +echo " $lastGroupId" +echo " $lastArtifactId" +echo " $lastVersion" +echo " " + cat < + + + + + org.apache.maven.plugins + maven-deploy-plugin + + 2.8 + + + true + + + + END -- cgit 1.2.3-korg