changeset 5485:e506118f65a8

tools:: lift LD_PRELOAD restrictions. Fixes confusion. Makes no sense for tools. Be it /usr/bin/gcc or tools::gcc, it needs to read /usr/include/stdlib.h etc. How to, or why restrict reading other files from /? See LIBRESTRICT_IGNORE below, it would need to include every binary in tools_prefix :-)
author Jan Nieuwenhuizen <janneke@gnu.org>
date Thu, 20 Aug 2009 14:40:55 +0200
parents 430898c7fda2
children 605bbd0de9e3
files gub/build.py gub/cross.py gub/settings.py gub/specs/librestrict.py gub/specs/libtool.py gub/tools.py
diffstat 6 files changed, 36 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/gub/build.py	Thu Aug 20 14:46:44 2009 +0200
+++ b/gub/build.py	Thu Aug 20 14:40:55 2009 +0200
@@ -304,7 +304,7 @@
 
     @context.subst_method
     def configure_command (self):
-        return '%(configure_binary)s --prefix=%(install_prefix)s'
+        return ' sh %(configure_binary)s --prefix=%(install_prefix)s'
 
     @context.subst_method
     def compile_command (self):
@@ -650,6 +650,11 @@
         # FIXME: ugly workaround needed for lilypond package...
         return '%(version)s'
 
+    def disable_libtool_la_files (self, pattern):
+        def disable_la (logger, file_name):
+            loggedos.move (file_name, file_name + '-')
+        self.map_find_files (disable_la, '%(install_prefix)s/lib[.]la', pattern)
+
     # Used in mingw python and liblpsolve.  Better replace this by
     # fixing the gcc linking command?
     def generate_dll_a_and_la (self, libname, depend=''):
--- a/gub/cross.py	Thu Aug 20 14:46:44 2009 +0200
+++ b/gub/cross.py	Thu Aug 20 14:40:55 2009 +0200
@@ -22,7 +22,6 @@
             + misc.append_path (os.environ.get ('CPLUS_INCLUDE_PATH', '')),
             'LIBRARY_PATH': '%(tools_prefix)s/lib'
             + misc.append_path (os.environ.get ('LIBRARY_PATH', '')),
-            'LIBRESTRICT_IGNORE': '%(tools_prefix)s/bin/make',
             'PATH': '%(cross_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'],
         }
         dict.update (env)
@@ -63,16 +62,20 @@
 # GNU tar --strip-component
 # /usr/bin/install: coreutils
 # SVN
-bootstrap_names = ['system::gcc', 'tools::librestrict', 'tools::make']
+bootstrap_names = [
+    'system::gcc',
+    'tools::librestrict',
+#    'tools::binutils',
+#    'tools::gcc',
+    'tools::make',
+    ]
+if 'stat' in misc.librestrict ():
+    bootstrap_names += ['tools::coreutils', 'tools::bash', 'tools::gawk',
+                        'tools::grep', 'tools::sed']
+if 'BOOTSTRAP' in os.environ.keys ():
+    bootstrap_names += ['tools::gub-utils']
+
 def set_cross_dependencies (package_object_dict):
-    global bootstrap_names
-    if 'stat' in misc.librestrict ():
-        bootstrap_names += ['tools::coreutils', 'tools::dash', 'tools::gawk',
-                            'tools::grep', 'tools::sed']
-
-    if 'BOOTSTRAP' in os.environ.keys ():
-        bootstrap_names += ['tools::gub-utils']
-
     packs = list (package_object_dict.values ())
 
     cross_packs = [p for p in packs if isinstance (p, AutoBuild)]
--- a/gub/settings.py	Thu Aug 20 14:46:44 2009 +0200
+++ b/gub/settings.py	Thu Aug 20 14:40:55 2009 +0200
@@ -251,6 +251,10 @@
         ## make sure we don't confuse build or target system.
         self.LD_LIBRARY_PATH = '%(system_root)s'
 
