change log for rtems-tools (2011-02-21)

rtems-vc at rtems.org rtems-vc at rtems.org
Tue Feb 22 04:10:31 UTC 2011


 *ccj*:
2011-02-22      Chris Johns <chrisj at rtems.org>

        * specbuilder/sb-versions, specbuilder/specbuilder/version.py:
        New. Print a suitable version message for automatic documentation
        updating from the spec files in CVS.

        * specbuilder/specbuilder/build.py: Add xz support. Add a function
        to return the name of a package.

        * specbuilder/specbuilder/crossgcc.py: Use the build name in the
        tmp path.

        * specbuilder/specbuilder/darwin.py: Add xz support.

        * specbuilder/specbuilder/defaults.py: Add xz support. Add Windows
        and Linux support.

        * specbuilder/specbuilder/setup.py: Reference the correct shell
        opts. Use the shell setup in the version probe command. Fix the
        version check. Add autotools to the list of spec files to
        install.

        * specbuilder/specbuilder/spec.py: Add changelog and configure
        tests. Manage sub-packages better.

        * specbuilder/specbuilder/version.py,
        specbuilder/specbuilder/windows.py: New.

M    1.8  ChangeLog
A    1.1  specbuilder/sb-versions
M    1.3  specbuilder/specbuilder/build.py
M    1.2  specbuilder/specbuilder/crossgcc.py
M    1.3  specbuilder/specbuilder/darwin.py
M    1.7  specbuilder/specbuilder/defaults.py
M    1.6  specbuilder/specbuilder/setup.py
M    1.3  specbuilder/specbuilder/spec.py
A    1.1  specbuilder/specbuilder/version.py
A    1.1  specbuilder/specbuilder/windows.py

diff -u rtems-tools/ChangeLog:1.7 rtems-tools/ChangeLog:1.8
--- rtems-tools/ChangeLog:1.7	Mon Aug 30 19:58:45 2010
+++ rtems-tools/ChangeLog	Mon Feb 21 21:46:44 2011
@@ -1,3 +1,31 @@
+2011-02-22	Chris Johns <chrisj at rtems.org>
+
+	* specbuilder/sb-versions, specbuilder/specbuilder/version.py:
+	New. Print a suitable version message for automatic documentation
+	updating from the spec files in CVS.
+
+	* specbuilder/specbuilder/build.py: Add xz support. Add a function
+	to return the name of a package.
+	
+	* specbuilder/specbuilder/crossgcc.py: Use the build name in the
+	tmp path.
+	
+	* specbuilder/specbuilder/darwin.py: Add xz support.
+	
+	* specbuilder/specbuilder/defaults.py: Add xz support. Add Windows
+	and Linux support.
+	
+	* specbuilder/specbuilder/setup.py: Reference the correct shell
+	opts. Use the shell setup in the version probe command. Fix the
+	version check. Add autotools to the list of spec files to
+	install.
+	
+	* specbuilder/specbuilder/spec.py: Add changelog and configure
+	tests. Manage sub-packages better.
+	
+	* specbuilder/specbuilder/version.py,
+	specbuilder/specbuilder/windows.py: New.
+
 2010-08-31	Chris Johns <chrisj at rtems.org>
 
 	* specbuilder/specbuilder/linux.py: Add Linux support. Can be

diff -u /dev/null rtems-tools/specbuilder/sb-versions:1.1
--- /dev/null	Mon Feb 21 22:10:29 2011
+++ rtems-tools/specbuilder/sb-versions	Mon Feb 21 21:46:44 2011
@@ -0,0 +1,33 @@
+#! /usr/bin/env python
+#
+# $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/>.
+#
+
+import sys, os
+base = os.path.dirname(sys.argv[0])
+sys.path.insert(0, base + '/specbuilder')
+try:
+    import version
+    version.run()
+except ImportError:
+    print >> sys.stderr, "Incorrect SpecBulder installation"
+    sys.exit(1)

diff -u rtems-tools/specbuilder/specbuilder/build.py:1.2 rtems-tools/specbuilder/specbuilder/build.py:1.3
--- rtems-tools/specbuilder/specbuilder/build.py:1.2	Thu Aug 12 16:09:55 2010
+++ rtems-tools/specbuilder/specbuilder/build.py	Mon Feb 21 21:46:44 2011
@@ -190,6 +190,8 @@
             source['compressed'] = '%{__bzip2} -dc'
         elif esl[-1:][0] == 'bz2':
             source['compressed'] = '%{__zip} -u'
+        elif esl[-1:][0] == 'xz':
+            source['compressed'] = '%{__xz} -dc'
         source['script'] = ''
         return source
 
