Changeset 53b918e in rtems-source-builder


Ignore:
Timestamp:
Feb 4, 2014, 7:23:08 AM (6 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
edf60aa
Parents:
5601b9c
Message:

sb: Fix downloader url parsing and add submodule git support.

Split the URL by line breaks into separate requests.

With git reset the repo with each run. First perform a hard reset
to remove any local patches and then switch back to master incase
the repo was left on a branch or a detached head.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/download.py

    r5601b9c r53b918e  
    204204        if not opts.dry_run():
    205205            repo.clone(us[0], local)
     206    else:
     207        repo.reset('--hard')
     208        repo.checkout('master')
    206209    for a in us[1:]:
    207210        _as = a.split('=')
    208         if _as[0] == 'branch':
     211        if _as[0] == 'branch' or _as[0] == 'checkout':
     212            if len(_as) != 2:
     213                raise error.general('invalid git branch/checkout: %s' % (_as))
    209214            log.notice('git: checkout: %s => %s' % (us[0], _as[1]))
    210215            if not opts.dry_run():
     
    214219            if not opts.dry_run():
    215220                repo.pull()
     221        elif _as[0] == 'submodule':
     222            if len(_as) != 2:
     223                raise error.general('invalid git submodule: %s' % (_as))
     224            log.notice('git: submodule: %s <= %s' % (us[0], _as[1]))
     225            if not opts.dry_run():
     226                repo.submodule(_as[1])
    216227        elif _as[0] == 'fetch':
    217228            log.notice('git: fetch: %s -> %s' % (us[0], rlp))
     
    297308        raise error.general('source not found: %s' % (path.host(local)))
    298309    #
    299     # Check if a URL hasbeen provided on the command line.
     310    # Check if a URL has been provided on the command line.
    300311    #
    301312    url_bases = opts.urls()
     
    312323                url_file = url_path[slash + 1:]
    313324            urls.append(urlparse.urljoin(base, url_file))
    314     urls.append(url)
     325    urls += url.split()
    315326    log.trace('_url: %s -> %s' % (','.join(urls), local))
     327    for url in urls:
     328        for dl in downloaders:
     329            if url.startswith(dl):
     330                if downloaders[dl](url, local, config, opts):
     331                    return
    316332    if not opts.dry_run():
    317         for url in urls:
    318             for dl in downloaders:
    319                 if url.startswith(dl):
    320                     if downloaders[dl](url, local, config, opts):
    321                         return
    322333        raise error.general('downloading %s: all paths have failed, giving up' % (url))
Note: See TracChangeset for help on using the changeset viewer.