summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-06-07 13:55:46 -0400
committerDan Timoney <dtimoney@att.com>2021-06-07 14:30:33 -0400
commit06b500355c944970d176c81230f40c76c00977d3 (patch)
treedcfbbc775e4015f1deaec10c729088de0b9fabf9 /tools
parent67cb8d57527df08bd6997eb8b500ce31139016ce (diff)
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 <dtimoney@att.com> Change-Id: Icd125d65a4a5ca50dd97a877bc85389299ff4fe1
Diffstat (limited to 'tools')
-rwxr-xr-xtools/mkbom.sh67
1 files changed, 57 insertions, 10 deletions
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 <<END
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -35,23 +50,55 @@ cat <<END
<dependencies>
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 " <dependency>"
- echo " <groupId>$groupId</groupId>"
- echo " <artifactId>$artifactId</artifactId>"
- echo " <version>$version</version>"
- echo " </dependency>"
+ if [ "$lastGroupId" != "UNSET" ]
+ then
+ if [ "$lastGroupId" != "$groupId" -o "$lastArtifactId" != "$artifactId" ]
+ then
+ echo " <dependency>"
+ echo " <groupId>$lastGroupId</groupId>"
+ echo " <artifactId>$lastArtifactId</artifactId>"
+ echo " <version>$lastVersion</version>"
+ echo " </dependency>"
+ fi
+ fi
+ lastGroupId=$groupId
+ lastArtifactId=$artifactId
+ lastVersion=$version
done
+echo " <dependency>"
+echo " <groupId>$lastGroupId</groupId>"
+echo " <artifactId>$lastArtifactId</artifactId>"
+echo " <version>$lastVersion</version>"
+echo " </dependency>"
+
cat <<END
</dependencies>
</dependencyManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <!-- This version supports the "deployAtEnd" parameter -->
+ <version>2.8</version>
+ <configuration>
+ <skip/>
+ <deployAtEnd>true</deployAtEnd>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
END