diff options
-rw-r--r-- | meta/classes/sanity.bbclass | 31 | ||||
-rwxr-xr-x | scripts/bitbake | 42 |
2 files changed, 32 insertions, 41 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index 1c45b5baac..9a29f328f6 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass | |||
@@ -359,6 +359,28 @@ def check_gcc_march(sanity_data): | |||
359 | 359 | ||
360 | return result | 360 | return result |
361 | 361 | ||
362 | # Tar version 1.24 and onwards handle overwriting symlinks correctly | ||
363 | # but earlier versions do not; this needs to work properly for sstate | ||
364 | def check_tar_version(sanity_data, loosever): | ||
365 | status, result = oe.utils.getstatusoutput("tar --version") | ||
366 | if status != 0: | ||
367 | return "Unable to execute tar --version, exit code %s\n" % status | ||
368 | version = result.split()[3] | ||
369 | if loosever(version) < loosever("1.24"): | ||
370 | return "Your version of tar is older than 1.24 and has bugs which will break builds. Please install a newer version of tar.\n" | ||
371 | return None | ||
372 | |||
373 | # We use git parameters and functionality only found in 1.7.5 or later | ||
374 | def check_git_version(sanity_data, loosever): | ||
375 | status, result = oe.utils.getstatusoutput("git --version 2> /dev/null") | ||
376 | if status != 0: | ||
377 | return "Unable to execute git --version, exit code %s\n" % status | ||
378 | version = result.split()[2] | ||
379 | if loosever(version) < loosever("1.7.5"): | ||
380 | return "Your version of git is older than 1.7.5 and has bugs which will break builds. Please install a newer version of git.\n" | ||
381 | return None | ||
382 | |||
383 | |||
362 | def check_sanity(sanity_data): | 384 | def check_sanity(sanity_data): |
363 | import subprocess | 385 | import subprocess |
364 | 386 | ||
@@ -409,6 +431,15 @@ def check_sanity(sanity_data): | |||
409 | messages = messages + 'Please set a MACHINE in your local.conf or environment\n' | 431 | messages = messages + 'Please set a MACHINE in your local.conf or environment\n' |
410 | machinevalid = False | 432 | machinevalid = False |
411 | 433 | ||
434 | tarmsg = check_tar_version(sanity_data, LooseVersion) | ||
435 | if tarmsg: | ||
436 | messages = messages + tarmsg | ||
437 | |||
438 | gitmsg = check_git_version(sanity_data, LooseVersion) | ||
439 | if gitmsg: | ||
440 | messages = messages + gitmsg | ||
441 | |||
442 | |||
412 | # Check we are using a valid local.conf | 443 | # Check we are using a valid local.conf |
413 | current_conf = sanity_data.getVar('CONF_VERSION', True) | 444 | current_conf = sanity_data.getVar('CONF_VERSION', True) |
414 | conf_version = sanity_data.getVar('LOCALCONF_VERSION', True) | 445 | conf_version = sanity_data.getVar('LOCALCONF_VERSION', True) |
diff --git a/scripts/bitbake b/scripts/bitbake index 31a34b3f16..a8c67bb125 100755 --- a/scripts/bitbake +++ b/scripts/bitbake | |||
@@ -57,26 +57,6 @@ elif [ -z "$BUILDDIR" ] ; then | |||
57 | BUILDDIR="`pwd`" | 57 | BUILDDIR="`pwd`" |
58 | fi | 58 | fi |
59 | 59 | ||
60 | needtar="1" | ||
61 | needgit="1" | ||
62 | TARVERSION=`tar --version | head -n 1 | cut -d ' ' -f 4` | ||
63 | GITVERSION=`git --version 2> /dev/null | cut -d ' ' -f 3` | ||
64 | float_test() { | ||
65 | echo | awk 'END { exit ( !( '"$1"')); }' | ||
66 | } | ||
67 | version_compare() { | ||
68 | python -c "from distutils.version import LooseVersion; import sys; sys.exit(not (LooseVersion('$1') $2 LooseVersion('$3')))" | ||
69 | } | ||
70 | |||
71 | # Tar version 1.24 and onwards handle overwriting symlinks correctly | ||
72 | # but earlier versions do not; this needs to work properly for sstate | ||
73 | float_test "$TARVERSION > 1.23" && needtar="0" | ||
74 | |||
75 | if [ ! -z $GITVERSION ]; then | ||
76 | # Need git >= 1.7.5 for git-remote --mirror=xxx syntax | ||
77 | version_compare $GITVERSION ">=" 1.7.5 && needgit="0" | ||
78 | fi | ||
79 | |||
80 | buildpseudo="1" | 60 | buildpseudo="1" |
81 | if [ $needpseudo = "1" ]; then | 61 | if [ $needpseudo = "1" ]; then |
82 | if [ -e "$BUILDDIR/pseudodone" ]; then | 62 | if [ -e "$BUILDDIR/pseudodone" ]; then |
@@ -103,14 +83,6 @@ if [ $needpseudo = "1" ]; then | |||
103 | fi | 83 | fi |
104 | fi | 84 | fi |
105 | 85 | ||
106 | # If tar is already built, we don't want to do it again... | ||
107 | if [ -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then | ||
108 | needtar="0" | ||
109 | fi | ||
110 | # If git is already built, we don't want to do it again... | ||
111 | if [ -e "$PSEUDOBINDIR/git" -a "$needgit" = "1" ]; then | ||
112 | needgit="0" | ||
113 | fi | ||
114 | 86 | ||
115 | if [ $needpseudo = "0" ]; then | 87 | if [ $needpseudo = "0" ]; then |
116 | buildpseudo="0" | 88 | buildpseudo="0" |
@@ -133,14 +105,6 @@ if [ $buildpseudo -gt 0 ]; then | |||
133 | [ $buildpseudo -eq 2 ] && echo "Pseudo may be out of date, rebuilding pseudo before the main build" | 105 | [ $buildpseudo -eq 2 ] && echo "Pseudo may be out of date, rebuilding pseudo before the main build" |
134 | [ $buildpseudo -eq 3 ] && echo "Building pseudo-native before main build" | 106 | [ $buildpseudo -eq 3 ] && echo "Building pseudo-native before main build" |
135 | export PSEUDO_BUILD=1 | 107 | export PSEUDO_BUILD=1 |
136 | TARTARGET="tar-replacement-native" | ||
137 | if [ $needtar = "0" ]; then | ||
138 | TARTARGET="" | ||
139 | fi | ||
140 | GITTARGET="git-replacement-native" | ||
141 | if [ $needgit = "0" ]; then | ||
142 | GITTARGET="" | ||
143 | fi | ||
144 | 108 | ||
145 | # Pass through debug options | 109 | # Pass through debug options |
146 | additionalopts="" | 110 | additionalopts="" |
@@ -154,11 +118,7 @@ if [ $buildpseudo -gt 0 ]; then | |||
154 | done | 118 | done |
155 | done | 119 | done |
156 | 120 | ||
157 | if [ $needtar = "1" ]; then | 121 | bitbake pseudo-native $additionalopts -c populate_sysroot |
158 | bitbake $TARTARGET -c populate_sysroot | ||
159 | fi | ||
160 | |||
161 | bitbake pseudo-native $GITTARGET $additionalopts -c populate_sysroot | ||
162 | ret=$? | 122 | ret=$? |
163 | if [ "$ret" != "0" ]; then | 123 | if [ "$ret" != "0" ]; then |
164 | exit 1 | 124 | exit 1 |