]> git.ipfire.org Git - pakfire.git/commitdiff
Add personality support to build chroot.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Feb 2011 19:15:12 +0000 (20:15 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Feb 2011 19:15:12 +0000 (20:15 +0100)
pakfire/builder.py
pakfire/distro.py

index 86b0540aab2ff386d88f6c7c2b8b0ef7fab8ecdf..23efb12679f860e7b986f9dd0edae29acf704c80 100644 (file)
@@ -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
 
index 6dd34bd2a9791ebbdb7041f8a4287e627a5686c2..11f86f7f8190bf4f98e2873300d4f5ce857a969a 100644 (file)
@@ -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]
+