Пример #1
0
    def __init__(self, package, instruction, **kwargs):
        # package and instruction are required.
        # Others can be None
        self.package = package
        self.instruction = instruction
        self.dependencies = kwargs.get("dependencies", None)
        self.options = kwargs.get("options", None)
        self.conditional_versions = kwargs.get("conditional_versions", None)
        self.conflicts = kwargs.get("conflicts", None)
        self.inline_option_targets = kwargs.get("inline_option_targets", None)

        # Internal variables
        self.repodb = api.RepositoryDB()
        self.instdb = api.InstallDB()
        self.download_plan = []
        self.extract_plan = []
        self.urls = []
        self.internals = internals.InternalFunctions()
        self.internals.env.raw.update({
            "get": self.internals.get,
            "cmd_options": [],
            "options": []
        })
        self.config = conf.LPMSConfig()
        if self.instruction.unset_env_variables is not None:
            utils.set_environment_variables()
        self.revisioned = False
        self.revision = None
Пример #2
0
 def __init__(self, environment):
     self.symlinks = []
     self.backup = []
     self.environment = environment
     self.instdb = api.InstallDB()
     self.repodb = api.RepositoryDB()
     self.conf = conf.LPMSConfig()
     self.info_files = []
     self.previous_files = []
     self.filesdb = api.FilesDB()
     self.file_relationsdb = api.FileRelationsDB()
     self.reverse_dependsdb = api.ReverseDependsDB()
     self.binary_filetypes = ('application/x-executable', 'application/x-archive', \
             'application/x-sharedlib')
     self.merge_conf_file = os.path.join(self.environment.real_root, \
             cst.merge_conf_file)
     self.previous_files = self.filesdb.get_paths_by_package(self.environment.name, \
             repo=self.environment.repo, category=self.environment.category, \
             version=self.environment.previous_version)
     # Unfortunately, this seems very ugly :(
     self.strip_debug_symbols = True if self.environment.no_strip is not None and \
             ((self.environment.applied_options is not None and \
             "debug" in self.env.applied_options) or \
             utils.check_cflags("-g") or utils.check_cflags("-ggdb") \
             or utils.check_cflags("-g3")) else False
Пример #3
0
    def __init__(self, package, installdb=False):
        self.package = package
        self.repo = None
        self.category = None
        self.name = None
        self.version = None
        self.slot = None
        self.conf = conf.LPMSConfig()
        self.custom_arch_request = {}
        self.locked_packages = []
        if not installdb:
            self.database = dbapi.RepositoryDB()
            arch_file = os.path.join(cst.user_dir, "arch")
            if os.path.isfile(arch_file):
                with open(arch_file) as lines:
                    for line in lines.readlines():
                        if not line.strip():
                            continue
                        self.custom_arch_request.update(utils.ParseArchFile(line.strip(), \
                                self.database).parse())

            lock_file = os.path.join(cst.user_dir, "lock")
            if os.path.isfile(lock_file):
                with open(lock_file) as lines:
                    for line in lines.readlines():
                        if not line.strip():
                            continue
                        self.locked_packages.extend(utils.ParseUserDefinedFile(line.strip(), \
                                self.database).parse())
        else:
            self.database = dbapi.InstallDB()
Пример #4
0
 def __init__(self, params):
     self.instdb = api.InstallDB()
     self.repodb = api.RepositoryDB()
     self.params = params
     self.repo = None
     self.category = None
     self.name = None
     self.version = None
Пример #5
0
    def __init__(self, packages,
            command_line_options=[],
            custom_options={},
            use_new_options=False):
        self.packages = packages
        self.command_line_options = command_line_options
        self.custom_options = custom_options
        self.use_new_options = use_new_options
        self.conflicts = {}
        self.current_package = None
        self.parent_package = None
        self.conf = conf.LPMSConfig()
        self.instdb = api.InstallDB()
        self.repodb = api.RepositoryDB()
        self.conditional_packages = {}
        self.processed = {}
        self.package_heap = {}
        self.control_chars = ["||"]
        self.inline_options = {}
        self.inline_option_targets = {}
        self.package_dependencies = {}
        self.postmerge_dependencies = set()
        self.package_options = {}
        self.repository_cache = {}
        self.user_defined_options = {}
        self.package_query = []
        self.locked_packages = []
        self.global_options = set()
        self.forbidden_options = set()
        self.dependency_keywords = (
                'static_depends_build',
                'static_depends_runtime',
                'static_depends_conflict',
                'static_depends_postmerge',
                'optional_depends_build',
                'optional_depends_runtime',
                'optional_depends_conflict',
                'optional_depends_postmerge'
        )
        for option in self.conf.options.split(" "):
            if option.strip():
                if not option.startswith("-"):
                    self.global_options.add(option)
                else:
                    self.forbidden_options.add(option[1:])
        self.get_user_defined_files()
        self.parse_user_defined_options_file()
        if hasattr(self, "user_defined_lock_file"):
            for locked_item in self.user_defined_lock_file:
                self.locked_packages.extend(self.parse_user_defined_file(locked_item))

        self.custom_arch_requests = {}
        if hasattr(self, "user_defined_arch_file"):
            for arch_item in self.user_defined_arch_file:
                self.custom_arch_requests.update(utils.ParseArchFile(arch_item, \
                        self.repodb).parse())
Пример #6
0
 def __init__(self, keyword, instruct):
     self.instruct = instruct
     self.instruct["ask"] = True
     self.keyword = ""
     for key in keyword:
         if not key in ('--only-installed', '--in-name', '--in-summary',
                        '--interactive'):
             self.keyword += key + " "
     self.keyword = self.keyword.strip()
     root = cst.root if instruct["real_root"] is None \
             else instruct['real_root']
     self.connection = sqlite3.connect(os.path.join(root, cst.db_path, \
             cst.repositorydb)+cst.db_prefix)
     self.cursor = self.connection.cursor()
     self.repodb = dbapi.RepositoryDB()
     self.instdb = dbapi.InstallDB()
Пример #7
0
 def __init__(self):
     self.upgrade_pkg = []
     self.notfound_pkg = []
     self.packages = []
     self.repodb = dbapi.RepositoryDB()
     self.instdb = dbapi.InstallDB()
     self.locked_packages = {}
     lock_file = os.path.join(cst.user_dir, "lock")
     if os.access(lock_file, os.R_OK):
         with open(lock_file) as data:
             for line in data.readlines():
                 lock_category, lock_name, lock_version = utils.parse_user_defined_file(line.strip(), \
                         self.repodb)
                 key = lock_category + "/" + lock_name
                 if key in self.locked_packages:
                     if isinstance(lock_version, list):
                         self.locked_packages[key].extend(lock_version)
                     else:
                         self.locked_packages[key].append(lock_version)
                 else:
                     if isinstance(lock_version, list):
                         self.locked_packages[key] = lock_version
                     else:
                         self.locked_packages[key] = [lock_version]
Пример #8
0
 def __init__(self):
     super(Update, self).__init__()
     self.repodb = api.RepositoryDB()
     self.packages_num = 0