def run(self, config, options, args, help=None): if args: raise UsageError(_('no extra arguments expected')) # check whether the checkout root and install prefix are writable if not (os.path.isdir(config.checkoutroot) and os.access( config.checkoutroot, os.R_OK | os.W_OK | os.X_OK)): uprint( _('checkout root (%s) is not writable') % config.checkoutroot) if not (os.path.isdir(config.prefix) and os.access(config.prefix, os.R_OK | os.W_OK | os.X_OK)): uprint(_('install prefix (%s) is not writable') % config.prefix) # check whether various tools are installed if not check_version(['libtoolize', '--version'], r'libtoolize \([^)]*\) ([\d.]+)', '1.5'): uprint(_('%s not found') % 'libtool >= 1.5') if not check_version(['gettext', '--version'], r'gettext \([^)]*\) ([\d.]+)', '0.10.40'): uprint(_('%s not found') % 'gettext >= 0.10.40') if not check_version(['pkg-config', '--version'], r'^([\d.]+)', '0.14.0'): uprint(_('%s not found') % 'pkg-config >= 0.14.0') if not check_version(['autoconf', '--version'], r'autoconf \([^)]*\) ([\d.]+)', '2.53'): uprint(_('%s not found') % 'autoconf >= 2.53') if not check_version(['automake', '--version'], r'automake \([^)]*\) ([\d.]+)', '1.10'): uprint(_('%s not found') % 'automake >= 1.10') try: not_in_path = [] path = get_aclocal_path() macros = ['libtool.m4', 'gettext.m4', 'pkg.m4'] for macro in macros: if not inpath(macro, path): uprint( _("aclocal can't see %s macros") % (macro.split('.m4')[0])) if not_in_path.count(macro) == 0: not_in_path.append(macro) if len(not_in_path) > 0: uprint( _("Please copy the lacking macros (%s) in one of the following paths: %s" % (', '.join(not_in_path), ', '.join(path)))) except CommandError, exc: uprint(str(exc))
def run(self, config, options, args, help=None): if args: raise UsageError(_('no extra arguments expected')) # check whether the checkout root and install prefix are writable if not (os.path.isdir(config.checkoutroot) and os.access(config.checkoutroot, os.R_OK|os.W_OK|os.X_OK)): uprint(_('checkout root (%s) is not writable') % config.checkoutroot) if not (os.path.isdir(config.prefix) and os.access(config.prefix, os.R_OK|os.W_OK|os.X_OK)): uprint(_('install prefix (%s) is not writable') % config.prefix) # check whether various tools are installed if not check_version(['libtoolize', '--version'], r'libtoolize \([^)]*\) ([\d.]+)', '1.5'): uprint(_('%s not found') % 'libtool >= 1.5') if not check_version(['gettext', '--version'], r'gettext \([^)]*\) ([\d.]+)', '0.10.40'): uprint(_('%s not found') % 'gettext >= 0.10.40') if not check_version(['pkg-config', '--version'], r'^([\d.]+)', '0.14.0'): uprint(_('%s not found') % 'pkg-config >= 0.14.0') if not check_version(['autoconf', '--version'], r'autoconf \([^)]*\) ([\d.]+)', '2.53'): uprint(_('%s not found') % 'autoconf >= 2.53') if not check_version(['automake', '--version'], r'automake \([^)]*\) ([\d.]+)', '1.10'): uprint(_('%s not found') % 'automake >= 1.10') try: not_in_path = [] path = get_aclocal_path() macros = ['libtool.m4', 'gettext.m4', 'pkg.m4'] for macro in macros: if not inpath (macro, path): uprint(_("aclocal can't see %s macros") % (macro.split('.m4')[0])) if not_in_path.count(macro) == 0: not_in_path.append(macro) if len(not_in_path) > 0: uprint(_("Please copy the lacking macros (%(macros)s) in one of the following paths: %(path)s") % \ {'macros': ', '.join(not_in_path), 'path': ', '.join(path)}) except CommandError, exc: uprint(str(exc))
def _update(self, buildscript, copydir=None): opt = [] if copydir: outputdir = os.path.join(copydir, os.path.basename(self.srcdir)) else: outputdir = self.srcdir opt = [] if not self.config.interact: opt.append('--non-interactive') if self.revision and self.revision.isdigit(): opt.extend(['-r', '%s' % self.revision]) elif self.config.sticky_date: opt.extend(['-r', '{%s}' % self.config.sticky_date]) # Subversion 1.5 has interactive behaviour on conflicts; check version # and add appropriate flags to get back 1.4 behaviour. global svn_one_five if svn_one_five is None: svn_one_five = check_version(['svn', '--version'], r'svn, version ([\d.]+)', '1.5', extra_env=get_svn_extra_env()) if svn_one_five is True: opt.extend(['--accept', 'postpone']) uri = get_uri(outputdir) if urlparse.urlparse(uri)[:2] != urlparse.urlparse(self.module)[:2]: # server and protocol changed, probably because user changed # svnroots[] config variable. new_uri = urlparse.urlunparse( urlparse.urlparse(self.module)[:2] + urlparse.urlparse(uri)[2:]) cmd = ['svn', 'switch', '--relocate', uri, new_uri, '.'] buildscript.execute(cmd, 'svn', cwd=outputdir, extra_env=get_svn_extra_env()) # if the URI doesn't match, use "svn switch" instead of "svn update" if get_uri(outputdir) != self.module: cmd = ['svn', 'switch'] + opt + [self.module] else: cmd = ['svn', 'update'] + opt + ['.'] buildscript.execute(cmd, 'svn', cwd=outputdir, extra_env=get_svn_extra_env()) try: self._check_for_conflicts() except CommandError: # execute svn status so conflicts are displayed buildscript.execute(['svn', 'status'], 'svn', cwd=self.srcdir, extra_env=get_svn_extra_env()) raise
def run(self, config, options, args, help=None): if sys.platform.startswith('win'): config.moduleset = 'windows-bootstrap' else: config.moduleset = 'bootstrap' # load the bootstrap module set if not args: args = ['meta-bootstrap'] for item in options.skip: config.skip += item.split(',') options.skip = [] ignored_modules = [] if not options.ignore_system: # restore system PATH to check for system-installed programs path = os.environ.get('PATH') os.environ['PATH'] = path.replace( os.path.join(config.prefix, 'bin'), '') module_set = jhbuild.moduleset.load(config) modules = args or config.modules module_list = module_set.get_module_list(modules) for module in module_list: if module.type == 'meta': continue for version_regex in (r'.*?[ \(]([\d.]+)', r'^([\d.]+)'): if check_version([module.name, '--version'], version_regex, module.branch.version): ignored_modules.append(module.name) break os.environ['PATH'] = path config.skip.extend(ignored_modules) # cancel the bootstrap updateness check as it has no sense (it *is* # running bootstrap right now) jhbuild.commands.base.check_bootstrap_updateness = lambda x: x rc = cmd_build.run(self, config, options, args) if ignored_modules: logging.info( _('some modules (%s) were automatically ignored as a ' 'sufficient enough version was found installed on ' 'your system. Use --ignore-system if you want to build ' 'them nevertheless.' % ', '.join(ignored_modules))) return rc
def run(self, config, options, args, help=None): config.moduleset = "bootstrap" # load the bootstrap module set if not args: args = ["meta-bootstrap"] for item in options.skip: config.skip += item.split(",") options.skip = [] ignored_modules = [] if not options.ignore_system: # restore system PATH to check for system-installed programs path = os.environ.get("PATH") os.environ["PATH"] = path.replace(os.path.join(config.prefix, "bin"), "") module_set = jhbuild.moduleset.load(config) modules = args or config.modules module_list = module_set.get_module_list(modules) for module in module_list: if module.type == "meta": continue for version_regex in (r".*?[ \(]([\d.]+)", r"^([\d.]+)"): if check_version([module.name, "--version"], version_regex, module.branch.version): ignored_modules.append(module.name) break os.environ["PATH"] = path config.skip.extend(ignored_modules) # cancel the bootstrap updateness check as it has no sense (it *is* # running bootstrap right now) jhbuild.commands.base.check_bootstrap_updateness = lambda x: x rc = cmd_build.run(self, config, options, args) if ignored_modules: logging.info( _( "some modules (%s) were automatically ignored as a " "sufficient enough version was found installed on " "your system. Use --ignore-system if you want to build " "them nevertheless." % ", ".join(ignored_modules) ) ) return rc
class cmd_sanitycheck(Command): doc = N_('Check that required support tools are available') name = 'sanitycheck' usage_args = '' def run(self, config, options, args, help=None): if args: raise UsageError(_('no extra arguments expected')) # check whether the checkout root and install prefix are writable if not (os.path.isdir(config.checkoutroot) and os.access( config.checkoutroot, os.R_OK | os.W_OK | os.X_OK)): uprint( _('checkout root (%s) is not writable') % config.checkoutroot) if not (os.path.isdir(config.prefix) and os.access(config.prefix, os.R_OK | os.W_OK | os.X_OK)): uprint(_('install prefix (%s) is not writable') % config.prefix) # check whether various tools are installed if not check_version(['libtoolize', '--version'], r'libtoolize \([^)]*\) ([\d.]+)', '1.5'): uprint(_('%s not found') % 'libtool >= 1.5') if not check_version(['gettext', '--version'], r'gettext \([^)]*\) ([\d.]+)', '0.10.40'): uprint(_('%s not found') % 'gettext >= 0.10.40') if not check_version(['pkg-config', '--version'], r'^([\d.]+)', '0.14.0'): uprint(_('%s not found') % 'pkg-config >= 0.14.0') if not check_version(['autoconf', '--version'], r'autoconf \([^)]*\) ([\d.]+)', '2.53'): uprint(_('%s not found') % 'autoconf >= 2.53') if not check_version(['automake', '--version'], r'automake \([^)]*\) ([\d.]+)', '1.10'): uprint(_('%s not found') % 'automake >= 1.10') try: not_in_path = [] path = get_aclocal_path() macros = ['libtool.m4', 'gettext.m4', 'pkg.m4'] for macro in macros: if not inpath(macro, path): uprint( _("aclocal can't see %s macros") % (macro.split('.m4')[0])) if not_in_path.count(macro) == 0: not_in_path.append(macro) if len(not_in_path) > 0: uprint(_("Please copy the lacking macros (%(macros)s) in one of the following paths: %(path)s") % \ {'macros': ', '.join(not_in_path), 'path': ', '.join(path)}) except CommandError, exc: uprint(str(exc)) # XML catalog sanity checks if not os.access('/etc/xml/catalog', os.R_OK): uprint(_('Could not find XML catalog')) else: for (item, name) in [ ('-//OASIS//DTD DocBook XML V4.1.2//EN', 'DocBook XML DTD V4.1.2'), ('http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl', 'DocBook XSL Stylesheets') ]: try: data = get_output(['xmlcatalog', '/etc/xml/catalog', item]) except: uprint(_('Could not find %s in XML catalog') % name) # Perl modules used by tools such as intltool: for perlmod in ['XML::Parser']: try: get_output(['perl', '-M%s' % perlmod, '-e', 'exit']) except: uprint(_('Could not find the perl module %s') % perlmod) # check for cvs: if not inpath('cvs', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'cvs') # check for svn: if not inpath('svn', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'svn') if not (inpath('curl', os.environ['PATH'].split(os.pathsep)) or inpath('wget', os.environ['PATH'].split(os.pathsep))): uprint(_('curl or wget not found')) # check for git: if not inpath('git', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'git') else: try: git_help = os.popen('git --help', 'r').read() if not 'clone' in git_help: uprint(_('Installed git program is not the right git')) else: if not check_version(['git', '--version'], r'git version ([\d.]+)', '1.5.6'): uprint(_('%s not found') % 'git >= 1.5.6') except: uprint(_('Could not check git program')) # check for flex/bison: if not inpath('flex', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'flex') if not inpath('bison', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'bison') if not inpath('xzcat', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'xzcat')
def run(self, config, options, args, help=None): if args: raise UsageError(_('no extra arguments expected')) # try creating jhbuild directories before checking they are accessible. try: os.makedirs(config.checkoutroot) os.makedirs(config.prefix) except OSError: pass # check whether the checkout root and install prefix are writable if not (os.path.isdir(config.checkoutroot) and os.access( config.checkoutroot, os.R_OK | os.W_OK | os.X_OK)): uprint( _('checkout root (%s) is not writable') % config.checkoutroot) if not (os.path.isdir(config.prefix) and os.access(config.prefix, os.R_OK | os.W_OK | os.X_OK)): uprint(_('install prefix (%s) is not writable') % config.prefix) autoconf = True # check whether various tools are installed if not check_version(['libtoolize', '--version'], r'libtoolize \([^)]*\) ([\d.]+)', '1.5'): uprint(_('%s not found') % 'libtool >= 1.5') if not check_version(['gettext', '--version'], r'gettext \([^)]*\) ([\d.]+)', '0.10.40'): uprint(_('%s not found') % 'gettext >= 0.10.40') if not check_version(['pkg-config', '--version'], r'^([\d.]+)', '0.14.0'): uprint(_('%s not found') % 'pkg-config >= 0.14.0') if not check_version(['autoconf', '--version'], r'autoconf \([^)]*\) ([\d.]+)', '2.53'): autoconf = False uprint(_('%s not found') % 'autoconf >= 2.53') if not check_version(['automake', '--version'], r'automake \([^)]*\) ([\d.]+)', '1.10'): uprint(_('%s not found') % 'automake >= 1.10') if (autoconf): self.check_m4() # XML catalog sanity checks xmlcatalog = True try: get_output(['which', 'xmlcatalog']) except: xmlcatalog = False uprint( _('Could not find XML catalog (usually part of the package \'libxml2-utils\')' )) if (xmlcatalog): for (item, name) in [ ('-//OASIS//DTD DocBook XML V4.1.2//EN', 'DocBook XML DTD V4.1.2'), ('http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl', 'DocBook XSL Stylesheets') ]: try: data = get_output(['xmlcatalog', '/etc/xml/catalog', item]) except: uprint( _('Could not find %s in XML catalog (usually part of package \'docbook-xsl\')' ) % name) # Perl module used by tools such as intltool: perlmod = 'XML::Parser' try: get_output(['perl', '-M%s' % perlmod, '-e', 'exit']) except: uprint( _('Could not find the Perl module %s (usually part of package \'libxml-parser-perl\' or \'perl-XML-Parser\')' ) % perlmod) # check for a downloading util: if not (inpath('curl', os.environ['PATH'].split(os.pathsep)) or inpath('wget', os.environ['PATH'].split(os.pathsep))): uprint(_('curl or wget not found')) # check for git: if not inpath('git', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'git') else: try: git_help = os.popen('git --help', 'r').read() if not 'clone' in git_help: uprint(_('Installed git program is not the right git')) else: if not check_version(['git', '--version'], r'git version ([\d.]+)', '1.5.6'): uprint(_('%s not found') % 'git >= 1.5.6') except: uprint(_('Could not check git program')) # check for flex/bison: if not inpath('flex', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'flex') if not inpath('bison', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'bison') if not inpath('xzcat', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'xzcat')
def run(self, config, options, args, help=None): if args: raise UsageError(_('no extra arguments expected')) # try creating jhbuild directories before checking they are accessible. try: os.makedirs(config.checkoutroot) os.makedirs(config.prefix) except OSError: pass # check whether the checkout root and install prefix are writable if not (os.path.isdir(config.checkoutroot) and os.access(config.checkoutroot, os.R_OK|os.W_OK|os.X_OK)): uprint(_('checkout root (%s) is not writable') % config.checkoutroot) if not (os.path.isdir(config.prefix) and os.access(config.prefix, os.R_OK|os.W_OK|os.X_OK)): uprint(_('install prefix (%s) is not writable') % config.prefix) autoconf = True # check whether various tools are installed if not check_version(['libtoolize', '--version'], r'libtoolize \([^)]*\) ([\d.]+)', '1.5'): uprint(_('%s not found') % 'libtool >= 1.5') if not check_version(['gettext', '--version'], r'gettext \([^)]*\) ([\d.]+)', '0.10.40'): uprint(_('%s not found') % 'gettext >= 0.10.40') if not check_version(['pkg-config', '--version'], r'^([\d.]+)', '0.14.0'): uprint(_('%s not found') % 'pkg-config >= 0.14.0') if not check_version(['autoconf', '--version'], r'autoconf \([^)]*\) ([\d.]+)', '2.53'): autoconf = False uprint(_('%s not found') % 'autoconf >= 2.53') if not check_version(['automake', '--version'], r'automake \([^)]*\) ([\d.]+)', '1.10'): uprint(_('%s not found') % 'automake >= 1.10') if (autoconf): self.check_m4() # XML catalog sanity checks xmlcatalog = True try: get_output(['which', 'xmlcatalog']) except: xmlcatalog = False uprint(_('Could not find XML catalog (usually part of the package \'libxml2-utils\')')) if (xmlcatalog): for (item, name) in [('-//OASIS//DTD DocBook XML V4.1.2//EN', 'DocBook XML DTD V4.1.2'), ('http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl', 'DocBook XSL Stylesheets')]: try: data = get_output(['xmlcatalog', '/etc/xml/catalog', item]) except: uprint(_('Could not find %s in XML catalog (usually part of package \'docbook-xsl\')') % name) # Perl module used by tools such as intltool: perlmod = 'XML::Parser' try: get_output(['perl', '-M%s' % perlmod, '-e', 'exit']) except: uprint(_('Could not find the Perl module %s (usually part of package \'libxml-parser-perl\' or \'perl-XML-Parser\')') % perlmod) # check for cvs: if not inpath('cvs', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'cvs') # check for svn: if not inpath('svn', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found (usually part of the package \'subversion\')') % 'svn') if not (inpath('curl', os.environ['PATH'].split(os.pathsep)) or inpath('wget', os.environ['PATH'].split(os.pathsep))): uprint(_('curl or wget not found')) # check for git: if not inpath('git', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'git') else: try: git_help = os.popen('git --help', 'r').read() if not 'clone' in git_help: uprint(_('Installed git program is not the right git')) else: if not check_version(['git', '--version'], r'git version ([\d.]+)', '1.5.6'): uprint(_('%s not found') % 'git >= 1.5.6') except: uprint(_('Could not check git program')) # check for flex/bison: if not inpath('flex', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'flex') if not inpath('bison', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'bison') if not inpath('xzcat', os.environ['PATH'].split(os.pathsep)): uprint(_('%s not found') % 'xzcat')
def check_version_git(self, version_spec): return check_version(['git', '--version'], r'git version ([\d.]+)', version_spec, extra_env=get_git_extra_env())