<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems-tools (2010-08-12)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>ccj</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-08-13      Chris Johns <chrisj@rtems.org>

        * specbuilder/specbuilder/rtems.py: New. Move RTEMS specific
        settings into the RTEMS specific file from the host specific file.

        * specbuilder/specbuilder/darwin.py: Move the RTEMS specific
        values out. Automatically determine the number of CPUs and let
        make use them all.

        * specbuilder/specbuilder/defaults.py: Add --no-smp and --rebuild
        to the options. Post process --no-smp to set the SMP make flags to
        nil. Add support for RTEMS specific overrides.

        * specbuilder/specbuilder/build.py: Add a notice that building has
        started. If a download happens you do not know when it has
        finished.

        * specbuilder/specbuilder/setup.py: Add --rtems to point to the
        RTEMS source and copy the spec and diff files. Also allow the user
        to --rebuild them.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-tools/ChangeLog.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-tools/specbuilder/specbuilder/build.py.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>specbuilder/specbuilder/build.py</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-tools/specbuilder/specbuilder/darwin.py.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>specbuilder/specbuilder/darwin.py</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-tools/specbuilder/specbuilder/defaults.py.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>specbuilder/specbuilder/defaults.py</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-tools/specbuilder/specbuilder/rtems.py?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">specbuilder/specbuilder/rtems.py</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-tools/specbuilder/specbuilder/setup.py.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>specbuilder/specbuilder/setup.py</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems-tools/ChangeLog:1.2 rtems-tools/ChangeLog:1.3
--- rtems-tools/ChangeLog:1.2   Sun Aug  8 23:50:30 2010
+++ rtems-tools/ChangeLog       Thu Aug 12 16:09:55 2010
</font><font color='#997700'>@@ -1,3 +1,24 @@
</font><font color='#000088'>+2010-08-13    Chris Johns <chrisj@rtems.org>
+
+       * specbuilder/specbuilder/rtems.py: New. Move RTEMS specific
+       settings into the RTEMS specific file from the host specific file.
+
+       * specbuilder/specbuilder/darwin.py: Move the RTEMS specific
+       values out. Automatically determine the number of CPUs and let
+       make use them all.
+
+       * specbuilder/specbuilder/defaults.py: Add --no-smp and --rebuild
+       to the options. Post process --no-smp to set the SMP make flags to
+       nil. Add support for RTEMS specific overrides.
+
+       * specbuilder/specbuilder/build.py: Add a notice that building has
+       started. If a download happens you do not know when it has
+       finished.
+
+       * specbuilder/specbuilder/setup.py: Add --rtems to point to the
+       RTEMS source and copy the spec and diff files. Also allow the user
+       to --rebuild them.
+
</font> 2010-08-09        Chris Johns <chrisj@rtems.org>
 
        * specbuilder/perl.prov, specbuilder/perl.req: New.

<font color='#006600'>diff -u rtems-tools/specbuilder/specbuilder/build.py:1.1 rtems-tools/specbuilder/specbuilder/build.py:1.2
--- rtems-tools/specbuilder/specbuilder/build.py:1.1    Sun Aug  8 20:29:43 2010
+++ rtems-tools/specbuilder/specbuilder/build.py        Thu Aug 12 16:09:55 2010
</font><font color='#997700'>@@ -368,10 +368,11 @@
</font>     def make(self):
         packages = self.spec.packages()
         package = packages['main']
<font color='#880000'>-        _notice(self.opts, 'package: ' + package.name() + '-' + package.version())
</font><font color='#000088'>+        name = package.name() + '-' + package.version()
+        _notice(self.opts, 'package: ' + name)
</font>         self.script.reset()
         self.script.append(self.spec.expand('%{___build_template}'))
<font color='#880000'>-        self.script.append('echo "=> ' + package.name() + '-' + package.version() + ':"')
</font><font color='#000088'>+        self.script.append('echo "=> ' + name + ':"')
</font>         self.prep(package)
         self.build(package)
         self.install(package)
