aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-05 13:03:19 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-05 13:03:19 +0200
commitf2467eb6a0070176a5b1cd76aa330b84431f8258 (patch)
tree10d2022765f81345d9e9ca5d18059ace6bff1c19 /src/libstore
parent3b859ead376cb0aa6c7b27774c2d82ed3ecb370a (diff)
On Linux, pretend we're building on Linux 2.6
Setting the UNAME26 personality causes "uname" to return "2.6.x", regardless of the kernel version. This improves determinism in a few misbehaved packages.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 467f16597..c13ea6d23 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1794,10 +1794,21 @@ void DerivationGoal::startBuilder()
throw SysError(format("changing into `%1%'") % tmpDir);
#ifdef CAN_DO_LINUX32_BUILDS
+ /* Change the personality to 32-bit if we're doing an
+ i686-linux build on an x86_64-linux machine. */
if (drv.platform == "i686-linux" && thisSystem == "x86_64-linux") {
if (personality(0x0008 | 0x8000000 /* == PER_LINUX32_3GB */) == -1)
throw SysError("cannot set i686-linux personality");
}
+
+ /* Impersonate a Linux 2.6 machine to get some determinism
+ in builds that depend on the kernel version. */
+ if ((drv.platform == "i686-linux" || drv.platform == "x86_64-linux") &&
+ queryBoolSetting("build-impersonate-linux-26", true))
+ {
+ int cur = personality(0xffffffff);
+ if (cur != -1) personality(cur | 0x0020000 /* == UNAME26 */);
+ }
#endif
/* Fill in the environment. */