def execute(self, command, hint=None, cwd=None, extra_env=None): if not command: raise CommandError(_('No command given')) kws = { 'close_fds': True } print_args = {'cwd': ''} if cwd: print_args['cwd'] = cwd else: try: print_args['cwd'] = os.getcwd() except OSError: pass if isinstance(command, (str, unicode)): kws['shell'] = True print_args['command'] = command else: print_args['command'] = ' '.join(command) if not self.config.quiet_mode: if self.config.print_command_pattern: try: print self.config.print_command_pattern % print_args except TypeError, e: raise FatalError('\'print_command_pattern\' %s' % e) except KeyError, e: raise FatalError(_('%(configuration_variable)s invalid key' ' %(key)s' % \ {'configuration_variable' : '\'print_command_pattern\'', 'key' : e}))
def _download_tarball(self, buildscript, localfile): if not os.access(self.config.tarballdir, os.R_OK | os.W_OK | os.X_OK): raise FatalError( _('tarball dir (%s) must be writable') % self.config.tarballdir) """Downloads the tarball off the internet, using wget or curl.""" extra_env = { 'LD_LIBRARY_PATH': os.environ.get('UNMANGLED_LD_LIBRARY_PATH'), 'PATH': os.environ.get('UNMANGLED_PATH') } lines = [['wget', '--continue', self.module, '-O', localfile], [ 'curl', '--continue-at', '-', '-L', self.module, '-o', localfile ]] lines = [line for line in lines if has_command(line[0])] if not lines: raise FatalError(_("unable to find wget or curl")) try: return buildscript.execute(lines[0], extra_env=extra_env) except CommandError: # Cleanup potential leftover file if os.path.exists(localfile): os.remove(localfile) raise
def end_module(self, module, failed): if failed: self.message('Failed') else: self.message('Succeeded') self.modulefp.write(buildlog_footer) self.modulefp.close() self.modulefp = None self.indexfp.write('</td>\n') if failed: help_html = '' if self.config.help_website and self.config.help_website[1]: try: help_url = self.config.help_website[1] % {'module': module} help_html = ' <a href="%s">(help)</a>' % help_url except TypeError as e: raise FatalError('"help_website" %s' % e) except KeyError as e: raise FatalError(_('%(configuration_variable)s invalid key' ' %(key)s' % \ {'configuration_variable' : '\'help_website\'', 'key' : e})) self.indexfp.write('<td class="failure">failed%s</td>\n' % help_html) else: self.indexfp.write('<td class="success">ok</td>\n') self.indexfp.write('</tr>\n\n') self.indexfp.flush()
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) config.buildscript = 'tinderbox' if options.outputdir is not None: config.tinderbox_outputdir = options.outputdir if not config.tinderbox_outputdir: raise UsageError(_('output directory for tinderbox build not specified')) module_set = jhbuild.moduleset.load(config) full_module_list = module_set.get_full_module_list( args or config.modules, config.skip) module_list = module_set.remove_system_modules(full_module_list) # remove modules up to startat if options.startat: while module_list and module_list[0].name != options.startat: del module_list[0] if not module_list: raise FatalError(_('%s not in module list') % options.startat) if config.check_sysdeps: module_state = module_set.get_module_state(full_module_list) if not self.required_system_dependencies_installed(module_state): self.print_system_dependencies(module_state) raise FatalError(_('Required system dependencies not installed.' ' Install using the command %(cmd)s or to ' 'ignore system dependencies use command-line' ' option %(opt)s' \ % {'cmd' : "'jhbuild sysdeps --install'", 'opt' : '--nodeps'})) build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set) return build.build()
def _download_and_unpack(self, buildscript): localfile = self._local_tarball if not os.path.exists(self.config.tarballdir): try: os.makedirs(self.config.tarballdir) except OSError: raise FatalError( _('tarball dir (%s) can not be created') % self.config.tarballdir) try: self._check_tarball() except BuildStateError: # don't have the tarball, try downloading it and check again self._download_tarball(buildscript, localfile) self._check_tarball() # now to unpack it try: unpack_archive(buildscript, localfile, self.checkoutroot, self.checkoutdir) except CommandError: raise FatalError(_('failed to unpack %s') % localfile) if not os.path.exists(self.srcdir): raise BuildStateError( _('could not unpack tarball (expected %s dir)') % os.path.basename(self.srcdir)) if self.patches: self._do_patches(buildscript)
def execute(self, command, hint=None, cwd=None, extra_env=None): assert self.modulefp, 'not currently building a module' kws = {'close_fds': True} print_args = {} if cwd: print_args['cwd'] = cwd else: print_args['cwd'] = os.getcwd() self.modulefp.write('<pre>') if isinstance(command, (str, unicode)): kws['shell'] = True print_args['command'] = command else: print_args['command'] = ' '.join(command) if self.config.print_command_pattern: try: commandstr = self.config.print_command_pattern % print_args self.modulefp.write('<span class="command">%s</span>\n' % escape(commandstr)) except TypeError, e: raise FatalError('\'print_command_pattern\' %s' % e) except KeyError, e: raise FatalError(_('%(configuration_variable)s invalid key' ' %(key)s' % \ {'configuration_variable' : '\'print_command_pattern\'', 'key' : e}))
def run(self, config, options, args, help=None): module_name = options.in_builddir or options.in_checkoutdir if module_name: module_set = jhbuild.moduleset.load(config) try: module = module_set.get_module(module_name, ignore_case = True) except KeyError as e: raise FatalError(_("A module called '%s' could not be found.") % e) build = jhbuild.frontends.get_buildscript(config, [module], module_set=module_set) if options.in_builddir: workingdir = module.get_builddir(build) else: workingdir = module.get_srcdir(build) try: build.execute(args, cwd=workingdir) except CommandError as exc: if args: raise FatalError(_("Unable to execute the command '%s'") % args[0]) else: raise FatalError(str(exc)) else: try: os.execlp(args[0], *args) except IndexError: raise FatalError(_('No command given')) except OSError as exc: raise FatalError(_("Unable to execute the command '%(command)s': %(err)s") % { 'command':args[0], 'err':str(exc)})
def _download_and_unpack(self, buildscript): localfile = self._local_tarball if not os.path.exists(self.config.tarballdir): try: os.makedirs(self.config.tarballdir) except OSError: raise FatalError( _('tarball dir (%s) can not be created') % self.config.tarballdir) if not os.access(self.config.tarballdir, os.R_OK | os.W_OK | os.X_OK): raise FatalError( _('tarball dir (%s) must be writable') % self.config.tarballdir) try: self._check_tarball() except BuildStateError: # don't have the tarball, try downloading it and check again if has_command('wget'): res = buildscript.execute( ['wget', '--continue', self.module, '-O', localfile], extra_env={ 'LD_LIBRARY_PATH': os.environ.get('UNMANGLED_LD_LIBRARY_PATH'), 'PATH': os.environ.get('UNMANGLED_PATH') }) elif has_command('curl'): res = buildscript.execute( [ 'curl', '--continue-at', '-', '-L', self.module, '-o', localfile ], extra_env={ 'LD_LIBRARY_PATH': os.environ.get('UNMANGLED_LD_LIBRARY_PATH'), 'PATH': os.environ.get('UNMANGLED_PATH') }) else: raise FatalError(_("unable to find wget or curl")) self._check_tarball() # now to unpack it try: unpack_archive(buildscript, localfile, self.checkoutroot, self.checkoutdir) except CommandError: raise FatalError(_('failed to unpack %s') % localfile) if not os.path.exists(self.srcdir): raise BuildStateError( _('could not unpack tarball (expected %s dir)') % os.path.basename(self.srcdir)) if self.patches: self._do_patches(buildscript)
def get_kconfigs(node, repositories, default_repo): id = node.getAttribute('id') kconfigs = [] kconfig = None for childnode in node.childNodes: if childnode.nodeType != childnode.ELEMENT_NODE or childnode.nodeName != 'kconfig': continue if childnode.hasAttribute('repo'): repo_name = childnode.getAttribute('repo') try: repo = repositories[repo_name] except KeyError: raise FatalError( _( 'Repository=%(missing)s not found for kconfig in linux id=%(linux_id)s. Possible repositories are %(possible)s' % { 'missing': repo_name, 'linux_id': id, 'possible': repositories })) else: try: repo = repositories[default_repo] except KeyError: raise FatalError( _( 'Default repository=%(missing)s not found for kconfig in linux id=%(linux_id)s. Possible repositories are %(possible)s' % { 'missing': default_repo, 'linux_id': id, 'possible': repositories })) branch = repo.branch_from_xml(id, childnode, repositories, default_repo) version = childnode.getAttribute('version') if childnode.hasAttribute('config'): path = os.path.join(kconfig.srcdir, childnode.getAttribute('config')) else: path = kconfig.srcdir kconfig = LinuxConfig(version, path, branch) kconfigs.append(kconfig) if not kconfigs: kconfig = LinuxConfig('default', None, None) kconfigs.append(kconfig) return kconfigs
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) if not config.partial_build: raise FatalError(_("Partial build is not enabled; add partial_build = True to ~/.jhbuildrc")) module_set = jhbuild.moduleset.load(config) modules = args or config.modules module_list = module_set.get_module_list(modules, process_sysdeps=False) module_state = module_set.get_system_modules(module_list) have_new_enough = False have_too_old = False print _('System installed packages which are new enough:') for pkg_config,(module, req_version, installed_version, new_enough) in module_state.iteritems(): if (installed_version is not None) and new_enough: have_new_enough = True print (_(" %(pkg)s (required=%(req)s, installed=%(installed)s)" % {'pkg': pkg_config, 'req': req_version, 'installed': installed_version})) if not have_new_enough: print _(' (none)') print _('System installed packages which are too old:') for pkg_config,(module, req_version, installed_version, new_enough) in module_state.iteritems(): if (installed_version is not None) and (not new_enough): have_too_old = True print (_(" %(pkg)s (required=%(req)s, installed=%(installed)s)" % {'pkg': pkg_config, 'req': req_version, 'installed': installed_version})) if not have_too_old: print _(' (none)') print _('No matching system package installed:') uninstalled = [] for pkg_config,(module, req_version, installed_version, new_enough) in module_state.iteritems(): if installed_version is None: print (_(" %(pkg)s (required=%(req)s)") % {'pkg': pkg_config, 'req': req_version}) uninstalled.append(pkg_config) if len(uninstalled) == 0: print _(' (none)') if options.install: installer = SystemInstall.find_best() if installer is None: raise FatalError(_("Don't know how to install packages on this system")) if len(uninstalled) == 0: logging.info(_("No uninstalled system dependencies to install for modules: %r" % (modules, ))) else: logging.info(_("Installing dependencies on system: %s" % (' '.join(uninstalled), ))) installer.install(uninstalled)
def __init__(self, filename=_default_jhbuildrc): self._config = { '__file__': _defaults_file, 'addpath': addpath, 'prependpath': prependpath, 'include': self.include, } if not self._orig_environ: self.__dict__['_orig_environ'] = os.environ.copy() os.environ['UNMANGLED_PATH'] = os.environ.get('PATH', '') try: SRCDIR except NameError: # this happens when an old jhbuild script is called if os.path.realpath(sys.argv[0]) == os.path.expanduser('~/bin/jhbuild'): # if it was installed in ~/bin/, it may be because the new one # is installed in ~/.local/bin/jhbuild if os.path.exists(os.path.expanduser('~/.local/bin/jhbuild')): logging.warning( _('JHBuild start script has been installed in ' '~/.local/bin/jhbuild, you should remove the ' 'old version that is still in ~/bin/ (or make ' 'it a symlink to ~/.local/bin/jhbuild)')) if os.path.exists(os.path.join(sys.path[0], 'jhbuild')): # the old start script inserted its source directory in # sys.path, use it now to set new variables __builtin__.__dict__['SRCDIR'] = sys.path[0] __builtin__.__dict__['PKGDATADIR'] = None __builtin__.__dict__['DATADIR'] = None else: raise FatalError( _('Obsolete JHBuild start script, make sure it is removed ' 'then do run \'make install\'')) # Set defaults for internal variables self._config['_internal_noautogen'] = False env_prepends.clear() try: execfile(_defaults_file, self._config) except: traceback.print_exc() raise FatalError(_('could not load config defaults')) self._config['__file__'] = filename self.filename = filename if not os.path.exists(filename): raise FatalError(_('could not load config file, %s is missing') % filename) self.load() self.setup_env()
def __init__(self, config, module_list=None, module_set=None): if self.__class__ is BuildScript: raise NotImplementedError('BuildScript is an abstract base class') self.modulelist = module_list self.moduleset = module_set self.module_num = 0 self.config = config # the existence of self.config.prefix is checked in config.py if not os.access(self.config.prefix, os.R_OK|os.W_OK|os.X_OK): raise FatalError(_('install prefix (%s) must be writable') % self.config.prefix) if not os.path.exists(self.config.checkoutroot): try: os.makedirs(self.config.checkoutroot) except OSError: raise FatalError( _('checkout root (%s) can not be created') % self.config.checkoutroot) if not os.access(self.config.checkoutroot, os.R_OK|os.W_OK|os.X_OK): raise FatalError(_('checkout root (%s) must be writable') % self.config.checkoutroot) if self.config.copy_dir and not os.path.exists(self.config.copy_dir): try: os.makedirs(self.config.copy_dir) except OSError: raise FatalError( _('checkout copy dir (%s) can not be created') % self.config.copy_dir) if not os.access(self.config.copy_dir, os.R_OK|os.W_OK|os.X_OK): raise FatalError(_('checkout copy dir (%s) must be writable') % self.config.copy_dir) self.subprocess_nice_args = [] if config.nice_build: chrt_args = ['chrt', '--idle', '0'] devnull = open(os.devnull, 'w') if (cmds.has_command('chrt') and subprocess.call(chrt_args + ['true'], stdout=devnull, stderr=devnull) == 0): self.subprocess_nice_args.extend(chrt_args) elif cmds.has_command('nice'): self.subprocess_nice_args.append('nice') ionice_args = ['ionice', '-c', '3', '-t'] if cmds.has_command('ionice'): subproc = subprocess.Popen(ionice_args + ['true'], stdout=devnull, stderr=subprocess.PIPE) stderr_val = subproc.communicate()[1] if subproc.returncode == 0 and len(stderr_val) == 0: self.subprocess_nice_args.extend(ionice_args)
def _checkout(self, buildscript, copydir=None): from . import svn if self.config.sticky_date: raise FatalError(_('date based checkout not yet supported\n')) cmd = ['git', 'svn', 'clone', self.module] if self.checkoutdir: cmd.append(self.checkoutdir) # FIXME (add self.revision support) try: last_revision = svn.get_info(self.module)['last changed rev'] if not self.revision: cmd.extend(['-r', last_revision]) except KeyError: raise FatalError( _('Cannot get last revision from %s. Check the module location.' ) % self.module) if copydir: buildscript.execute(cmd, cwd=copydir, extra_env=get_git_extra_env()) else: buildscript.execute(cmd, cwd=self.config.checkoutroot, extra_env=get_git_extra_env()) try: # is known to fail on some versions cmd = ['git', 'svn', 'show-ignore'] s = get_output(cmd, cwd=self.get_checkoutdir(copydir), extra_env=get_git_extra_env()) fd = open( os.path.join(self.get_checkoutdir(copydir), '.git/info/exclude'), 'a') fd.write(s) fd.close() buildscript.execute(cmd, cwd=self.get_checkoutdir(copydir), extra_env=get_git_extra_env()) except (CommandError, EnvironmentError): pass # FIXME, git-svn should support externals self._get_externals(buildscript, self.branch)
def run(self, config, options, args, help=None): for item in options.skip: config.skip += item.split(',') module_set = jhbuild.moduleset.load(config) module_list = module_set.get_module_list(args or config.modules, config.skip) # remove modules up to startat if options.startat: while module_list and module_list[0].name != options.startat: del module_list[0] if not module_list: raise FatalError(_('%s not in module list') % options.startat) # remove modules that are not marked as installed packagedb = module_set.packagedb for module in module_list[:]: if not packagedb.check(module.name): module_list.remove(module) config.nopoison = True build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set) return build.build(phases=['clean'])
def stop(self, config, pidfile): try: pid = int(file(pidfile).read()) except: raise FatalError(_('failed to get buildbot PID')) os.kill(pid, signal.SIGTERM)
def include(self, filename): '''Read configuration variables from a file.''' try: execfile(filename, self._config) except: traceback.print_exc() raise FatalError(_('Could not include config file (%s)') % filename)
def _update(self, buildscript): if self.config.sticky_date: raise FatalError(_('date based checkout not yet supported\n')) buildscript.execute( ['darcs', 'pull', '-a', '--no-set-default', self.module], 'darcs', cwd=self.srcdir)
def run(self, config, options, args, help=None): if options.honour_config is False: config.makeclean = True module_set = jhbuild.moduleset.load(config) try: module_list = [ module_set.get_module(modname, ignore_case=True) for modname in args ] except KeyError as e: raise FatalError(_("A module called '%s' could not be found.") % e) if not module_list: self.parser.error(_('This command requires a module parameter.')) if not config.makeclean: logging.info( _('clean command called while makeclean is set to False, skipped.' )) return 0 build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set) if options.distclean: clean_phase = 'distclean' else: clean_phase = 'clean' return build.build(phases=[clean_phase])
def run(self, config, options, args, help=None): for item in options.skip: config.skip += item.split(',') config.ignore_conditions = options.ignore_conditions module_set = jhbuild.moduleset.load(config) config.ignore_conditions = False module_list = module_set.get_module_list(args or config.modules, config.skip) # remove modules up to startat if options.startat: while module_list and module_list[0].name != options.startat: del module_list[0] if not module_list: raise FatalError(_('%s not in module list') % options.startat) config.compress = options.compress config.nonet = options.nonet build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set) build.config.build_policy = "all" if options.dist_only: return build.build(phases=['dist']) else: return build.build(targets=['dist'])
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) module_set = jhbuild.moduleset.load(config) module_list = [] default_repo = jhbuild.moduleset.get_default_repo() for modname in args: try: module = module_set.get_module(modname, ignore_case=True) except KeyError: if not default_repo: raise FatalError( _('unknown module %s and no default repository to try an automatic module' ) % modname) logging.info(_('module "%(modname)s" does not exist, created automatically using repository "%(reponame)s"') % \ {'modname': modname, 'reponame': default_repo.name}) module = AutogenModule(modname, default_repo.branch(modname)) module.config = config module_list.append(module) if not module_list: self.parser.error(_('This command requires a module parameter.')) # remove modules that are not marked as installed packagedb = module_set.packagedb for module in module_list[:]: if not packagedb.check(module.name): logging.warn( _('Module %(mod)r is not installed') % {'mod': module.name}) module_list.remove(module) else: packagedb.uninstall(module.name)
def branch(self, name, version, module=None, checkoutdir=None, size=None, md5sum=None, hash=None, branch_id=None, source_subdir=None): if name in self.config.branches: module = self.config.branches[name] if not module: raise FatalError( _('branch for %s has wrong override, check your .jhbuildrc' ) % name) else: if module is None: module = name module = urlparse.urljoin(self.href, module) if size is not None: size = int(size) if md5sum and (not hash or hashlib.__name__ == 'md5'): hash = 'md5:' + md5sum return TarballBranch(self, module=module, version=version, checkoutdir=checkoutdir, source_size=size, source_hash=hash, branch_id=branch_id, source_subdir=source_subdir)
def run(self, config, options, args, help=None): module_set = jhbuild.moduleset.load(config) packagedb = module_set.packagedb if args: # module names present all_installed = True for modname in args: try: module = module_set.get_module(modname, ignore_case=True) except KeyError: raise FatalError(_('unknown module %s') % modname) package_entry = packagedb.get(module.name) installed = package_entry is not None all_installed = all_installed and installed if (options.installed and installed) or not options.installed: self.show_info(module, packagedb, module_set) if options.installed and not all_installed: return 1 else: # no module names given for module in module_set.modules.values(): package_entry = packagedb.get(module.name) if options.installed: if package_entry is not None: self.show_info(module, packagedb, module_set) else: # no installed option selected, simply show all modules self.show_info(module, packagedb, module_set)
def branch(self, name, version, module=None, checkoutdir=None, size=None, md5sum=None, hash=None, branch_id=None, source_subdir=None): if name in self.config.branches: module = self.config.branches[name] if not module: raise FatalError(_('branch for %(name)s has wrong override, check your %(filename)s') % \ {'name' : name, 'filename' : self.config.filename}) else: if module is None: module = name module = urlparse.urljoin(self.href, module) module = module.replace('${version}', version) if checkoutdir is not None: checkoutdir = checkoutdir.replace('${version}', version) if size is not None: size = int(size) if md5sum and (not hash or hashlib.__name__ == 'md5'): hash = 'md5:' + md5sum return TarballBranch(self, module=module, version=version, checkoutdir=checkoutdir, source_size=size, source_hash=hash, branch_id=branch_id, source_subdir=source_subdir)
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) config.buildscript = 'tinderbox' if options.outputdir is not None: config.tinderbox_outputdir = options.outputdir if not config.tinderbox_outputdir: raise UsageError( _('output directory for tinderbox build not specified')) module_set = jhbuild.moduleset.load(config) module_list = module_set.get_module_list(args or config.modules, config.skip) # remove modules up to startat if options.startat: while module_list and module_list[0].name != options.startat: del module_list[0] if not module_list: raise FatalError(_('%s not in module list') % options.startat) build = jhbuild.frontends.get_buildscript(config, module_list, module_set=module_set) return build.build()
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) module_set = jhbuild.moduleset.load(config) if options.startat and options.list_all_modules: raise UsageError( _('Conflicting options specified (\'--start-at\' and \'--all-modules\')' )) if options.list_all_modules: module_list = module_set.modules.values() else: module_list = module_set.get_module_list \ (args or config.modules, config.skip, tags=config.tags, include_suggests= not config.ignore_suggests, include_afters=options.list_optional_modules) # remove modules up to startat if options.startat: while module_list and module_list[0].name != options.startat: del module_list[0] if not module_list: raise FatalError(_('%s not in module list') % options.startat) for mod in module_list: if options.show_rev: rev = mod.get_revision() if rev: uprint('%s (%s)' % (mod.name, rev)) else: uprint(mod.name) else: uprint(mod.name)
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) if not config.quiet_mode: check_bootstrap_updateness(config) module_set = jhbuild.moduleset.load(config) modules = args or config.modules module_list = module_set.get_module_list( modules, config.skip, tags=config.tags, include_optional_modules=options.build_optional_modules, ignore_suggests=config.ignore_suggests) # remove modules up to startat if options.startat: while module_list and module_list[0].name != options.startat: del module_list[0] if not module_list: raise FatalError(_('%s not in module list') % options.startat) if len(module_list) == 0 and modules[0] in (config.skip or []): logging.info( _('requested module is in the ignore list, nothing to do.')) return 0 build = jhbuild.frontends.get_buildscript(config, module_list) return build.build()
def reload_server_config(self, config, pidfile): try: pid = int(file(pidfile).read()) except: raise FatalError(_('failed to get buildbot PID')) os.kill(pid, signal.SIGHUP)
def run(self, config, options, args, help=None): config.set_from_cmdline_options(options) module_set = jhbuild.moduleset.load(config) try: module_list = [module_set.get_module(modname, ignore_case = True) for modname in args] except KeyError, e: raise FatalError(_("A module called '%s' could not be found.") % e)
def get_branch(node, repositories, default_repo, config): """Scan for a <branch> element and create a corresponding Branch object.""" name = node.getAttribute('id') childnode = find_first_child_node(node, 'branch') if childnode is None: raise FatalError(_('no <branch> element found for %s') % name) # look up the repository for this branch ... if childnode.hasAttribute('repo'): try: repo = repositories[childnode.getAttribute('repo')] except KeyError: repo_names = ', '.join([r.name for r in repositories.values()]) raise UndefinedRepositoryError( _('Repository=%(missing)s not found for module id=%(module)s. Possible repositories are %(possible)s' % {'missing': childnode.getAttribute('repo'), 'module': name, 'possible': repo_names})) elif default_repo: repo = repositories[default_repo] else: raise UndefinedRepositoryError( _('No repository for module id=%(module)s. Either set branch/repo or default repository.' % {'module': name})) if repo.mirrors: mirror_type = config.mirror_policy if name in config.module_mirror_policy: mirror_type = config.module_mirror_policy[name] if mirror_type in repo.mirrors: repo = repo.mirrors[mirror_type] return repo.branch_from_xml(name, childnode, repositories, default_repo)
def _local_tarball(self): basename = os.path.basename(self.module) if not basename: raise FatalError( _('URL has no filename component: %s') % self.module) localfile = os.path.join(self.config.tarballdir, basename) return localfile