summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-04-20 21:47:28 +1000
committerChris Johns <chrisj@rtems.org>2013-04-20 21:47:28 +1000
commit4ce931b413cc269a835dda6e22ca14447806e2b1 (patch)
treecf0239a2c90e05774a47278c3b33b4fcd34c258b
parentSupport multiple read maps. (diff)
downloadrtems-source-builder-4ce931b413cc269a835dda6e22ca14447806e2b1.tar.bz2
Add CVS download support.
These changes complete the CVS download support.
-rw-r--r--rtems/config/snapshots/gcc-4.7-branch.mc4
-rw-r--r--rtems/config/snapshots/newlib-head.mc4
-rw-r--r--source-builder/config/gcc-4.7-1.cfg8
-rw-r--r--source-builder/config/gcc-common-1.cfg3
-rw-r--r--source-builder/sb/cvs.py30
-rw-r--r--source-builder/sb/download.py66
6 files changed, 99 insertions, 16 deletions
diff --git a/rtems/config/snapshots/gcc-4.7-branch.mc b/rtems/config/snapshots/gcc-4.7-branch.mc
index 4c4f3ff..03cdcbe 100644
--- a/rtems/config/snapshots/gcc-4.7-branch.mc
+++ b/rtems/config/snapshots/gcc-4.7-branch.mc
@@ -1,4 +1,4 @@
-[gcc-4.7-snapshot]
+[gcc-snapshot]
GCC_Version: none, override, '4.7.3-branch'
-Source0: none, override, 'git://gcc.gnu.org/git/gcc.git?reset=hard?branch=gcc-4_7-branch'
+Source0: none, override, 'git://gcc.gnu.org/git/gcc.git?branch=gcc-4_7-branch'
Patch0: none, override, '%{rtems_gcc_patches}/gcc-4.7.3-rtems4.11-20130414.diff'
diff --git a/rtems/config/snapshots/newlib-head.mc b/rtems/config/snapshots/newlib-head.mc
new file mode 100644
index 0000000..d174df5
--- /dev/null
+++ b/rtems/config/snapshots/newlib-head.mc
@@ -0,0 +1,4 @@
+[newlib-snapshot]
+Newlib_Version: none, override, 'cvs-head'
+Source10: none, override, 'cvs://pserver:anoncvs@sourceware.org/cvs/src?module=newlib?src-prefix=src'
+Patch10: none, undefine, ''
diff --git a/source-builder/config/gcc-4.7-1.cfg b/source-builder/config/gcc-4.7-1.cfg
index dd88041..2b78e01 100644
--- a/source-builder/config/gcc-4.7-1.cfg
+++ b/source-builder/config/gcc-4.7-1.cfg
@@ -6,9 +6,13 @@
#
#
-# Select the GCC 4.7 Snapshot Macro Map
+# Select Snapshot Macro Maps
#
-%select gcc-4.7-snapshot
+%select gcc-snapshot
+%select newlib-snapshot
+%select mpfr-snapshot
+%select mpc-snapshot
+%select gmp-snapshot
#
# Source
diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg
index e1d046e..52320a4 100644
--- a/source-builder/config/gcc-common-1.cfg
+++ b/source-builder/config/gcc-common-1.cfg
@@ -11,6 +11,9 @@
%error No GCC Version message defined.
%endif
+#
+# The package description.
+#
Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
Version: %{gcc_version}
diff --git a/source-builder/sb/cvs.py b/source-builder/sb/cvs.py
index 3eeaab4..e2c9bc8 100644
--- a/source-builder/sb/cvs.py
+++ b/source-builder/sb/cvs.py
@@ -31,10 +31,10 @@ import path
class repo:
"""An object to manage a cvs repo."""
- def _cvs_exit_code(self, ec, output):
+ def _cvs_exit_code(self, cmd, ec, output):
if ec:
print output
- raise error.general('cvs command failed (%s): %d' % (self.cvs, ec))
+ raise error.general('cvs command failed (%s): %d' % (cmd, ec))
def _parse_args(self, url):
if not url.startswith('cvs://'):
@@ -49,20 +49,20 @@ class repo:
opts[os[0]] = os[1:]
return opts
- def _run(self, args, check = False):
+ def _run(self, args, check = False, cwd = None):
e = execute.capture_execution()
if path.exists(self.path):
cwd = self.path
- else:
- cwd = None
- exit_code, proc, output = e.spawn([self.cvs, '-q'] + args, cwd = cwd)
+ cmd = [self.cvs, '-q'] + args
+ exit_code, proc, output = e.spawn(cmd, cwd = cwd)
if check:
- self._cvs_exit_code(exit_code, output)
+ self._cvs_exit_code(cmd, exit_code, output)
return exit_code, output
- def __init__(self, _path, opts, macros = None):
+ def __init__(self, _path, opts, macros = None, prefix = None):
self.path = _path
self.opts = opts
+ self.prefix = prefix
if macros is None:
self.macros = opts.defaults
else:
@@ -82,8 +82,15 @@ class repo:
raise error.general('invalid version number from cvs: %s' % (cvs[4]))
return (int(vs[0]), int(vs[1]), int(vs[2]))
- def checkout(self, root, path, module = ''):
- ec, output = self._run(['-d', root, 'co', '-N', '-d', path, module], check = True)
+ def checkout(self, root, module = None, tag = None, date = None):
+ cmd = ['-d', root, 'co', '-N']
+ if tag:
+ cmd += ['-r', tag]
+ if date:
+ cmd += ['-D', date]
+ if module:
+ cmd += [module]
+ ec, output = self._run(cmd, check = True)
def update(self):
ec, output = self._run(['up'])
@@ -137,7 +144,8 @@ if __name__ == '__main__':
ldir = 'cvs-test-rm-me'
c = repo(ldir, opts)
if not path.exists(ldir):
- c.checkout(':pserver:anoncvs@sourceware.org:/cvs/src', ldir, 'newlib')
+ path.mkdir(ldir)
+ c.checkout(':pserver:anoncvs@sourceware.org:/cvs/src', module = 'newlib')
print c.cvs_version()
print c.valid()
print c.status()
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index fef558a..02be4c5 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -28,6 +28,7 @@ import sys
import urllib2
import urlparse
+import cvs
import error
import git
import log
@@ -71,6 +72,25 @@ def _git_parser(source, config, opts):
path.join(source['local_prefix'], 'git', source['file'])
source['symlink'] = source['local']
+def _cvs_parser(source, config, opts):
+ #
+ # Symlink.
+ #
+ if not source['url'].startswith('cvs://'):
+ raise error.general('invalid cvs path: %s' % (source['url']))
+ us = source['url'].split('?')
+ try:
+ url = us[0]
+ source['file'] = \
+ url[url[6:].index(':') + 7:].replace('/', '_').replace('@', '_').replace('.', '_')
+ source['cvsroot'] = ':%s:' % (url[6:url[6:].index('/') + 6:])
+ except:
+ raise error.general('invalid cvs path: %s' % (source['url']))
+ source['local'] = path.join(source['local_prefix'], 'cvs', source['file'])
+ if 'src_prefix' in source:
+ source['symlink'] = path.join(source['local'])
+ else:
+ source['symlink'] = source['local']
def _file_parser(source, config, opts):
#
@@ -81,6 +101,7 @@ def _file_parser(source, config, opts):
parsers = { 'http': _http_parser,
'ftp': _http_parser,
'git': _git_parser,
+ 'cvs': _cvs_parser,
'file': _file_parser }
def parse_url(url, pathkey, config, opts):
@@ -188,6 +209,48 @@ def _git_downloader(url, local, config, opts):
repo.reset(arg)
return True
+def _cvs_downloader(url, local, config, opts):
+ rlp = os.path.relpath(path.host(local))
+ us = url.split('?')
+ module = None
+ tag = None
+ date = None
+ src_prefix = None
+ for a in us[1:]:
+ _as = a.split('=')
+ if _as[0] == 'module':
+ if len(_as) != 2:
+ raise error.general('invalid cvs module: %s' % (a))
+ module = _as[1]
+ elif _as[0] == 'src-prefix':
+ if len(_as) != 2:
+ raise error.general('invalid cvs src-prefix: %s' % (a))
+ src_prefix = _as[1]
+ elif _as[0] == 'tag':
+ if len(_as) != 2:
+ raise error.general('invalid cvs tag: %s' % (a))
+ tag = _as[1]
+ elif _as[0] == 'date':
+ if len(_as) != 2:
+ raise error.general('invalid cvs date: %s' % (a))
+ date = _as[1]
+ repo = cvs.repo(local, opts, config.macros, src_prefix)
+ if not repo.valid():
+ _notice(opts, 'cvs: checkout: %s -> %s' % (us[0], rlp))
+ if not opts.dry_run():
+ repo.checkout(':%s' % (us[0][6:]), module, tag, date)
+ for a in us[1:]:
+ _as = a.split('=')
+ if _as[0] == 'update':
+ _notice(opts, 'cvs: update: %s' % (us[0]))
+ if not opts.dry_run():
+ repo.update()
+ elif _as[0] == 'reset':
+ _notice(opts, 'cvs: reset: %s' % (us[0]))
+ if not opts.dry_run():
+ repo.reset()
+ return True
+
def _file_downloader(url, local, config, opts):
if path.exists(local):
return True
@@ -196,7 +259,8 @@ def _file_downloader(url, local, config, opts):
downloaders = { 'http': _http_downloader,
'ftp': _http_downloader,
'git': _git_downloader,
- 'file': _file_downloader }
+ 'cvs': _cvs_downloader,
+ 'file': _file_downloader }
def get_file(url, local, opts, config):
if local is None: