ccollins476ad opened a new pull request #343: Mcuboot hack to prevent `newt 
upgrade` failure
URL: https://github.com/apache/mynewt-newt/pull/343
 
 
   For projects using mcuboot, `newt upgrade` has been failing.  The error 
message is:
   ```
   Error: Error updating "mcuboot": error: The following untracked working
   tree files would be overwritten by checkout:
           ext/mbedtls/include/mbedtls/asn1.h
           ext/mbedtls/include/mbedtls/bignum.h
           ext/mbedtls/include/mbedtls/check_config.h
           ext/mbedtls/include/mbedtls/config.h
           ext/mbedtls/include/mbedtls/ecdsa.h
           ext/mbedtls/include/mbedtls/ecp.h
           ext/mbedtls/include/mbedtls/md.h
           ext/mbedtls/include/mbedtls/oid.h
           ext/mbedtls/include/mbedtls/pk.h
           ext/mbedtls/include/mbedtls/platform.h
           ext/mbedtls/include/mbedtls/platform_util.h
           ext/mbedtls/include/mbedtls/threading.h
   Please move or remove them before you switch branches.
   Aborting
   ```
   The problem is caused by a recent change to mcuboot - a normal directory was 
replaced with a submodule.  Git is unable to transition from a post-replace 
commit to a pre-replace commit because some files in the submodule used to 
exist in the mcuboot repo itself.
   
   This commit implements a pair of hacks to workaround this problem.  Upon 
performing a checkout operation on the mcuboot repo:
   
   1. If newt detects the above error message, it removes the `ext/mbedtls` 
directory and tries again.
   
   2. If newt detects a different warning message (`unable to rmdir 
'sim/mcuboot-sys/mbedtls': Directory not empty`), it removes 
`sim/mcuboot-sys/mbedtls`.
   
   The second hack is required when transitioning from pre-replace to 
post-replace.  In this case, the checkout operation succeeds, but an orphaned 
directory is left behind, making the repo look dirty.
   
   This is expected to be a short-term fix.  When we have a general fix for 
this issue, this hack can be removed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to