@@ -389,6 +391,11 @@
         if not self.opts.no_clean():
             self.cleanup()
 
+    def name(self):
+        packages = self.spec.packages()
+        package = packages['main']
+        return package.name() + '-' + package.version()
+
 def run(args):
     try:
         opts, _defaults = defaults.load(args)

diff -u rtems-tools/specbuilder/specbuilder/crossgcc.py:1.1 rtems-tools/specbuilder/specbuilder/crossgcc.py:1.2
--- rtems-tools/specbuilder/specbuilder/crossgcc.py:1.1	Sun Aug  8 20:29:43 2010
+++ rtems-tools/specbuilder/specbuilder/crossgcc.py	Mon Feb 21 21:46:44 2011
@@ -72,8 +72,8 @@
             raise error.general('coping tree: ' + what + ': ' + str(err))
 
     def first_package(self, _build):
-        path = os.path.join(_build.spec.abspath('%{_tmppath}'),
-                            _build.spec.expand('crossgcc-%(%{__id_u} -n)'))
+        what = _build.spec.expand('crossgcc-%(%{__id_u} -n)-' + _build.name())
+        path = os.path.join(_build.spec.abspath('%{_tmppath}'), what)
         _build.rmdir(path)
         _build.mkdir(path)
         prefix = os.path.join(_build.spec.expand('%{_prefix}'), 'bin')

diff -u rtems-tools/specbuilder/specbuilder/darwin.py:1.2 rtems-tools/specbuilder/specbuilder/darwin.py:1.3
--- rtems-tools/specbuilder/specbuilder/darwin.py:1.2	Thu Aug 12 16:09:55 2010
+++ rtems-tools/specbuilder/specbuilder/darwin.py	Mon Feb 21 21:46:44 2011
@@ -51,7 +51,8 @@
         '_usr':                    '/opt/local',
         '_var':                    '/opt/local/var',
         'optflags':                '-O2 -fasynchronous-unwind-tables',
-        '_smp_mflags':             smp_mflags
+        '_smp_mflags':             smp_mflags,
+        '__xz':                    '/usr/local/bin/xz',
         }
     return defines
 

diff -u rtems-tools/specbuilder/specbuilder/defaults.py:1.6 rtems-tools/specbuilder/specbuilder/defaults.py:1.7
--- rtems-tools/specbuilder/specbuilder/defaults.py:1.6	Mon Aug 30 19:58:45 2010
+++ rtems-tools/specbuilder/specbuilder/defaults.py	Mon Feb 21 21:46:44 2011
@@ -135,6 +135,7 @@
 '__tar':               '/usr/bin/tar',
 '__tar_extract':       '%{__tar} -xvvf',
 '__unzip':             '/usr/bin/unzip',
+'__xz':                '/usr/bin/xz',
 '_datadir':            '%{_prefix}/share',
 '_defaultdocdir':      '%{_prefix}/share/doc',
 '_exeext':             '',