+        # Without physical, bash [X]STATs /every/single/dir when doing
+        # cd /x/y/z.  This terribly breaks stat restriction.
+        os.environ['SHELLOPTS'] = 'nohistory:physical'
+
     def create_dirs (self): 
         for a in (
             'allsrcdir',
--- a/gub/specs/librestrict.py	Thu Aug 20 14:46:44 2009 +0200
+++ b/gub/specs/librestrict.py	Thu Aug 20 14:40:55 2009 +0200
@@ -10,7 +10,10 @@
     def BARFS_WITH_2_5_1_name (self):
         return 'librestrict-' + '-'.join (self.librestrict_flavours ())
     def _get_build_dependencies (self):
-        return ['system::gcc']
+        return [
+#            'tools::gcc'
+            'system::gcc'
+            ]
     def get_conflict_dict (self):
         # Ugly hack: if the user is not explicitly tightening the
         # restrictions using LIBRESTRICT=open:stat, uninstall dash and
--- a/gub/specs/libtool.py	Thu Aug 20 14:46:44 2009 +0200
+++ b/gub/specs/libtool.py	Thu Aug 20 14:40:55 2009 +0200
@@ -58,7 +58,7 @@
         # and adds bash to libtools' #! 
         SHELL = ''
         if 'stat' in misc.librestrict ():
-            SHELL = 'CONFIG_SHELL=%(tools_prefix)s/bin/dash '
+            SHELL = 'CONFIG_SHELL=%(tools_prefix)s/bin/sh '
         return (SHELL
                 + target.AutoBuild.configure_command (self)
                 .replace ('SHELL=', 'CONFIG_SHELL='))
@@ -90,17 +90,6 @@
     def __init__ (self, settings, source):
         tools.AutoBuild.__init__ (self, settings, source)
         Libtool.set_sover (self)
-        # Uncommenting removes IGNORE lifting from make and breaks build.
-        # build.add_dict (self, {'LIBRESTRICT_IGNORE': ''})
-        '''
-        /home/janneke/tmp/gub/target/tools/root/usr/bin/make: tried to xstat () file /usr/include/stdio.h
-allowed:
-  /home/janneke/tmp/gub/target
-  /usr/lib/gcc
-  /tmp
-  /dev/null
-/bin/bash: line 22: 25332 Aborted                 (core dumped) make "$target-am"
-'''
     def update_libtool (self):
         pass
     def install (self):
--- a/gub/tools.py	Thu Aug 20 14:46:44 2009 +0200
+++ b/gub/tools.py	Thu Aug 20 14:40:55 2009 +0200
@@ -68,6 +68,13 @@
         if 'BOOTSTRAP' in os.environ.keys ():
             return '%(prefix_dir)s'
         return '%(system_prefix)s'
+    def LD_PRELOAD (self):
+        # Makes no sense for tools.  Be it /usr/bin/gcc or tools::gcc,
+        # it needs to read /usr/include/stdlib.h etc.  How to, or why
+        # restrict reading other files from /?
+        # See LIBRESTRICT_IGNORE below, it would need to include every
+        # binary in system_prefix :-)
+        return ''
     # FIXME: promoteme to build.py?  Most Fragile operation...
     def configure_flags (self):
         config_cache = ''
@@ -171,8 +178,8 @@
             'CPLUS_INCLUDE_PATH': '%(system_prefix)s/include'
             + misc.append_path (os.environ.get ('CPLUS_INCLUDE_PATH', '')),
             'LIBRARY_PATH': '%(system_prefix)s/lib'
+#            'LIBRESTRICT_IGNORE': '%(system_prefix)s/bin/make:%(system_prefix)s/gcc:%(system_prefix)s/g++:%(system_prefix)s/ld', #etc.
             + misc.append_path (os.environ.get ('LIBRARY_PATH', '')),
-            'LIBRESTRICT_IGNORE': '%(system_prefix)s/bin/make',
             'PATH': '%(system_prefix)s/bin:%(system_cross_prefix)s/bin:' + os.environ['PATH'],
             'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0'
             + ':%(tools_prefix)s/share/autoconf'