ARMmbed / mbed-cli

Arm Mbed Command Line Interface
https://os.mbed.com
Apache License 2.0
333 stars 176 forks source link

Allow updating single libraries (mbed update test-lib.lib) #143

Closed teetak01 closed 8 years ago

teetak01 commented 8 years ago

At least I did not notice if there is any way to update a single dependency without going through all the modules.

Would be faster to test/update single dependencies without having to go through the process of checking through also all the mbed-os modules.

screamerbg commented 8 years ago

Do you mean non-recursive update?

teetak01 commented 8 years ago

Probably, my use-case:

I updated the commit-id in the .lib for a single library and only would have wanted that this repository is updated. Instead it went through all mbed-os components and this takes several minutes at worst.

screamerbg commented 8 years ago

From a workflow point of view would you prefer:

I think directly using git might be better/convenient?

teetak01 commented 8 years ago

I think I am still misunderstanding some parts of how mbed-cli should work.

I might have been asking for something closer to mbed deploy command. For example if I currently run mbed deploy mbed-client-cli.lib it starts to process through all modules in the program:

teetak01@machine:~/morpheus-dev/mbed-client-testapp (morpheus_support)$ mbed deploy mbed-client-cli.lib 
[mbed] Updating library "mbed-os" to rev #c4986eed9f42cbb3352c793d7a16d512d978d102
[mbed] Updating library "mbed-os/core/uvisor-mbed-lib" to rev #9b0756ac4889a26b999383ab82691d05d98f9496
[mbed] Updating library "mbed-os/core/mbedtls" to rev #bef26f687287
[mbed] Updating library "mbed-os/frameworks/greentea-client" to rev #398d96e25630
[mbed] Updating library "mbed-os/frameworks/unity" to rev #3b2fef7fcf60abcc
[mbed] Updating library "mbed-os/net/atmel-rf-driver" to rev #473759f1a37c1863cb2adfcb2a87ac3f1da144ed
[mbed] Adding library "mbed-client-cli" from "https://github.com/ARMmbed/mbed-client-cli/" at rev #5128fb13ec1da0a2260c125f0bf1ba20a31037ff

But instead of going through all the dependencies, it could check what .lib's I have given as an argument and only download/update those with the result of this:

teetak01@machine:~/morpheus-dev/mbed-client-testapp (morpheus_support)$ mbed deploy mbed-client-cli.lib 
[mbed] Adding library "mbed-client-cli" from "https://github.com/ARMmbed/mbed-client-cli/" at rev #5128fb13ec1da0a2260c125f0bf1ba20a31037ff

So in this case I really only wanted to checkout the newer version of "mbed-client-cli". Of course I probably could also manually checkout the new version for the git-repo.

screamerbg commented 8 years ago

@teetak01 mbed CLI doesn't accept .lib files as a parameter. You can pass the URL from the .lib file to mbed add, e.g. run mbed add <url-with#rev-from.lib-file> Or in the case above. mbed add https://github.com/ARMmbed/mbed-client-cli/#5128fb13ec1da0a2260c125f0bf1ba20a31037ff

You can even script it as

$ mbed add `cat mbed-client-cli.lib`

Also from user experience perspective, what made you consider that mbed CLI supports .lib file as parameters to update and deploy? Is it something in the documentation or the tool help? Have you read the documentation?

teetak01 commented 8 years ago

@screamerbg you are right, I am really trying to use this as Yotta 2.0, mbed add and mbed remove are already doing exactly what I was asking about here.

I think I was a bit confused by the "Update options" section of README as I was expecting that "update" would have some functionality to update a dependency to newer version. Instead, I infact should use mbed remove the old one and the mbed add the new commit-version.

mbed new only discusses about programs, so I would presume this means the main root component e.g. program. mbed add only discusses about libraries, so these would be all the dependencies the program has. 'mbed update' then discusses both programs and libraries, and here I feel the discussion got a bit confusing. So is the update only for the main program ? I was trying to use it to update singular libraries ("Case 1: I want to update a program or a library ..") . Should this instead read "I want to update the program with its depending libraries to ...")

Of course, the whole program/the root of the code tree can of course be a library module, but for clarity, it might be easier to follow the Readme if the main component and its dependencies are always references unambiquously without risk of mixing the terminology.

screamerbg commented 8 years ago

@teetak01 Have a look at the latest PR #174 which adds more control over mbed new

Also note that if you're not changing the URL of a library you should:

  1. cd lib-directory
  2. mbed update [branch|tag|revision]

The update functionality is thoroughly described here https://github.com/ARMmbed/mbed-cli#updating-programs-and-libraries