コード例 #1
0
ファイル: FakeVartree.py プロジェクト: devurandom/portage
    def _aux_get_wrapper(self, pkg, wants, myrepo=None):
        if pkg in self._aux_get_history:
            return self._aux_get(pkg, wants)
        self._aux_get_history.add(pkg)
        # We need to check the EAPI, and this also raises
        # a KeyError to the caller if appropriate.
        pkg_obj = self.dbapi._cpv_map[pkg]
        installed_eapi = pkg_obj.metadata['EAPI']
        repo = pkg_obj.metadata['repository']
        eapi_attrs = _get_eapi_attrs(installed_eapi)
        built_slot_operator_atoms = None

        if eapi_attrs.slot_operator and not self._ignore_built_slot_operator_deps:
            try:
                built_slot_operator_atoms = find_built_slot_operator_atoms(
                    pkg_obj)
            except InvalidDependString:
                pass

        try:
            # Use the live ebuild metadata if possible.
            repo = _gen_valid_repo(repo)
            live_metadata = dict(
                zip(self._portdb_keys,
                    self._portdb.aux_get(pkg, self._portdb_keys, myrepo=repo)))
            # Use the metadata from the installed instance if the EAPI
            # of either instance is unsupported, since if the installed
            # instance has an unsupported or corrupt EAPI then we don't
            # want to attempt to do complex operations such as execute
            # pkg_config, pkg_prerm or pkg_postrm phases. If both EAPIs
            # are supported then go ahead and use the live_metadata, in
            # order to respect dep updates without revision bump or EAPI
            # bump, as in bug #368725.
            if not (portage.eapi_is_supported(live_metadata["EAPI"]) and \
             portage.eapi_is_supported(installed_eapi)):
                raise KeyError(pkg)

            # preserve built slot/sub-slot := operator deps
            if built_slot_operator_atoms:
                live_eapi_attrs = _get_eapi_attrs(live_metadata["EAPI"])
                if not live_eapi_attrs.slot_operator:
                    raise KeyError(pkg)
                for k, v in built_slot_operator_atoms.items():
                    live_metadata[k] += (
                        " " + " ".join(_unicode(atom) for atom in v))

            self.dbapi.aux_update(pkg, live_metadata)
        except (KeyError, portage.exception.PortageException):
            if self._global_updates is None:
                self._global_updates = \
                 grab_global_updates(self._portdb)
            perform_global_updates(pkg, self.dbapi, self._global_updates)
        return self._aux_get(pkg, wants)
コード例 #2
0
ファイル: FakeVartree.py プロジェクト: devurandom/portage
	def _aux_get_wrapper(self, pkg, wants, myrepo=None):
		if pkg in self._aux_get_history:
			return self._aux_get(pkg, wants)
		self._aux_get_history.add(pkg)
		# We need to check the EAPI, and this also raises
		# a KeyError to the caller if appropriate.
		pkg_obj = self.dbapi._cpv_map[pkg]
		installed_eapi = pkg_obj.metadata['EAPI']
		repo = pkg_obj.metadata['repository']
		eapi_attrs = _get_eapi_attrs(installed_eapi)
		built_slot_operator_atoms = None

		if eapi_attrs.slot_operator and not self._ignore_built_slot_operator_deps:
			try:
				built_slot_operator_atoms = find_built_slot_operator_atoms(pkg_obj)
			except InvalidDependString:
				pass

		try:
			# Use the live ebuild metadata if possible.
			repo = _gen_valid_repo(repo)
			live_metadata = dict(zip(self._portdb_keys,
				self._portdb.aux_get(pkg, self._portdb_keys, myrepo=repo)))
			# Use the metadata from the installed instance if the EAPI
			# of either instance is unsupported, since if the installed
			# instance has an unsupported or corrupt EAPI then we don't
			# want to attempt to do complex operations such as execute
			# pkg_config, pkg_prerm or pkg_postrm phases. If both EAPIs
			# are supported then go ahead and use the live_metadata, in
			# order to respect dep updates without revision bump or EAPI
			# bump, as in bug #368725.
			if not (portage.eapi_is_supported(live_metadata["EAPI"]) and \
				portage.eapi_is_supported(installed_eapi)):
				raise KeyError(pkg)

			# preserve built slot/sub-slot := operator deps
			if built_slot_operator_atoms:
				live_eapi_attrs = _get_eapi_attrs(live_metadata["EAPI"])
				if not live_eapi_attrs.slot_operator:
					raise KeyError(pkg)
				for k, v in built_slot_operator_atoms.items():
					live_metadata[k] += (" " +
						" ".join(_unicode(atom) for atom in v))

			self.dbapi.aux_update(pkg, live_metadata)
		except (KeyError, portage.exception.PortageException):
			if self._global_updates is None:
				self._global_updates = \
					grab_global_updates(self._portdb)
			perform_global_updates(
				pkg, self.dbapi, self._global_updates)
		return self._aux_get(pkg, wants)
