# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import jhbuild.commands.base as jcommands #from jhbuild.commands.gui import cmd_gui as _cmd_gui from jhbuild.commands.info import cmd_info as _cmd_info from jhbuild.commands.bootstrap import cmd_bootstrap as _cmd_bootstrap from ossbuild.commands import register_command class cmd_update(jcommands.cmd_update): pass register_command(cmd_update) class cmd_updateone(jcommands.cmd_updateone): pass register_command(cmd_updateone) class cmd_cleanone(jcommands.cmd_cleanone): pass register_command(cmd_cleanone) class cmd_build(jcommands.cmd_build): pass register_command(cmd_build) class cmd_buildone(jcommands.cmd_buildone): pass
def run(self, config, options, args, help=None): moduleset = options.moduleset or config.moduleset modulesets_dir = options.modulesets_dir or config.modulesets_dir if moduleset is None: raise FatalError(_("You must specify a moduleset as an option " "if it's not specified in the configuration")) if modulesets_dir is None: raise FatalError(_("You must specify a modulesets dir as an option " "if it's not specified in the configuration")) if not os.path.isdir(modulesets_dir): raise FatalError(_("The modulesets path doesn't exists")) moduleset_path = os.path.join(modulesets_dir, '%s.modules' % moduleset) self._find_repos_and_modules(modulesets_dir, moduleset) self._write_moduleset(moduleset_path) @staticmethod def update(config): options = DummyOptions() cmd = cmd_update_moduleset() cmd.run(config, options, None) class DummyOptions(object): moduleset = None modulesets_dir = None register_command(cmd_update_moduleset)
from jhbuild.commands import Command from jhbuild.errors import FatalError from jhbuild.utils.subprocess_win32 import real_subprocess from ossbuild.commands import register_command MSYS_PACKAGES = ['msys-cvs', 'msys-patch', 'msys-wget'] class cmd_setup(Command): doc = N_('Setup the build system') name = 'setup' def __init__(self): Command.__init__(self, []) def command(self, command, raise_error=False): try: real_subprocess.call(shlex.split(command)) except Exception, e: raise e if raise_error: raise def run(self, config, options, args, help=None): for pkg in MSYS_PACKAGES: self.command('mingw-get install %s' % pkg) self.command('ossbuild bootstrap') register_command(cmd_setup)
if self.type == TARBALL_TYPE: return template % dict(package=self.package, version=self.version, url=self.url, md5sum=self.md5sum, deps=self.deps) if self.type == AUTOTOOLS_TYPE: return template % dict(pacakge=self.package, version=self.version, repo=self.repo, module=self.module, deps=self.deps) def _write_template(self, template): path = os.path.join(self.modulesets_dir, "%s.modules" % self.package) if os.path.exists(path): raise FatalError(_('The module file aready exists, edit it ' 'manually(%s)') % path) try: f = open(path, 'w+') f.write(HEADER) f.write(template) f.write("</moduleset>") f.close() except IOError, e: raise FatalError(_('Error creating module: %s') % e) def run(self, config, options, args, help=None): if len(args) != 1: self.parser.error(_('This command requires a module parameter.')) self.package = args[0] self._parse_options(options, config) self._write_template(self._fill_template()) register_command(cmd_add_module)