Tox template for single branch projects
[releng/builder.git] / jjb / integration / include-raw-integration-compare-distributions.sh
index 05a8e1acf4adba6a73dbdd42731d10fac6674bd6..ae172ad368ae3a452f72661455fe39092506a36b 100644 (file)
@@ -9,21 +9,24 @@ wget --progress=dot:mega $ACTUALBUNDLEURL
 echo "Extracting the last distribution found on nexus..."
 unzip -q $BUNDLE
 mv $BUNDLEFOLDER /tmp/distro_old
+rm $BUNDLE
 
 echo "Extracting the distribution just created by this job..."
 NEW_DISTRO=$(find $WORKSPACE -name distribution-karaf*.zip)
 NEW_DISTRO_BASENAME=$(basename $NEW_DISTRO)
 cp $NEW_DISTRO /tmp/
 cd /tmp/
-# the following extracts the .zip and learns the name of the folder extracted to
-EXTRACTED_FOLDER=$(unzip $NEW_DISTRO_BASENAME | grep -m1 'creating:' | cut -d' ' -f5-)
+# get the name of the folder which will be extracted to
+EXTRACTED_FOLDER=$(unzip $NEW_DISTRO_BASENAME | grep 'creating:' | grep -v '/.' | cut -d' ' -f5-)
 mv $EXTRACTED_FOLDER distro_new
 
 git clone https://git.opendaylight.org/gerrit/p/integration/test.git
 cd test/tools/distchanges
 mkdir -p $WORKSPACE/archives
 
-python distcompare.py -r ssh://jenkins-$SILO@git.opendaylight.org:29418 | tee $WORKSPACE/archives/dist_diff.txt
-# TODO: the output of the above command is not *friendly* for the reader because the most important info
-# is listed last. This is fine/best for command line output, but for keeping in a file it would be better
-# to put the summary at the beginning of the file. Some bash magic can be done here to make that happen.
+# Full output of compare tool will be in temp file /tmp/dist_diff.txt
+# The file/report to be archived will only list the distribution in the comparison and the patches that
+# are different.
+python distcompare.py -r ssh://jenkins-$SILO@git.opendaylight.org:29418 | tee /tmp/dist_diff.txt
+echo -e "Patch differences listed are in comparison to:\n\t$ACTUALBUNDLEURL\n\n" > $WORKSPACE/archives/distribution_differences.txt
+sed -ne '/Patch differences/,$ p' /tmp/dist_diff.txt >> $WORKSPACE/archives/distribution_differences.txt