<font color='#997700'>@@ -383,6 +384,7 @@
</font>             sn = self.spec.expand(os.path.join('%{_builddir}', 'doit'))
             self._output('write script: ' + sn)
             self.script.write(sn)
<font color='#000088'>+            _notice(self.opts, 'building: ' + name)
</font>             self.run(sn)
         if not self.opts.no_clean():
             self.cleanup()

<font color='#006600'>diff -u rtems-tools/specbuilder/specbuilder/darwin.py:1.1 rtems-tools/specbuilder/specbuilder/darwin.py:1.2
--- rtems-tools/specbuilder/specbuilder/darwin.py:1.1   Sun Aug  8 20:29:43 2010
+++ rtems-tools/specbuilder/specbuilder/darwin.py       Thu Aug 12 16:09:55 2010
</font><font color='#997700'>@@ -29,8 +29,17 @@
</font> import pprint
 import os
 
<font color='#000088'>+import execute
+
</font> def load():
     uname = os.uname()
<font color='#000088'>+    sysctl = '/usr/sbin/sysctl '
+    e = execute.capture_execution()
+    exit_code, proc, output = e.shell(sysctl + 'hw.ncpu')
+    if exit_code == 0:
+        smp_mflags = '-j' + output.split(' ')[1].strip()
+    else:
+        smp_mflags = ''
</font>     defines = {<span style="background-color: #FF0000"> </span>
         '_os':                     'darwin',
         '_host':                   uname[4] + '-apple-darwin' + uname[2],
<font color='#997700'>@@ -42,9 +51,7 @@
</font>         '_usr':                    '/opt/local',
         '_var':                    '/opt/local/var',
         'optflags':                '-O2 -fasynchronous-unwind-tables',
<font color='#880000'>-        '_smp_mflags':             '-j4',
-        # Build readline with gdb.
-        'without_system_readline': 'without_system_readline'
</font><font color='#000088'>+        '_smp_mflags':             smp_mflags
</font>         }
     return defines
 

<font color='#006600'>diff -u rtems-tools/specbuilder/specbuilder/defaults.py:1.2 rtems-tools/specbuilder/specbuilder/defaults.py:1.3
--- rtems-tools/specbuilder/specbuilder/defaults.py:1.2 Sun Aug  8 23:50:30 2010
+++ rtems-tools/specbuilder/specbuilder/defaults.py     Thu Aug 12 16:09:55 2010
</font><font color='#997700'>@@ -158,7 +158,9 @@
</font>                   'quiet'    : '0',
                   'trace'    : '0',
                   'dry-run'  : '0',
