support 'fakeroot' attribute for functions
authorMichael 'Mickey' Lauer <mickey@vanille-media.de>
Sun, 28 Mar 2004 22:16:48 +0000 (22:16 +0000)
committerMichael 'Mickey' Lauer <mickey@vanille-media.de>
Sun, 28 Mar 2004 22:16:48 +0000 (22:16 +0000)
bin/oe/build.py
bin/oe/data.py
bin/oe/parse/OEHandler.py

index 39b924b..dbf27c5 100644 (file)
@@ -187,7 +187,11 @@ def exec_func_shell(func, d):
 
        # execute function
        prevdir = os.getcwd()
-       ret = os.system('sh -e %s' % runfile)
+       if data.getVarFlag(func, "fakeroot", d):
+               maybe_fakeroot = 'fakeroot '
+       else:
+               maybe_fakeroot = ''
+       ret = os.system('%ssh -e %s' % (maybe_fakeroot, runfile))
        os.chdir(prevdir)
 
        # restore the backups
index 5dc0060..48ec439 100644 (file)
@@ -267,11 +267,14 @@ import os
 
 def inheritFromOS(d = _data):
        """Inherit variables from the environment."""
+       # fakeroot needs to be able to set these
+       non_inherit_vars = [ "LD_LIBRARY_PATH", "LD_PRELOAD" ]
        for s in os.environ.keys():
-               try:
-                       setVar(s, os.environ[s], d)
-               except TypeError:
-                       pass
+               if not s in non_inherit_vars:
+                       try:
+                               setVar(s, os.environ[s], d)
+                       except TypeError:
+                               pass
 
 import sys, string
 
index e824781..fcaabbd 100644 (file)
@@ -9,7 +9,7 @@ from oe import debug, data, fetch, fatal
 
 from oe.parse.ConfHandler import include, localpath, obtain, init
 
-__func_start_regexp__    = re.compile( r"((?P<py>python)\s*)*(?P<func>\w+)\s*\(\s*\)\s*{$" )
+__func_start_regexp__    = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>\w+)\s*\(\s*\)\s*{$" )
 __inherit_regexp__       = re.compile( r"inherit\s+(.+)" )
 __export_func_regexp__   = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" )
 __addtask_regexp__       = re.compile("addtask\s+(?P<func>\w+)\s*((before\s*(?P<before>((.*(?=after))|(.*))))|(after\s*(?P<after>((.*(?=before))|(.*)))))*")
@@ -150,10 +150,15 @@ def feeder(lineno, s, fn, d):
                        # clean up old version of this piece of metadata, as its
                        # flags could cause problems
                        data.setVarFlag(key, 'python', None, d)
+                       data.setVarFlag(key, 'fakeroot', None, d)
                if m.group("py") is not None:
                        data.setVarFlag(key, "python", "1", d)
                else:
                        data.setVarFlag(key, "python", None, d)
+               if m.group("fr") is not None:
+                       data.setVarFlag(key, "fakeroot", "1", d)
+               else:
+                       data.setVarFlag(key, "fakeroot", None, d)
                return
 
        m = __export_func_regexp__.match(s)