From: Michael Tremer Date: Sun, 6 Feb 2011 19:15:12 +0000 (+0100) Subject: Add personality support to build chroot. X-Git-Tag: 0.9.3~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e360ea591bf907ac15d5fee1e34c159c7a3fc8a7;p=pakfire.git Add personality support to build chroot. --- diff --git a/pakfire/builder.py b/pakfire/builder.py index 86b0540aa..23efb1267 100644 --- a/pakfire/builder.py +++ b/pakfire/builder.py @@ -326,6 +326,10 @@ class Builder(object): if kwargs.has_key("env"): env.update(kwargs.pop("env")) + # Update personality it none was set + if not personality: + personality = self.pakfire.distro.personality + self._mountall() if not kwargs.has_key("chrootPath"): @@ -428,6 +432,10 @@ class Builder(object): for key, val in self.environ.items(): command = "%s=\"%s\" " % (key, val) + command + # Add personality if we require one + if self.pakfire.distro.personality: + command = "%s %s" % (self.pakfire.disto.personality, command) + # Empty the environment #command = "env -i - %s" % command diff --git a/pakfire/distro.py b/pakfire/distro.py index 6dd34bd2a..11f86f7f8 100644 --- a/pakfire/distro.py +++ b/pakfire/distro.py @@ -131,3 +131,24 @@ class Distribution(object): return info + @property + def personality(self): + """ + Return the personality of the target system. + + If host and target system are of the same architecture, we return + None to skip the setting of the personality in the build chroot. + """ + + if self.arch == self.host_arch: + return None + + arch2personality = { + "x86_64" : "linux64", + "i686" : "linux32", + "i586" : "linux32", + "i486" : "linux32", + } + + return arch2personality[self.arch] +