@@ -415,13 +416,17 @@
     """
     d = defaults
     overrides = None
-    uname = os.uname()
-    if uname[0] == 'Darwin':
-        import darwin
-        overrides = darwin.load()
-    elif uname[0] == 'Linux':
-        import linux 
-        overrides = linux.load()
+    if os.name == 'nt':
+        import windows
+        overrides = windows.load()
+    else:
+        uname = os.uname()
+        if uname[0] == 'Darwin':
+            import darwin
+            overrides = darwin.load()
+        elif uname[0] == 'Linux':
+            import linux 
+            overrides = linux.load()
     if overrides is None:
         raise error.general('no hosts defaults found; please add')
     for k in overrides:
@@ -451,3 +456,5 @@
         sys.exit(1)
     sys.exit(0)
 
+
+

diff -u rtems-tools/specbuilder/specbuilder/setup.py:1.5 rtems-tools/specbuilder/specbuilder/setup.py:1.6
--- rtems-tools/specbuilder/specbuilder/setup.py:1.5	Thu Aug 12 23:40:44 2010
+++ rtems-tools/specbuilder/specbuilder/setup.py	Mon Feb 21 21:46:44 2011
@@ -88,7 +88,8 @@
 
     def run(self, command, shell_opts = '', cwd = None):
         e = execute.capture_execution(log = log.default, dump = self.opts.quiet())
-        cmd = self.opts.expand('%{__setup_shell} -ex ' + shell_opts + ' ' + command, self.defaults)
+        cmd = self.opts.expand('%{___setup_shell} -ex ' + \
+                                   shell_opts + ' ' + command, self.defaults)
         self._output('run: ' + cmd)
         exit_code, proc, output = e.shell(cmd, cwd = cwd)
         if exit_code != 0:
@@ -96,19 +97,22 @@
 
     def check_version(self, cmd, macro):
         vcmd = cmd + ' --version'
+        vcmd = self.opts.expand('%{___setup_shell} -e ' + vcmd, self.defaults)        
         e = execute.capture_execution()
         exit_code, proc, output = e.shell(vcmd)
         if exit_code != 0 and len(output) != 0:
             raise error.general('shell cmd failed: ' + vcmd)
-        version = output.split('\n')[0].split(' ')
+        version = output.split('\n')[0].split(' ')[-1:][0]
         need = self.opts.expand(macro, self.defaults)
         if version < need:
-            _notice(self.opts, 'warning: ' + cmd + ' version is invalid, need ' + need + ' or higher')
+            _notice(self.opts, 'warning: ' + cmd + \
+                        ' version is invalid, need ' + need + ' or higher, found ' + version)
             return False
         return True
 
     def get_specs(self, path):
-        return self._get_file_list(path, 'rtems', 'spec')
+        return self._get_file_list(path, 'autotools', 'spec') + \
+            self._get_file_list(path, 'rtems', 'spec')
 
     def get_patches(self, path):
         return self._get_file_list(path, 'patches', 'diff')
@@ -127,7 +131,7 @@
                 dst = os.path.join(path, d)
                 self.mkdir(dst)
             except os.error, oerr:
-                if oerr[0] != errno.EEXIST:
+                if oerr[0] != errno.EEXIST and oerr[0] != 183:
                     raise error.general('OS error: ' + str(oerr))
             if d == 'RPMLIB':
                 files = []
@@ -141,7 +145,7 @@
             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:
+            if self.opts.rebuild():
                 if self.check_version('autoconf', '%{__setup_autoconf}'):
                     self.run('../../bootstrap -c', '-c', crossrpms)
                     self.run('../../bootstrap', '-c', crossrpms)
@@ -173,3 +177,5 @@
 
 if __name__ == "__main__":
     run()
+
+

diff -u rtems-tools/specbuilder/specbuilder/spec.py:1.2 rtems-tools/specbuilder/specbuilder/spec.py:1.3
--- rtems-tools/specbuilder/specbuilder/spec.py:1.2	Sun Aug  8 23:50:30 2010
+++ rtems-tools/specbuilder/specbuilder/spec.py	Mon Feb 21 21:46:44 2011
@@ -76,7 +76,11 @@
         infos = {}
         for i in self.infos:
             il = i.lower()
-            if il.startswith(label) and il[len(label):].isdigit():
+            if il.startswith(label):
+                if il == label:
+                    il = label + '0'
+                elif not il[len(label):].isdigit():
+                    continue
                 infos[il] = self.infos[i]
         return infos
 
@@ -146,6 +150,7 @@
     """Parse a spec file."""
 
     _directive = [ '%description',
+                   '%changelog',
                    '%prep',
                    '%build',
                    '%check',
@@ -156,6 +161,7 @@
                    '%files' ]
 
     _ignore = [ re.compile('%setup'),
+                re.compile('%configure'),
                 re.compile('%doc'),
                 re.compile('%dir'),
                 re.compile('%ghost'),
@@ -609,15 +615,7 @@
                     if isvalid:
                         for d in self._directive:
                             if ls[0].strip() == d:
-                                if len(ls) == 1:
-                                    package = 'main'
-                                elif len(ls) == 2:
-                                    package = ls[1].strip()
-                                else:
-                                    if ls[1].strip() != '-n':
-                                        self._warning("unknown directive option: '" + ls[1] + "'")
-                                    package = ls[2].strip()
-                                return ('directive', ls[0].strip(), package)
+                                return ('directive', ls[0].strip(), ls[1:])
                         self._warning("unknown directive: '" + ls[0] + "'")
                         return ('data', [l])
             else:
@@ -679,11 +677,23 @@
                         break
                     self._warning("unexpected '" + r[1] + "'")
                 elif r[0] == 'directive':
-                    self._set_package(r[2])
+                    new_data = []
+                    if r[1] == '%description':
+                        new_data = [' '.join(r[2])]
+                    else:
+                        if len(r[2]) == 0:
+                            _package = 'main'
+                        elif len(r[2]) == 1:
+                            _package = r[2][0]
+                        else:
+                            if r[2][0].strip() != '-n':
+                                self._warning("unknown directive option: '" + ' '.join(r[2]) + "'")
+                            _package = r[2][1].strip()
+                        self._set_package(_package)
                     if dir and dir != r[1]:
                         self._directive_extend(dir, data)
                     dir = r[1]
-                    data = []
+                    data = new_data
                 elif r[0] == 'data':
                     for l in r[1]:
                         l = self._expand(l)

diff -u /dev/null rtems-tools/specbuilder/specbuilder/version.py:1.1
--- /dev/null	Mon Feb 21 22:10:30 2011
+++ rtems-tools/specbuilder/specbuilder/version.py	Mon Feb 21 21:46:44 2011
@@ -0,0 +1,95 @@
+#
+# $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/>.
+#
+
+#
+# Extract the status of the spec files found in the SPECS directory.
+# The status is the name, source and patches.
+#
+
+import os
+
+import defaults
+import error
+import spec
+
+class versions:
+    """Return the versions of packages given a spec file."""
+
+    def __init__(self, name, _defaults, opts):
+        self.opts = opts
+        self.spec = spec.file(name, _defaults = _defaults, opts = opts)
+
+    def __str__(self):
+
+        def str_package(package):
+            sources = package.sources()
+            patches = package.patches()
+            version = package.version()
+            release = package.release()
+            buildarch = package.buildarch()
+            s = '\nNAME="' + package.name() + '"'
+            if buildarch:
+                s += '\nARCH="' + buildarch + '"'
+            if version:
+                s += '\nVERSION="' + version + '"'
+            if release:
+                s += '\nRELEASE="' + release + '"'
+            if len(sources):
+                s += '\nSOURCES=%d' % (len(sources))
+                c = 1
+                for i in sources:
+                    s += '\nSOURCE%d="' % (c) + sources[i][0] + '"'
+                    c += 1
+                s += '\nPATCHES=%d' % (len(patches))
+                c = 1
+                for i in patches:
+                    s += '\nPATCH%d="' % (c) + patches[i][0] + '"'
+                    c += 1
+            return s
+
+        packages = self.spec.packages()
+        s = 'SPEC=' + os.path.basename(self.spec.name) + \
+            str_package(packages['main'])
+        for p in packages:
+            if p != 'main':
+                s += str_package(packages[p])
+        return s + '\n'
+
+def run():
+    import sys
+    try:
+        opts, _defaults = defaults.load(sys.argv)
+        for spec_file in opts.spec_files():
+            s = versions(spec_file, _defaults = _defaults, opts = opts)
+            print s
+            del s
+    except error.general, gerr:
+        print gerr
+        sys.exit(1)
+    except error.internal, ierr:
+        print ierr
+        sys.exit(1)
+    sys.exit(0)
+
+if __name__ == "__main__":
+    run()

diff -u /dev/null rtems-tools/specbuilder/specbuilder/windows.py:1.1
--- /dev/null	Mon Feb 21 22:10:30 2011
+++ rtems-tools/specbuilder/specbuilder/windows.py	Mon Feb 21 21:46:44 2011
@@ -0,0 +1,67 @@
+#
+# $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/>.
+#
+
+#
+# Windows specific support and overrides.
+#
+
+import pprint
+import os
+
+import execute
+
+def load():
+    uname = 'win32'
+    if os.environ.has_key('NUMBER_OF_PROCESSORS'):
+        ncpus = int(os.environ['NUMBER_OF_PROCESSORS'])
+    else:
+        ncpus = 0
+    if ncpus > 1:
+        smp_mflags = '-j' + str(ncpus)
+    else:
+        smp_mflags = ''
+    if os.environ.has_key('HOSTTYPE'):
+        hosttype = os.environ['HOSTTYPE']
+    else:
+        hosttype = 'i686'
+    system = 'mingw32'
+    defines = { 
+        '_os':                     'win32',
+        '_host':                   hosttype + '-pc-' + system,
+        '_host_vendor':            'microsoft',
+        '_host_os':                'win32',
+        '_host_cpu':               hosttype,
+        '_host_alias':             '%{nil}',
+        '_host_arch':              hosttype,
+        '_usr':                    '/opt/local',
+        '_var':                    '/opt/local/var',
+        'optflags':                '-O2 -fasynchronous-unwind-tables',
+        '_smp_mflags':             smp_mflags,
+        '__sh':                    'sh',
+        '_buildshell':             '%{__sh}',
+        '___setup_shell':          '%{__sh}'
+        }
+    return defines
+
+if __name__ == '__main__':
+    pprint.pprint(load())



--

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/20110221/ab750af6/attachment.html>


More information about the vc mailing list