Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | When WORKDIR is included in some other git checkout, version.sh calls git rev-parse |
| 2 | and it returns some description from that upper git checkout even when rfkill is |
| 3 | being built from release tarball. |
| 4 | |
| 5 | When returned description doesn't match with expected v0.4, version.sh exits |
| 6 | without creating version.c |
| 7 | # on git builds check that the version number above |
| 8 | # is correct... |
| 9 | [ "${descr%%-*}" = "v$VERSION" ] || exit 2 |
| 10 | |
| 11 | and build fails a bit later: |
| 12 | | NOTE: make -j 32 -e MAKEFLAGS= |
| 13 | | CC rfkill.o |
| 14 | | GEN version.c |
| 15 | | make: *** [version.c] Error 2 |
| 16 | | make: *** Waiting for unfinished jobs.... |
| 17 | | ERROR: oe_runmake failed |
| 18 | |
| 19 | Don't try git rev-parse, if there isn't .git in ${S}. |
| 20 | |
| 21 | --- a/version.sh 2013-11-15 03:43:12.587744366 -0800 |
| 22 | +++ b/version.sh 2013-11-15 03:42:40.699743320 -0800 |
| 23 | @@ -12,7 +12,7 @@ |
| 24 | |
| 25 | if test "x$SUFFIX" != 'x'; then |
| 26 | v="$VERSION$SUFFIX" |
| 27 | -elif head=`git rev-parse --verify HEAD 2>/dev/null`; then |
| 28 | +elif test -d .git && head=`git rev-parse --verify HEAD 2>/dev/null`; then |
| 29 | git update-index --refresh --unmerged > /dev/null |
| 30 | descr=$(git describe 2>/dev/null || echo "v$VERSION") |
| 31 | |