ARMmbed / ARMmbed/mbed-cli

mbed deploy cannot handle changing URI for .lib-files

Open
#1,000 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
339
Forks
187
PR merge metrics
No merged PRs in 30d

Description

See demonstrator and reproduction steps in [mbed-cli-mbed-deploy-issue](https://github.com/JanneKiiskila/mbed-cli-mbed-deploy-issue).

A simple repo to demostrate bug in `mbed deploy`. It does not handle correctly an update in the .lib -URI path change, i.e. if you switch to a different fork of the repo for example.

## Reproduction steps

Install the normal cli tooling following the official Mbed OS documentation.
Personally, I highly recommend using a Python virtualenv for this.

Check installation.

```
mbed --version
1.10.5

```

Start by `mbed import` with this repo.

```
mbed import git@github.com:JanneKiiskila/mbed-cli-mbed-deploy-issue.git
cd mbed-cli-mbed-deploy-issue/
```
This will also do the mbed deploy automatically.

Now, check into the branch `fork`. This would pick up a [different URI for the wifi-ism43362 repo](https://github.com/JanneKiiskila/mbed-cli-mbed-deploy-issue/commit/f0e9c16fd9e0f84ea0e3c5b50eef164e607e53db).

```
git checkout fork
mbed deploy
```

The deploy will fail.

```
~/mbed/mbed-cli-mbed-deploy-issue$ mbed deploy
[mbed] Working path "/home/jannek/mbed/mbed-cli-mbed-deploy-issue" (library)
[mbed] Program path "/home/jannek/mbed/mbed-cli-mbed-deploy-issue"
[mbed] Updating library "wifi-ism43362" to rev #6e2e009be907
fatal: reference is not a tree: 6e2e009be907215bd2fa41df7ca1a18e10ab6b0a
[mbed] ERROR: Unable to update "wifi-ism43362" to rev #6e2e009be907
---
```

This is due to the fact, that the wifi-ism43362 git remote is still pointing to the
original one, which of course does not have the same hashes as the fork.

```
~/mbed/mbed-cli-mbed-deploy-issue/cd wifi-ism43362
~/mbed/mbed-cli-mbed-deploy-issue/wifi-ism43362$ git remote -v
origin https://github.com/ARMmbed/wifi-ism43362 (fetch)
origin https://github.com/ARMmbed/wifi-ism43362 (push)
```

## Workaround

You are required to manually delete the deployed repo/folder and then doing `mbed deploy` again.

```
rm -rf wifi-ism43362
mbed deploy
```

This will work, as it will start with a clean `git clone` operation with the correct repo URI.

However, this is a fully manual process. The tool could alternatively also notice the URI change and just add a different remote (or change the remote).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.