Removes entries from the final update.cfg file for which no image was generated.
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 4 Jun 2021 09:51:07 +0000 (11:51 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 4 Jun 2021 09:51:07 +0000 (11:51 +0200)
Until now, the update.cfg file has contained entries even when the
related image file was not generated due to lack of differences. For
example if there were no differences between Tizen versions for boot.img
then the image as not placed in delta.tar file, but in update.cfg the
entry associated with it remained.

This patch removes entries for which there is no corresponding image. In
case the resulting update.cfg (e.g. an update between the same
versions), the mk_delta.sh script will end with an error.

Change-Id: I61278a8f1efb69bd908b1dd1aae5ebf714963f6e

mk_delta/common/bin/mk_delta.sh

index 14e3a06..935dff5 100755 (executable)
@@ -311,6 +311,10 @@ do
                                        sudo mv data/${PART_OUT} ${RESULT_DIR}/${part_bin}
                                        sudo mv ${RESULT_DIR}/${part_bin}/${delta_bin} ${DELTA_DIR}
                                fi
+                               if [ "$?" != "0" ]; then
+                                       echo "Warning: No differences - remove record for \"${part_name}\" from the final update.cfg"
+                                       sed -i "/^${part_name}\b/d" "${UPDATE_CFG_PATH}"
+                               fi
                        else
                                sudo rm -rf ${RESULT_DIR}/${part_bin}
                                echo "Error: Abort Delta Generation"
@@ -320,6 +324,11 @@ do
                sudo rm -rf ${RESULT_DIR}/${part_bin}
        done
 
+       if [ ! -s "${UPDATE_CFG_PATH}" ]; then
+               echo "Error: No differences between versions - abort delta generation"
+               exit 2
+       fi
+
        #move update.cfg to delta directory
        if [ -r ${UPDATE_CFG_PATH} ]; then
                sudo cp ${UPDATE_CFG_PATH} ${DELTA_DIR}/update.cfg