コード例 #3
0
ファイル: FakeVartree.py プロジェクト: jonasstein/portage
	def _apply_dynamic_deps(self, pkg, live_metadata):

		try:
			if live_metadata is None:
				raise _DynamicDepsNotApplicable()
			# Use the metadata from the installed instance if the EAPI
			# of either instance is unsupported, since if the installed
			# instance has an unsupported or corrupt EAPI then we don't
			# want to attempt to do complex operations such as execute
			# pkg_config, pkg_prerm or pkg_postrm phases. If both EAPIs
			# are supported then go ahead and use the live_metadata, in
			# order to respect dep updates without revision bump or EAPI
			# bump, as in bug #368725.
			if not (portage.eapi_is_supported(live_metadata["EAPI"]) and \
				portage.eapi_is_supported(pkg.eapi)):
				raise _DynamicDepsNotApplicable()

			# preserve built slot/sub-slot := operator deps
			built_slot_operator_atoms = None
			if not self._ignore_built_slot_operator_deps and \
				_get_eapi_attrs(pkg.eapi).slot_operator:
				try:
					built_slot_operator_atoms = \
						find_built_slot_operator_atoms(pkg)
				except InvalidDependString:
					pass

			if built_slot_operator_atoms:
				live_eapi_attrs = _get_eapi_attrs(live_metadata["EAPI"])
				if not live_eapi_attrs.slot_operator:
					raise _DynamicDepsNotApplicable()
				for k, v in built_slot_operator_atoms.items():
					live_metadata[k] += (" " +
						" ".join(_unicode(atom) for atom in v))

			self.dbapi.aux_update(pkg.cpv, live_metadata)
		except _DynamicDepsNotApplicable:
			if self._global_updates is None:
				self._global_updates = \
					grab_global_updates(self._portdb)

			# Bypass _aux_get_wrapper, since calling that
			# here would trigger infinite recursion.
			aux_keys = Package._dep_keys + self.dbapi._pkg_str_aux_keys
			aux_dict = dict(zip(aux_keys, self._aux_get(pkg.cpv, aux_keys)))
			perform_global_updates(
				pkg.cpv, aux_dict, self.dbapi, self._global_updates)
コード例 #4
0
ファイル: FakeVartree.py プロジェクト: timlianov/portage
	def _apply_dynamic_deps(self, pkg, live_metadata):

		try:
			if live_metadata is None:
				raise _DynamicDepsNotApplicable()
			# Use the metadata from the installed instance if the EAPI
			# of either instance is unsupported, since if the installed
			# instance has an unsupported or corrupt EAPI then we don't
			# want to attempt to do complex operations such as execute
			# pkg_config, pkg_prerm or pkg_postrm phases. If both EAPIs
			# are supported then go ahead and use the live_metadata, in
			# order to respect dep updates without revision bump or EAPI
			# bump, as in bug #368725.
			if not (portage.eapi_is_supported(live_metadata["EAPI"]) and \
				portage.eapi_is_supported(pkg.eapi)):
				raise _DynamicDepsNotApplicable()

			# preserve built slot/sub-slot := operator deps
			built_slot_operator_atoms = None
			if not self._ignore_built_slot_operator_deps and \
				_get_eapi_attrs(pkg.eapi).slot_operator:
				try:
					built_slot_operator_atoms = \
						find_built_slot_operator_atoms(pkg)
				except InvalidDependString:
					pass

			if built_slot_operator_atoms:
				live_eapi_attrs = _get_eapi_attrs(live_metadata["EAPI"])
				if not live_eapi_attrs.slot_operator:
					raise _DynamicDepsNotApplicable()
				for k, v in built_slot_operator_atoms.items():
					live_metadata[k] += (" " +
						" ".join(_unicode(atom) for atom in v))

			self.dbapi.aux_update(pkg.cpv, live_metadata)
		except _DynamicDepsNotApplicable:
			if self._global_updates is None:
				self._global_updates = \
					grab_global_updates(self._portdb)

			# Bypass _aux_get_wrapper, since calling that
			# here would trigger infinite recursion.
			aux_keys = Package._dep_keys + self.dbapi._pkg_str_aux_keys
			aux_dict = dict(zip(aux_keys, self._aux_get(pkg.cpv, aux_keys)))
			perform_global_updates(
				pkg.cpv, aux_dict, self.dbapi, self._global_updates)