Beispiel #1
0
    def __init__(self, config = None, db=None):
        self.config = config
        self.modules = {}

        if db is None:
            legacy_pkgdb_path = os.path.join(self.config.prefix, 'share', 'jhbuild', 'packagedb.xml')
            new_pkgdb_path = os.path.join(self.config.top_builddir, 'packagedb.xml')
            if os.path.isfile(legacy_pkgdb_path):
                os.rename(legacy_pkgdb_path, new_pkgdb_path)
            self.packagedb = packagedb.PackageDB(new_pkgdb_path, config)
        else:
            self.packagedb = db
Beispiel #2
0
    def __init__(self, config, module_list):
        if self.__class__ is BuildScript:
            raise NotImplementedError('BuildScript is an abstract base class')

        self.modulelist = module_list
        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)

        packagedbdir = os.path.join(self.config.prefix, 'share', 'jhbuild')
        try:
            if not os.path.isdir(packagedbdir):
                os.makedirs(packagedbdir)
        except OSError:
            raise FatalError(_('could not create directory %s') % packagedbdir)
        self.packagedb = packagedb.PackageDB(
            os.path.join(packagedbdir, 'packagedb.xml'))