source: rtems-source-builder/source-builder/sb/download.py @ 1f972c2

5
Last change on this file since 1f972c2 was 1f972c2, checked in by Chris Johns <chrisj@…>, on 05/08/20 at 04:28:04

sb: Add git clean to the supported git commands.

  • Property mode set to 100644
File size: 24.7 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2016 Chris Johns (chrisj@rtems.org)
4# All rights reserved.
5#
6# This file is part of the RTEMS Tools package in 'rtems-tools'.
7#
8# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20#
21# This code builds a package given a config file. It only builds to be
22# installed not to be package unless you run a packager around this.
23#
24
25from __future__ import print_function
26
27import base64
28import hashlib
29import os
30import re
31import stat
32import sys
33try:
34    import urllib.request as urllib_request
35    import urllib.parse as urllib_parse
36except ImportError:
37    import urllib2 as urllib_request
38    import urlparse as urllib_parse
39
40import cvs
41import error
42import git
43import log
44import path
45import sources
46import version
47
48def _do_download(opts):
49    download = True
50    if opts.dry_run():
51        download = False
52        wa = opts.with_arg('download')
53        if wa is not None:
54            if wa[0] == 'with_download' and wa[1] == 'yes':
55                download = True
56    return download
57
58def _humanize_bytes(bytes, precision = 1):
59    abbrevs = (
60        (1 << 50, 'PB'),
61        (1 << 40, 'TB'),
62        (1 << 30, 'GB'),
63        (1 << 20, 'MB'),
64        (1 << 10, 'kB'),
65        (1, ' bytes')
66    )
67    if bytes == 1:
68        return '1 byte'
69    for factor, suffix in abbrevs:
70        if bytes >= factor:
71            break
72    return '%.*f%s' % (precision, float(bytes) / factor, suffix)
73
74def _sensible_url(url, used = 0):
75    space = 100
76    if len(url) > space:
77        size = int(space - 14)
78        url = url[:size] + '...<see log>'
79    return url
80
81def _hash_check(file_, absfile, macros, remove = True):
82    failed = False
83    hash = sources.get_hash(file_.lower(), macros)
84    if hash is not None:
85        hash = hash.split()
86        if len(hash) != 2:
87            raise error.internal('invalid hash format: %s' % (file_))
88        try:
89            hashlib_algorithms = hashlib.algorithms
90        except:
91            hashlib_algorithms = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']
92        if hash[0] not in hashlib_algorithms:
93            raise error.general('invalid hash algorithm for %s: %s' % (file_, hash[0]))
94        if hash[0] in ['md5', 'sha1']:
95            raise error.general('hash: %s: insecure: %s' % (file_, hash[0]))
96        hasher = None
97        _in = None
98        try:
99            hasher = hashlib.new(hash[0])
100            _in = open(path.host(absfile), 'rb')
101            hasher.update(_in.read())
102        except IOError as err:
103            log.notice('hash: %s: read error: %s' % (file_, str(err)))
104            failed = True
105        except:
106            msg = 'hash: %s: error' % (file_)
107            log.stderr(msg)
108            log.notice(msg)
109            if _in is not None:
110                _in.close()
111            raise
112        if _in is not None:
113            _in.close()
114        hash_hex = hasher.hexdigest()
115        hash_base64 = base64.b64encode(hasher.digest()).decode('utf-8')
116        log.output('checksums: %s: (hex: %s) (b64: %s) => %s' % (file_,
117                                                                 hash_hex,
118                                                                 hash_base64,
119                                                                 hash[1]))
120        if hash_hex != hash[1] and hash_base64 != hash[1]:
121            log.warning('checksum error: %s' % (file_))
122            failed = True
123        if failed and remove:
124            log.warning('removing: %s' % (file_))
125            if path.exists(absfile):
126                try:
127                    os.remove(path.host(absfile))
128                except IOError as err:
129                    raise error.general('hash: %s: remove: %s' % (absfile, str(err)))
130                except:
131                    raise error.general('hash: %s: remove error' % (file_))
132        if hasher is not None:
133            del hasher
134    else:
135        if version.released():
136            raise error.general('%s: no hash found in released RSB' % (file_))
137        log.warning('%s: no hash found' % (file_))
138    return not failed
139
140def _local_path(source, pathkey, config):
141    for p in config.define(pathkey).split(':'):
142        local_prefix = path.abspath(p)
143        local = path.join(local_prefix, source['file'])
144        if source['local'] is None:
145            source['local_prefix'] = local_prefix
146            source['local'] = local
147        if path.exists(local):
148            source['local_prefix'] = local_prefix
149            source['local'] = local
150            _hash_check(source['file'], local, config.macros)
151            break
152
153def _http_parser(source, pathkey, config, opts):
154    #
155    # If the file has not been overrided attempt to recover a possible file name.
156    #
157    if 'file-override' not in source['options']:
158        #
159        # Hack for gitweb.cgi patch downloads. We rewrite the various fields.
160        #
161        if 'gitweb.cgi' in source['url']:
162            url = source['url']
163            if '?' not in url:
164                raise error.general('invalid gitweb.cgi request: %s' % (url))
165            req = url.split('?')[1]
166            if len(req) == 0:
167                raise error.general('invalid gitweb.cgi request: %s' % (url))
168            #
169            # The gitweb.cgi request should have:
170            #    p=<what>
171            #    a=patch
172            #    h=<hash>
173            # so extract the p and h parts to make the local name.
174            #
175            p = None
176            a = None
177            h = None
178            for r in req.split(';'):
179                if '=' not in r:
180                    raise error.general('invalid gitweb.cgi path: %s' % (url))
181                rs = r.split('=')
182                if rs[0] == 'p':
183                    p = rs[1].replace('.', '-')
184                elif rs[0] == 'a':
185                    a = rs[1]
186                elif rs[0] == 'h':
187                    h = rs[1]
188            if p is None or h is None:
189                raise error.general('gitweb.cgi path missing p or h: %s' % (url))
190            source['file'] = '%s-%s.patch' % (p, h)
191        #
192        # Wipe out everything special in the file name.
193        #
194        source['file'] = re.sub(r'[^a-zA-Z0-9.\-]+', '-', source['file'])
195        max_file_len = 127
196        if len(source['file']) > max_file_len:
197            raise error.general('file name length is greater than %i (maybe use --rsb-file=FILE option): %s' % \
198                                (max_file_len, source['file']))
199    #
200    # Check local path
201    #
202    _local_path(source, pathkey, config)
203    #
204    # Is the file compressed ?
205    #
206    esl = source['ext'].split('.')
207    if esl[-1:][0] == 'gz':
208        source['compressed-type'] = 'gzip'
209        source['compressed'] = '%{__gzip} -dc'
210    elif esl[-1:][0] == 'bz2':
211        source['compressed-type'] = 'bzip2'
212        source['compressed'] = '%{__bzip2} -dc'
213    elif esl[-1:][0] == 'zip':
214        source['compressed-type'] = 'zip'
215        source['compressed'] = '%{__unzip} -u'
216    elif esl[-1:][0] == 'xz':
217        source['compressed-type'] = 'xz'
218        source['compressed'] = '%{__xz} -dc'
219
220def _patchworks_parser(source, pathkey, config, opts):
221    #
222    # Check local path
223    #
224    _local_path(source, pathkey, config)
225    source['url'] = 'http%s' % (source['path'][2:])
226
227def _git_parser(source, pathkey, config, opts):
228    #
229    # Check local path
230    #
231    _local_path(source, pathkey, config)
232    #
233    # Symlink.
234    #
235    us = source['url'].split('?')
236    source['path'] = path.dirname(us[0])
237    source['file'] = path.basename(us[0])
238    source['name'], source['ext'] = path.splitext(source['file'])
239    if len(us) > 1:
240        source['args'] = us[1:]
241    source['local'] = \
242        path.join(source['local_prefix'], 'git', source['file'])
243    source['symlink'] = source['local']
244
245def _cvs_parser(source, pathkey, config, opts):
246    #
247    # Check local path
248    #
249    _local_path(source, pathkey, config)
250    #
251    # Symlink.
252    #
253    if not source['url'].startswith('cvs://'):
254        raise error.general('invalid cvs path: %s' % (source['url']))
255    us = source['url'].split('?')
256    try:
257        url = us[0]
258        source['file'] = url[url[6:].index(':') + 7:]
259        source['cvsroot'] = ':%s:' % (url[6:url[6:].index('/') + 6:])
260    except:
261        raise error.general('invalid cvs path: %s' % (source['url']))
262    for a in us[1:]:
263        _as = a.split('=')
264        if _as[0] == 'module':
265            if len(_as) != 2:
266                raise error.general('invalid cvs module: %s' % (a))
267            source['module'] = _as[1]
268        elif _as[0] == 'src-prefix':
269            if len(_as) != 2:
270                raise error.general('invalid cvs src-prefix: %s' % (a))
271            source['src_prefix'] = _as[1]
272        elif _as[0] == 'tag':
273            if len(_as) != 2:
274                raise error.general('invalid cvs tag: %s' % (a))
275            source['tag'] = _as[1]
276        elif _as[0] == 'date':
277            if len(_as) != 2:
278                raise error.general('invalid cvs date: %s' % (a))
279            source['date'] = _as[1]
280    if 'date' in source and 'tag' in source:
281        raise error.general('cvs URL cannot have a date and tag: %s' % (source['url']))
282    # Do here to ensure an ordered path, the URL can include options in any order
283    if 'module' in source:
284        source['file'] += '_%s' % (source['module'])
285    if 'tag' in source:
286        source['file'] += '_%s' % (source['tag'])
287    if 'date' in source:
288        source['file'] += '_%s' % (source['date'])
289    for c in '/@#%.-':
290        source['file'] = source['file'].replace(c, '_')
291    source['local'] = path.join(source['local_prefix'], 'cvs', source['file'])
292    if 'src_prefix' in source:
293        source['symlink'] = path.join(source['local'], source['src_prefix'])
294    else:
295        source['symlink'] = source['local']
296
297def _file_parser(source, pathkey, config, opts):
298    #
299    # Check local path
300    #
301    _local_path(source, pathkey, config)
302    #
303    # Get the paths sorted.
304    #
305    source['file'] = source['url'][6:]
306
307parsers = { 'http': _http_parser,
308            'ftp':  _http_parser,
309            'pw':   _patchworks_parser,
310            'git':  _git_parser,
311            'cvs':  _cvs_parser,
312            'file': _file_parser }
313
314def set_release_path(release_path, macros):
315    if release_path is None:
316        release_path = '%{rtems_release_url}/%{rsb_version}/sources'
317    macros.define('release_path', release_path)
318
319def parse_url(url, pathkey, config, opts, file_override = None):
320    #
321    # Split the source up into the parts we need.
322    #
323    source = {}
324    source['url'] = url
325    source['options'] = []
326    colon = url.find(':')
327    if url[colon + 1:colon + 3] != '//':
328        raise error.general('malforned URL (no protocol prefix): %s' % (url))
329    source['path'] = url[:colon + 3] + path.dirname(url[colon + 3:])
330    if file_override is None:
331        source['file'] = path.basename(url)
332    else:
333        bad_chars = [c for c in ['/', '\\', '?', '*'] if c in file_override]
334        if len(bad_chars) > 0:
335            raise error.general('bad characters in file name: %s' % (file_override))
336        log.output('download: file-override: %s' % (file_override))
337        source['file'] = file_override
338        source['options'] += ['file-override']
339    source['name'], source['ext'] = path.splitext(source['file'])
340    if source['name'].endswith('.tar'):
341        source['name'] = source['name'][:-4]
342        source['ext'] = '.tar' + source['ext']
343    #
344    # Get the file. Checks the local source directory first.
345    #
346    source['local'] = None
347    for p in parsers:
348        if url.startswith(p):
349            source['type'] = p
350            if parsers[p](source, pathkey, config, opts):
351                break
352    source['script'] = ''
353    return source
354
355def _http_downloader(url, local, config, opts):
356    if path.exists(local):
357        return True
358    #
359    # Hack for GitHub.
360    #
361    if url.startswith('https://api.github.com'):
362        url = urllib_parse.urljoin(url, config.expand('tarball/%{version}'))
363    dst = os.path.relpath(path.host(local))
364    log.output('download: (full) %s -> %s' % (url, dst))
365    log.notice('download: %s -> %s' % (_sensible_url(url, len(dst)), dst))
366    failed = False
367    if _do_download(opts):
368        _in = None
369        _out = None
370        _length = None
371        _have = 0
372        _chunk_size = 256 * 1024
373        _chunk = None
374        _last_percent = 200.0
375        _last_msg = ''
376        _have_status_output = False
377        _url = url
378        try:
379            try:
380                _in = None
381                _ssl_context = None
382                # See #2656
383                _req = urllib_request.Request(_url)
384                _req.add_header('User-Agent', 'Wget/1.16.3 (freebsd10.1)')
385                try:
386                    import ssl
387                    _ssl_context = ssl._create_unverified_context()
388                    _in = urllib_request.urlopen(_req, context = _ssl_context)
389                except:
390                    log.output('download: no ssl context')
391                    _ssl_context = None
392                if _ssl_context is None:
393                    _in = urllib_request.urlopen(_req)
394                if _url != _in.geturl():
395                    _url = _in.geturl()
396                    log.output(' redirect: %s' % (_url))
397                    log.notice(' redirect: %s' % (_sensible_url(_url)))
398                _out = open(path.host(local), 'wb')
399                try:
400                    _length = int(_in.info()['Content-Length'].strip())
401                except:
402                    pass
403                while True:
404                    _msg = '\rdownloading: %s - %s ' % (dst, _humanize_bytes(_have))
405                    if _length:
406                        _percent = round((float(_have) / _length) * 100, 2)
407                        if _percent != _last_percent:
408                            _msg += 'of %s (%0.0f%%) ' % (_humanize_bytes(_length), _percent)
409                    if _msg != _last_msg:
410                        extras = (len(_last_msg) - len(_msg))
411                        log.stdout_raw('%s%s' % (_msg, ' ' * extras + '\b' * extras))
412                        _last_msg = _msg
413                        _have_status_output = True
414                    _chunk = _in.read(_chunk_size)
415                    if not _chunk:
416                        break
417                    _out.write(_chunk)
418                    _have += len(_chunk)
419                log.stdout_raw('\n\r')
420            except:
421                if _have_status_output:
422                    log.stdout_raw('\n\r')
423                raise
424        except IOError as err:
425            log.notice('download: %s: error: %s' % (_sensible_url(_url), str(err)))
426            if path.exists(local):
427                os.remove(path.host(local))
428            failed = True
429        except ValueError as err:
430            log.notice('download: %s: error: %s' % (_sensible_url(_url), str(err)))
431            if path.exists(local):
432                os.remove(path.host(local))
433            failed = True
434        except:
435            msg = 'download: %s: error' % (_sensible_url(_url))
436            log.stderr(msg)
437            log.notice(msg)
438            if _in is not None:
439                _in.close()
440            if _out is not None:
441                _out.close()
442            raise
443        if _out is not None:
444            _out.close()
445        if _in is not None:
446            _in.close()
447            del _in
448        if not failed:
449            if not path.isfile(local):
450                raise error.general('source is not a file: %s' % (path.host(local)))
451            if not _hash_check(path.basename(local), local, config.macros, False):
452                raise error.general('checksum failure file: %s' % (dst))
453    return not failed
454
455def _git_downloader(url, local, config, opts):
456    repo = git.repo(local, opts, config.macros)
457    rlp = os.path.relpath(path.host(local))
458    us = url.split('?')
459    #
460    # Handle the various git protocols.
461    #
462    # remove 'git' from 'git://xxxx/xxxx?protocol=...'
463    #
464    url_base = us[0][len('git'):]
465    for a in us[1:]:
466        _as = a.split('=')
467        if _as[0] == 'protocol':
468            if len(_as) != 2:
469                raise error.general('invalid git protocol option: %s' % (_as))
470            if _as[1] == 'none':
471                # remove the rest of the protocol header leaving nothing.
472                us[0] = url_base[len('://'):]
473            else:
474                if _as[1] not in ['ssh', 'git', 'http', 'https', 'ftp', 'ftps', 'rsync']:
475                    raise error.general('unknown git protocol: %s' % (_as[1]))
476                us[0] = _as[1] + url_base
477    if not repo.valid():
478        log.notice('git: clone: %s -> %s' % (us[0], rlp))
479        if _do_download(opts):
480            repo.clone(us[0], local)
481    else:
482        repo.clean(['-f', '-d'])
483        repo.reset('--hard')
484        repo.checkout('master')
485    for a in us[1:]:
486        _as = a.split('=')
487        if _as[0] == 'branch' or _as[0] == 'checkout':
488            if len(_as) != 2:
489                raise error.general('invalid git branch/checkout: %s' % (_as))
490            log.notice('git: checkout: %s => %s' % (us[0], _as[1]))
491            if _do_download(opts):
492                repo.checkout(_as[1])
493        elif _as[0] == 'submodule':
494            if len(_as) != 2:
495                raise error.general('invalid git submodule: %s' % (_as))
496            log.notice('git: submodule: %s <= %s' % (us[0], _as[1]))
497            if _do_download(opts):
498                repo.submodule(_as[1])
499        elif _as[0] == 'fetch':
500            log.notice('git: fetch: %s -> %s' % (us[0], rlp))
501            if _do_download(opts):
502                repo.fetch()
503        elif _as[0] == 'merge':
504            log.notice('git: merge: %s' % (us[0]))
505            if _do_download(opts):
506                repo.merge()
507        elif _as[0] == 'pull':
508            log.notice('git: pull: %s' % (us[0]))
509            if _do_download(opts):
510                repo.pull()
511        elif _as[0] == 'reset':
512            arg = []
513            if len(_as) > 1:
514                arg = ['--%s' % (_as[1])]
515            log.notice('git: reset: %s' % (us[0]))
516            if _do_download(opts):
517                repo.reset(arg)
518                repo.submodule_foreach(['reset'] + arg)
519        elif _as[0] == 'clean':
520            arg = []
521            if len(_as) > 1:
522                arg = ['--%s' % (_as[1])]
523            log.notice('git: clean: %s' % (us[0]))
524            if _do_download(opts):
525                repo.clean(arg)
526                repo.submodule_foreach(['clean'] + arg)
527        elif _as[0] == 'protocol':
528            pass
529        else:
530            raise error.general('invalid git option: %s' % (_as))
531    return True
532
533def _cvs_downloader(url, local, config, opts):
534    rlp = os.path.relpath(path.host(local))
535    us = url.split('?')
536    module = None
537    tag = None
538    date = None
539    src_prefix = None
540    for a in us[1:]:
541        _as = a.split('=')
542        if _as[0] == 'module':
543            if len(_as) != 2:
544                raise error.general('invalid cvs module: %s' % (a))
545            module = _as[1]
546        elif _as[0] == 'src-prefix':
547            if len(_as) != 2:
548                raise error.general('invalid cvs src-prefix: %s' % (a))
549            src_prefix = _as[1]
550        elif _as[0] == 'tag':
551            if len(_as) != 2:
552                raise error.general('invalid cvs tag: %s' % (a))
553            tag = _as[1]
554        elif _as[0] == 'date':
555            if len(_as) != 2:
556                raise error.general('invalid cvs date: %s' % (a))
557            date = _as[1]
558    repo = cvs.repo(local, opts, config.macros, src_prefix)
559    if not repo.valid():
560        if not path.isdir(local):
561            log.notice('Creating source directory: %s' % \
562                           (os.path.relpath(path.host(local))))
563            if _do_download(opts):
564                path.mkdir(local)
565            log.notice('cvs: checkout: %s -> %s' % (us[0], rlp))
566            if _do_download(opts):
567                repo.checkout(':%s' % (us[0][6:]), module, tag, date)
568    for a in us[1:]:
569        _as = a.split('=')
570        if _as[0] == 'update':
571            log.notice('cvs: update: %s' % (us[0]))
572            if _do_download(opts):
573                repo.update()
574        elif _as[0] == 'reset':
575            log.notice('cvs: reset: %s' % (us[0]))
576            if _do_download(opts):
577                repo.reset()
578    return True
579
580def _file_downloader(url, local, config, opts):
581    if not path.exists(local):
582        try:
583            src = url[7:]
584            dst = local
585            log.notice('download: copy %s -> %s' % (src, dst))
586            path.copy(src, dst)
587        except:
588            return False
589    return True
590
591downloaders = { 'http': _http_downloader,
592                'ftp':  _http_downloader,
593                'pw':   _http_downloader,
594                'git':  _git_downloader,
595                'cvs':  _cvs_downloader,
596                'file': _file_downloader }
597
598def get_file(url, local, opts, config):
599    if local is None:
600        raise error.general('source/patch path invalid')
601    if not path.isdir(path.dirname(local)) and not opts.download_disabled():
602        log.notice('Creating source directory: %s' % \
603                       (os.path.relpath(path.host(path.dirname(local)))))
604    log.output('making dir: %s' % (path.host(path.dirname(local))))
605    if _do_download(opts):
606        path.mkdir(path.dirname(local))
607    if not path.exists(local) and opts.download_disabled():
608        raise error.general('source not found: %s' % (path.host(local)))
609    #
610    # Check if a URL has been provided on the command line. If the package is
611    # released push the release path URLs to the start the RTEMS URL list
612    # unless overriden by the command line option --without-release-url. The
613    # variant --without-release-url can override the released check.
614    #
615    url_bases = opts.urls()
616    if url_bases is None:
617        url_bases = []
618    try:
619        rtems_release_url_value = config.macros.expand('%{release_path}')
620    except:
621        rtems_release_url_value = None
622    rtems_release_url = None
623    rtems_release_urls = []
624    if version.released() and rtems_release_url_value:
625        rtems_release_url = rtems_release_url_value
626    with_rel_url = opts.with_arg('release-url')
627    if with_rel_url[1] == 'not-found':
628        if config.defined('without_release_url'):
629            with_rel_url = ('without_release-url', 'yes')
630    if with_rel_url[0] == 'with_release-url':
631        if with_rel_url[1] == 'yes':
632            if rtems_release_url_value is None:
633                raise error.general('no valid release URL')
634            rtems_release_url = rtems_release_url_value
635        elif with_rel_url[1] == 'no':
636            pass
637        else:
638            rtems_release_url = with_rel_url[1]
639    elif with_rel_url[0] == 'without_release-url' and with_rel_url[1] == 'yes':
640        rtems_release_url = None
641    if rtems_release_url is not None:
642        rtems_release_urls = rtems_release_url.split(',')
643        for release_url in rtems_release_urls:
644            log.trace('release url: %s' % (release_url))
645            #
646            # If the URL being fetched is under the release path do not add
647            # the sources release path because it is already there.
648            #
649            if not url.startswith(release_url):
650                url_bases = [release_url] + url_bases
651    urls = []
652    if len(url_bases) > 0:
653        #
654        # Split up the URL we are being asked to download.
655        #
656        url_path = urllib_parse.urlsplit(url)[2]
657        slash = url_path.rfind('/')
658        if slash < 0:
659            url_file = url_path
660        else:
661            url_file = url_path[slash + 1:]
662        log.trace('url_file: %s' %(url_file))
663        for base in url_bases:
664            #
665            # Hack to fix #3064 where --rsb-file is being used. This code is a
666            # mess and should be refactored.
667            #
668            if version.released() and base in rtems_release_urls:
669                url_file = path.basename(local)
670            if base[-1:] != '/':
671                base += '/'
672            next_url = urllib_parse.urljoin(base, url_file)
673            log.trace('url: %s' %(next_url))
674            urls.append(next_url)
675    urls += url.split()
676    log.trace('_url: %s -> %s' % (','.join(urls), local))
677    for url in urls:
678        for dl in downloaders:
679            if url.startswith(dl):
680                if downloaders[dl](url, local, config, opts):
681                    return
682    if _do_download(opts):
683        raise error.general('downloading %s: all paths have failed, giving up' % (url))
Note: See TracBrowser for help on using the repository browser.