diff options
author | Roland Grunberg <rgrunber@redhat.com> | 2014-06-03 12:52:14 -0400 |
---|---|---|
committer | Roland Grunberg <rgrunber@redhat.com> | 2014-06-03 12:59:28 -0400 |
commit | 992650f993c0186c0bcf7b3373b666e77af2ff79 (patch) | |
tree | 376b780cf60a51e4eefdfadf335116a63f68e9d4 /prepTestBundle.sh | |
parent | f7ab45d6f6ceb405b392df2bcd51c67eaf232d6c (diff) | |
download | tycho-surefire-testbundlerunner-992650f993c0186c0bcf7b3373b666e77af2ff79.tar.gz tycho-surefire-testbundlerunner-992650f993c0186c0bcf7b3373b666e77af2ff79.tar.xz tycho-surefire-testbundlerunner-992650f993c0186c0bcf7b3373b666e77af2ff79.zip |
- Use better logic for Bundle-SymbolicName lookup
- Be more explicit about pom.xml lookup in jars
Diffstat (limited to 'prepTestBundle.sh')
-rwxr-xr-x | prepTestBundle.sh | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/prepTestBundle.sh b/prepTestBundle.sh index 694857f..53981e0 100755 --- a/prepTestBundle.sh +++ b/prepTestBundle.sh @@ -30,6 +30,36 @@ # --> target/classes/**.class # --> resources/ +function readBSN () { + +bsn= +manEntryPat="^[a-zA-Z-]*:" +foundBSNLine=0 + +while read line; do +if [ ${foundBSNLine} -eq 1 ]; then + echo ${line} | grep -qE ${manEntryPat} + if [ $? -eq 0 ]; then + break + else + bsn=${bsn}"`echo ${line} | sed 's/\([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`" + fi +fi + +echo ${line} | grep -q "Bundle-SymbolicName:" +if [ $? -eq 0 ]; then + bsn=`echo ${line} | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'` + echo ${line} | grep "Bundle-SymbolicName:" | grep -q ";" + if [ $? -eq 0 ]; then + break + fi + foundBSNLine=1 +fi +done < <(unzip -p $1 'META-INF/MANIFEST.MF') + +echo ${bsn} +} + if [ ! $# -eq 1 ]; then echo "USAGE : $0 /PATH/TO/JAR" exit 1 @@ -38,10 +68,10 @@ fi jarLoc=$1 jarPomPath=`jar -tf ${jarLoc} | grep 'pom.xml'` -bsname=`unzip -p ${jarLoc} 'META-INF/MANIFEST.MF' | grep 'Bundle-SymbolicName' | sed 's/Bundle-SymbolicName: \([a-zA-Z.]*\)\(;\)\?.*/\1/'` +bsname=`readBSN ${jarLoc}` mkdir ${bsname} -pushd ${bsname} +pushd ${bsname} >/dev/null # place manifest and pom jar -xf ${jarLoc} 'META-INF/MANIFEST.MF' ${jarPomPath} @@ -57,15 +87,15 @@ sed -i '/<parent>/,/<\/parent>/ s/<version>.*<\/version>/<version>1.0.0-SNAPSHOT # place classes # non-classes will just be ignored mkdir -p target/classes -pushd target/classes +pushd target/classes >/dev/null jar -xf ${jarLoc} -popd +popd >/dev/null # place resources and other files # non-resources will just be ignored jar -xf ${jarLoc} -popd +popd >/dev/null if [ ! -e pom.xml ]; then cp pom.xml{.orig,} |