[riot-notifications] [RIOT-OS/RIOT] pkg/pkg.mk: make sure we are building the correct commit. (#11129)

Juan I Carrano notifications at github.com
Thu Mar 7 15:30:26 CET 2019


### Contribution description

This solves an issue I ran into while trying to figure out what was happening with edbg. I had two git worktrees and I had two different reset behaviours even though the PKG_VERSION of edbg was the same in both trees. Upon closer inspection I discovered that in one tree PKG_VERSION and the actual HEAD commit of edbg did not match.

Once the repo is downloaded, the version is not checked gain. This means that even if a package's Makefile is touched, that will only cause a rebuild of the previously downloaded version. For packages
that are normally not deleted, like edbg, this renders PKG_VERSION bumps ineffective, unless the user manually deletes the repo directory.

This patch fixes that by always checking that the repo is at the right commit.

### Testing procedure

I included a throwaway commit to make testing easier.

After checking out this, the first step is to go backwards to the commits before this PR, clean edbg, and download it and build it again:
```sh
# go before my first commit
$ git checkout 6ff1a57^
$ rm -rf dist/tools/edbg/edbg dist/tools/edbg/bin
$ make -C examples/hello-world $(pwd)/dist/tools/edbg/edbg
$ grep VERSION dist/tools/edbg/Makefile && git -C dist/tools/edbg/bin rev-parse HEAD
PKG_VERSION=807d948cc8a664ade3e9446b4937aa54268afcb2
807d948cc8a664ade3e9446b4937aa54268afcb2
```

Now let's try to bump the version:

```sh
$ git checkout 6ff1a57
$ make -C examples/hello-world $(pwd)/dist/tools/edbg/edbg
$ grep VERSION dist/tools/edbg/Makefile && git -C dist/tools/edbg/bin rev-parse HEAD
PKG_VERSION=ba864ebc46e985cb400ccdd63cdafaccbc3698c0
807d948cc8a664ade3e9446b4937aa54268afcb2
```

D'oh! that's not what we want. Now with the fix:
```sh
$ git checkout a0c709f
$ touch dist/tools/edbg/Makefile
$ make -C examples/hello-world $(pwd)/dist/tools/edbg/edbg
$ grep VERSION dist/tools/edbg/Makefile && git -C dist/tools/edbg/bin rev-parse HEAD
PKG_VERSION=ba864ebc46e985cb400ccdd63cdafaccbc3698c0
ba864ebc46e985cb400ccdd63cdafaccbc3698c0
```

### Issues/PRs references

Found when investigating #11125 .

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11129

-- Commit Summary --

  * DELETEME! update edbg version (testing only)
  * pkg/pkg.mk: make sure we are building the correct commit.

-- File Changes --

    M dist/tools/edbg/Makefile (2)
    M pkg/pkg.mk (14)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11129.patch
https://github.com/RIOT-OS/RIOT/pull/11129.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11129
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/3d226b4d/attachment-0001.html>


More information about the notifications mailing list