From c65b9eb7ec0edc0f583b4d863c396ff81592571c Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Thu, 25 Apr 2013 15:06:20 +1000 Subject: [PATCH] Change the CVS download path to include the module and tag/date. --- source-builder/config/gdb-7-1.cfg | 14 +++++++-- .../config/snapshots/gdb-7.6-branch.mc | 2 +- source-builder/sb/download.py | 30 ++++++++++++++++--- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/source-builder/config/gdb-7-1.cfg b/source-builder/config/gdb-7-1.cfg index 33f3631..21dec87 100644 --- a/source-builder/config/gdb-7-1.cfg +++ b/source-builder/config/gdb-7-1.cfg @@ -6,6 +6,15 @@ %include %{_configdir}/checks.cfg +# +# Select Snapshot Macro Maps +# +%select gdb-snapshot +%select expat-snapshot + +# +# The description. +# Name: %{_target}-gdb-%{gdb_version}-%{release} Summary: GDB v%{gdb_version} for target %{_target} on host %{_host} Version: %{gdb_version} @@ -33,8 +42,9 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) # Prepare the source code. # %prep + source_dir_0="gdb-%{gdb_version}" %setup -q -c -n %{name}-%{version} - cd gdb-%{gdb_version} + cd ${source_dir_0} %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}} %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}} %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}} @@ -61,7 +71,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) LIBS_STATIC="-lexpat" CFLAGS="$SB_OPT_FLAGS" \ LIBS="%{_forced_static}" \ - ../gdb-%{gdb_version}/configure \ + ../${source_dir_0}/configure \ --build=%{_build} --host=%{_host} \ --target=%{_target} \ --verbose --disable-nls \ diff --git a/source-builder/config/snapshots/gdb-7.6-branch.mc b/source-builder/config/snapshots/gdb-7.6-branch.mc index c9d3b02..85db02c 100644 --- a/source-builder/config/snapshots/gdb-7.6-branch.mc +++ b/source-builder/config/snapshots/gdb-7.6-branch.mc @@ -1,4 +1,4 @@ [gdb-snapshot] -GDB_Version: none, override, ' gdb-7.6-branch' +GDB_Version: none, override, '7.6-branch' Source0: none, override, 'cvs://pserver:anoncvs@sourceware.org/cvs/src?module=gdb?src-prefix=src?tag=gdb_7_6-branch' Patch0: none, undefine, '' 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: