summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/download.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-04-25 15:06:20 +1000
committerChris Johns <chrisj@rtems.org>2013-04-25 15:06:20 +1000
commitc65b9eb7ec0edc0f583b4d863c396ff81592571c (patch)
treea360d20a32c7057980d47748c5c0e45e30ea7694 /source-builder/sb/download.py
parentAdd a tip about using --dry-run before an initial build to check all is ok. (diff)
downloadrtems-source-builder-c65b9eb7ec0edc0f583b4d863c396ff81592571c.tar.bz2
Change the CVS download path to include the module and tag/date.
Diffstat (limited to 'source-builder/sb/download.py')
-rw-r--r--source-builder/sb/download.py30
1 files changed, 26 insertions, 4 deletions
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index feb57fe..37344a1 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -71,18 +71,40 @@ def _cvs_parser(source, config, opts):
us = source['url'].split('?')
try:
url = us[0]
- source['file'] = \
- url[url[6:].index(':') + 7:].replace('/', '_').replace('@', '_').replace('.', '_')
+ source['file'] = url[url[6:].index(':') + 7:]
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'])
for a in us[1:]:
_as = a.split('=')
- if _as[0] == 'src-prefix':
+ if _as[0] == 'module':
+ if len(_as) != 2:
+ raise error.general('invalid cvs module: %s' % (a))
+ source['module'] = _as[1]
+ elif _as[0] == 'src-prefix':
if len(_as) != 2:
raise error.general('invalid cvs src-prefix: %s' % (a))
source['src_prefix'] = _as[1]
+ elif _as[0] == 'tag':
+ if len(_as) != 2:
+ raise error.general('invalid cvs tag: %s' % (a))
+ source['tag'] = _as[1]
+ elif _as[0] == 'date':
+ if len(_as) != 2:
+ raise error.general('invalid cvs date: %s' % (a))
+ source['date'] = _as[1]
+ if 'date' in source and 'tag' in source:
+ raise error.general('cvs URL cannot have a date and tag: %s' % (source['url']))
+ # Do here to ensure an ordered path, the URL can include options in any order
+ if 'module' in source:
+ source['file'] += '_%s' % (source['module'])
+ if 'tag' in source:
+ source['file'] += '_%s' % (source['tag'])
+ if 'date' in source:
+ source['file'] += '_%s' % (source['date'])
+ for c in '/@#%.-':
+ source['file'] = source['file'].replace(c, '_')
+ source['local'] = path.join(source['local_prefix'], 'cvs', source['file'])
if 'src_prefix' in source:
source['symlink'] = path.join(source['local'], source['src_prefix'])
else: