change log for rtems-tools (2010-08-12)
rtems-vc at rtems.org
rtems-vc at rtems.org
Thu Aug 12 21:11:17 UTC 2010
*ccj*:
2010-08-13 Chris Johns <chrisj at 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.
M 1.3 ChangeLog
M 1.2 specbuilder/specbuilder/build.py
M 1.2 specbuilder/specbuilder/darwin.py
M 1.3 specbuilder/specbuilder/defaults.py
A 1.1 specbuilder/specbuilder/rtems.py
M 1.3 specbuilder/specbuilder/setup.py
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
@@ -1,3 +1,24 @@
+2010-08-13 Chris Johns <chrisj at 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.
+
2010-08-09 Chris Johns <chrisj at rtems.org>
* specbuilder/perl.prov, specbuilder/perl.req: New.
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
@@ -368,10 +368,11 @@
def make(self):
packages = self.spec.packages()
package = packages['main']
- _notice(self.opts, 'package: ' + package.name() + '-' + package.version())
+ name = package.name() + '-' + package.version()
+ _notice(self.opts, 'package: ' + name)
self.script.reset()
self.script.append(self.spec.expand('%{___build_template}'))
- self.script.append('echo "=> ' + package.name() + '-' + package.version() + ':"')
+ self.script.append('echo "=> ' + name + ':"')
self.prep(package)
self.build(package)
self.install(package)
@@ -383,6 +384,7 @@
sn = self.spec.expand(os.path.join('%{_builddir}', 'doit'))
self._output('write script: ' + sn)
self.script.write(sn)
+ _notice(self.opts, 'building: ' + name)
self.run(sn)
if not self.opts.no_clean():
self.cleanup()
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
@@ -29,8 +29,17 @@
import pprint
import os
+import execute
+
def load():
uname = os.uname()
+ 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 = ''
defines = {
'_os': 'darwin',
'_host': uname[4] + '-apple-darwin' + uname[2],
@@ -42,9 +51,7 @@
'_usr': '/opt/local',
'_var': '/opt/local/var',
'optflags': '-O2 -fasynchronous-unwind-tables',
- '_smp_mflags': '-j4',
- # Build readline with gdb.
- 'without_system_readline': 'without_system_readline'
+ '_smp_mflags': smp_mflags
}
return defines
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
@@ -158,7 +158,9 @@
'quiet' : '0',
'trace' : '0',
'dry-run' : '0',
- 'no-clean' : '0' }
+ 'no-clean' : '0',
+ 'no-smp' : '0',
+ 'rebuild' : '0' }
_long_opts = { '--prefix' : '_prefix',
'--prefixbase' : '_prefixbase',
@@ -169,11 +171,14 @@
'--usrlibrpm' : '_usrlibrpm',
'--tmppath' : '_tmppath',
'--log' : '_logfile',
- '--url' : '_url_base' }
+ '--url' : '_url_base',
+ '--rtems' : '_rtemssrc' }
_long_true_opts = { '--trace' : '_trace',
'--warn-all' : '_warn_all',
- '--no-clean' : '_no_clean' }
+ '--no-clean' : '_no_clean',
+ '--no-smp' : '_no_smp',
+ '--rebuild' : '_rebuild' }
_target_triplets = { '--host' : '_host',
'--build' : '_build',
@@ -205,21 +210,6 @@
return s
- 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
-
def _process(self):
def _process_lopt(opt, arg, long_opts, args, values = False):
@@ -311,7 +301,24 @@
i += 1
def _post_process(self, _defaults):
- pass
+ 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
def command(self):
return os.path.join(self.command_path, self.command_name)
@@ -331,6 +338,12 @@
def no_clean(self):
return self.opts['no-clean'] != '0'
+ def no_smp(self):
+ return self.opts['no-smp'] != '0'
+
+ def rebuild(self):
+ return self.opts['rebuild'] != '0'
+
def params(self):
return self.opts['params']
@@ -341,7 +354,7 @@
if len(specbase) == 0:
specbase = '*'
if len(specdir) == 0:
- specdir = self._expand(defaults['_specdir'], defaults)
+ specdir = self.expand(defaults['_specdir'], defaults)
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))
@@ -386,10 +399,14 @@
overrides = darwin.load()
for k in overrides:
d[k] = overrides[k]
+ import rtems
+ overrides = rtems.load()
+ for k in overrides:
+ d[k] = overrides[k]
o = command_line(args)
for k in o.defaults:
d[k] = o.defaults[k]
- o._post_process(d)
+ d = o._post_process(d)
return o, d
if __name__ == '__main__':
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
@@ -0,0 +1,43 @@
+#
+# $Id$
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2010 Chris Johns (chrisj at 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 = {
+ # 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())
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
@@ -64,6 +64,41 @@
if not self.opts.quiet():
log.output(text)
+ 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)
+
def mkdir(self, path):
if not self.opts.dry_run():
self._output('making dir: ' + path)
@@ -81,13 +116,24 @@
if oerr[0] != errno.EEXIST:
raise error.general('OS error: ' + str(oerr))
if d == 'RPMLIB':
- 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)
+ files = []
+ for file in ['perl.prov', 'perl.req']:
+ files.append(os.path.join(self.opts.command_path, 'specbuilder', file))
+ self._install_files(files, dst)
+ 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'))
+
def run():
import sys
try:
@@ -97,6 +143,7 @@
for path in opts.params():
s = setup(path, _defaults = _defaults, opts = opts)
s.make(path)
+ s.build_crossrpms(path)
del s
except error.general, gerr:
print gerr
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100812/dfeb83b7/attachment.html>
More information about the vc
mailing list