<font color='#880000'>-                  'no-clean' : '0' }
</font><font color='#000088'>+                  'no-clean' : '0',
+                  'no-smp'   : '0',
+                  'rebuild'  : '0' }
</font> 
     _long_opts = { '--prefix'     : '_prefix',
                    '--prefixbase' : '_prefixbase',
<font color='#997700'>@@ -169,11 +171,14 @@
</font>                    '--usrlibrpm'  : '_usrlibrpm',
                    '--tmppath'    : '_tmppath',
                    '--log'        : '_logfile',
<font color='#880000'>-                   '--url'        : '_url_base' }
</font><font color='#000088'>+                   '--url'        : '_url_base',
+                   '--rtems'      : '_rtemssrc' }
</font> 
     _long_true_opts = { '--trace'    : '_trace',
                         '--warn-all' : '_warn_all',
<font color='#880000'>-                        '--no-clean' : '_no_clean' }
</font><font color='#000088'>+                        '--no-clean' : '_no_clean',
+                        '--no-smp'   : '_no_smp',
+                        '--rebuild'  : '_rebuild' }
</font> 
     _target_triplets = { '--host'   : '_host',
                          '--build'  : '_build',
<font color='#997700'>@@ -205,21 +210,6 @@
</font> 
         return s
 
<font color='#880000'>-    def _expand(self, s, _defaults):
-        """Simple basic expander of spec file macros."""
-        mf = re.compile(r'%{[^}]+}')
-        expanded = True
-        while expanded:
-            expanded = False
-            for m in mf.findall(s):
-                name = m[2:-1]
-                if name in _defaults:
-                    s = s.replace(m, _defaults[name])
-                    expanded = True
-                else:
-                    raise error.general('cannot process default macro: ' + m)
-        return s
-
</font>     def _process(self):
 
         def _process_lopt(opt, arg, long_opts, args, values = False):
<font color='#997700'>@@ -311,7 +301,24 @@
</font>             i += 1
 
     def _post_process(self, _defaults):
<font color='#880000'>-        pass
</font><font color='#000088'>+        if self.no_smp():
+            _defaults['_smp_mflags'] = _defaults['nil']
+        return _defaults
+
+    def expand(self, s, _defaults):
+        """Simple basic expander of spec file macros."""
+        mf = re.compile(r'%{[^}]+}')
+        expanded = True
+        while expanded:
+            expanded = False
+            for m in mf.findall(s):
+                name = m[2:-1]
+                if name in _defaults:
+                    s = s.replace(m, _defaults[name])
+                    expanded = True
+                else:
+                    raise error.general('cannot process default macro: ' + m)
+        return s
</font> 
     def command(self):
         return os.path.join(self.command_path, self.command_name)
<font color='#997700'>@@ -331,6 +338,12 @@
</font>     def no_clean(self):
         return self.opts['no-clean'] != '0'
 
<font color='#000088'>+    def no_smp(self):
+        return self.opts['no-smp'] != '0'
+
+    def rebuild(self):
+        return self.opts['rebuild'] != '0'
+
</font>     def params(self):
         return self.opts['params']
 
<font color='#997700'>@@ -341,7 +354,7 @@
</font>             if len(specbase) == 0:
                 specbase = '*'
             if len(specdir) == 0:
<font color='#880000'>-                specdir = self._expand(defaults['_specdir'], defaults)
</font><font color='#000088'>+                specdir = self.expand(defaults['_specdir'], defaults)
</font>             if not os.path.isdir(specdir):
                 raise error.general('specdir is not a directory or does not exist: ' + specdir)
             files = glob.glob(os.path.join(specdir, specbase))
<font color='#997700'>@@ -386,10 +399,14 @@
</font>         overrides = darwin.load()
     for k in overrides:
         d[k] = overrides[k]
<font color='#000088'>+    import rtems
+    overrides = rtems.load()
+    for k in overrides:
+        d[k] = overrides[k]
</font>     o = command_line(args)
     for k in o.defaults:
         d[k] = o.defaults[k]
<font color='#880000'>-    o._post_process(d)
</font><font color='#000088'>+    d = o._post_process(d)
</font>     return o, d
 
 if __name__ == '__main__':

<font color='#006600'>diff -u /dev/null rtems-tools/specbuilder/specbuilder/rtems.py:1.1
--- /dev/null   Thu Aug 12 16:11:17 2010
+++ rtems-tools/specbuilder/specbuilder/rtems.py        Thu Aug 12 16:09:55 2010
</font><font color='#997700'>@@ -0,0 +1,43 @@
</font><font color='#000088'>+#
+# $Id$
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2010 Chris Johns (chrisj@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# RTEMS Tools is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# RTEMS Tools is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with RTEMS Tools.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+#
+# Any RTEMS specific overrides to make things work.
+#
+
+import pprint
+
+def load():
+    defines = {<span style="background-color: #FF0000"> </span>
+        # Build readline with gdb.
+        'without_system_readline': 'without_system_readline',
+        # Work around a spec file issue.
+        'mpc_provided':            '0',
+        'mpfr_provided':           '0',
+        'gmp_provided':            '0',
+        'libelf_provided':         '0',
+        }
+    return defines
+
+if __name__ == '__main__':
+    pprint.pprint(load())
</font>
<font color='#006600'>diff -u rtems-tools/specbuilder/specbuilder/setup.py:1.2 rtems-tools/specbuilder/specbuilder/setup.py:1.3
--- rtems-tools/specbuilder/specbuilder/setup.py:1.2    Sun Aug  8 23:50:30 2010
+++ rtems-tools/specbuilder/specbuilder/setup.py        Thu Aug 12 16:09:55 2010
</font><font color='#997700'>@@ -64,6 +64,41 @@
</font>         if not self.opts.quiet():
             log.output(text)
 
<font color='#000088'>+    def _install_files(self, files, dst):
+        for src in files:
+            try:
+                name = os.path.basename(src)
+                self._output('installing: ' + name)
+                shutil.copy(src, os.path.join(dst, name))
+            except IOError, ioerr:
+                raise error.general('copy failed: ' + src + ': ' + str(ioerr))
+            except OSError, oerr:
+                 raise error.general('copy failed: ' + src + ': ' + str(oerr))
+
+    def _get_file_list(self, top, path, ext):
+        filelist = []
+        for root, dirs, files in os.walk(top):
+            if root[len(top) + 1:].startswith(path):
+                for f in files:
+                    n, e = os.path.splitext(f)
+                    if e[1:] == ext:
+                        filelist.append(os.path.join(root, f))
+        return filelist
+
+    def get_specs(self, path):
+        return self._get_file_list(path, 'rtems', 'spec')
+
+    def get_patches(self, path):
+        return self._get_file_list(path, 'patches', 'diff')
+
+    def run(self, command, shell_opts = '', cwd = None):
+        e = execute.capture_execution(log = log.default, dump = self.opts.quiet())
+        cmd = self.opts.expand('%{___build_shell} -ex ' + shell_opts + ' ' + command, self.defaults)
+        self._output('run: ' + cmd)
+        exit_code, proc, output = e.shell(cmd, cwd = cwd)
+        if exit_code != 0:
+            raise error.general('shell cmd failed: ' + cmd)
+
</font>     def mkdir(self, path):
         if not self.opts.dry_run():
             self._output('making dir: ' + path)
<font color='#997700'>@@ -81,13 +116,24 @@
</font>                 if oerr[0] != errno.EEXIST:
                     raise error.general('OS error: ' + str(oerr))
             if d == 'RPMLIB':
<font color='#880000'>-                for n in ['perl.prov', 'perl.req']:
-                    sf = os.path.join(self.opts.command_path, 'specbuilder', n)
-                    df = os.path.join(dst, n)
-                    self._output('installing: ' + df)
-                    if os.path.isfile(sf):
-                        shutil.copy(sf, df)
</font><font color='#000088'>+                files = []
+                for file in ['perl.prov', 'perl.req']:
+                    files.append(os.path.join(self.opts.command_path, 'specbuilder', file))
+                self._install_files(files, dst)
</font> 
<font color='#000088'>+    def build_crossrpms(self, path):
+        if 'rtems' in self.opts.opts:
+            rtemssrc = os.path.abspath(os.path.expanduser(self.opts.opts['rtems']))
+            crossrpms = os.path.join(rtemssrc, 'contrib', 'crossrpms')
+            if not os.path.isdir(crossrpms):
+                raise error.general('no crossrpms directory found under: ' + crossrpms)
+            if 'rebuild' in self.opts.opts:
+                self.run('../../bootstrap -c', '-c', crossrpms)
+                self.run('../../bootstrap', '-c', crossrpms)
+                self.run('./configure', '-c', crossrpms)
+            self._install_files(self.get_specs(crossrpms), os.path.join(path, 'SPECS'))
+            self._install_files(self.get_patches(crossrpms), os.path.join(path, 'SOURCES'))
+<span style="background-color: #FF0000"> </span>
</font> def run():
     import sys
     try:
<font color='#997700'>@@ -97,6 +143,7 @@
</font>         for path in opts.params():
             s = setup(path, _defaults = _defaults, opts = opts)
             s.make(path)
<font color='#000088'>+            s.build_crossrpms(path)
</font>             del s
     except error.general, gerr:
         print gerr
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>