Exemplo n.º 1
0
	def set_pkg_info(self, pkg, ordered):
		"""Sets various pkg_info dictionary variables

		@param pkg: _emerge.Package.Package instance
		@param ordered: bool
		@rtype pkg_info dictionary
		Modifies self.counters.restrict_fetch,
			self.counters.restrict_fetch_satisfied
		"""
		pkg_info = PkgInfo()
		pkg_info.cp = pkg.cp
		pkg_info.ver = self.get_ver_str(pkg)
		pkg_info.slot = pkg.slot
		pkg_info.sub_slot = pkg.sub_slot
		pkg_info.repo_name = pkg.repo
		pkg_info.ordered = ordered
		pkg_info.operation = pkg.operation
		pkg_info.merge = ordered and pkg_info.operation == "merge"
		if not pkg_info.merge and pkg_info.operation == "merge":
			pkg_info.operation = "nomerge"
		pkg_info.built = pkg.type_name != "ebuild"
		pkg_info.ebuild_path = None
		if ordered:
			if pkg_info.merge:
				if pkg.type_name == "binary":
					self.counters.binary += 1
			elif pkg_info.operation == "uninstall":
				self.counters.uninst += 1
		if pkg.type_name == "ebuild":
			pkg_info.ebuild_path = self.portdb.findname(
				pkg.cpv, myrepo=pkg_info.repo_name)
			if pkg_info.ebuild_path is None:
				raise AssertionError(
					"ebuild not found for '%s'" % pkg.cpv)
			pkg_info.repo_path_real = os.path.dirname(os.path.dirname(
				os.path.dirname(pkg_info.ebuild_path)))
		else:
			pkg_info.repo_path_real = self.portdb.getRepositoryPath(pkg.repo)
		pkg_info.use = list(self.conf.pkg_use_enabled(pkg))
		if not pkg.built and pkg.operation == 'merge' and \
			'fetch' in pkg.restrict:
			if pkg_info.ordered:
				self.counters.restrict_fetch += 1
			pkg_info.attr_display.fetch_restrict = True
			if not self.portdb.getfetchsizes(pkg.cpv,
				useflags=pkg_info.use, myrepo=pkg.repo):
				pkg_info.attr_display.fetch_restrict_satisfied = True
				if pkg_info.ordered:
					self.counters.restrict_fetch_satisfied += 1
			else:
				if pkg_info.ebuild_path is not None:
					self.restrict_fetch_list[pkg] = pkg_info

		if self.vardb.cpv_exists(pkg.cpv):
			# Do a cpv match first, in case the SLOT has changed.
			pkg_info.previous_pkg = self.vardb.match_pkgs('=' + pkg.cpv)[0]
		else:
			slot_matches = self.vardb.match_pkgs(pkg.slot_atom)
			if slot_matches:
				pkg_info.previous_pkg = slot_matches[0]

		return pkg_info
Exemplo n.º 2
0
    def set_pkg_info(self, pkg, ordered):
        """Sets various pkg_info dictionary variables

		@param pkg: _emerge.Package.Package instance
		@param ordered: bool
		@rtype pkg_info dictionary
		Modifies self.counters.restrict_fetch,
			self.counters.restrict_fetch_satisfied
		"""
        pkg_info = PkgInfo()
        pkg_info.cp = pkg.cp
        pkg_info.ver = self.get_ver_str(pkg)
        pkg_info.slot = pkg.slot
        pkg_info.sub_slot = pkg.sub_slot
        pkg_info.repo_name = pkg.repo
        pkg_info.ordered = ordered
        pkg_info.operation = pkg.operation
        pkg_info.merge = ordered and pkg_info.operation == "merge"
        if not pkg_info.merge and pkg_info.operation == "merge":
            pkg_info.operation = "nomerge"
        pkg_info.built = pkg.type_name != "ebuild"
        pkg_info.ebuild_path = None
        if ordered:
            if pkg_info.merge:
                if pkg.type_name == "binary":
                    self.counters.binary += 1
            elif pkg_info.operation == "uninstall":
                self.counters.uninst += 1
        if pkg.type_name == "ebuild":
            pkg_info.ebuild_path = self.portdb.findname(
                pkg.cpv, myrepo=pkg_info.repo_name)
            if pkg_info.ebuild_path is None:
                raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
            pkg_info.repo_path_real = os.path.dirname(
                os.path.dirname(os.path.dirname(pkg_info.ebuild_path)))
        else:
            pkg_info.repo_path_real = self.portdb.getRepositoryPath(pkg.repo)
        pkg_info.use = list(self.conf.pkg_use_enabled(pkg))
        if not pkg.built and pkg.operation == 'merge' and \
         'fetch' in pkg.restrict:
            if pkg_info.ordered:
                self.counters.restrict_fetch += 1
            pkg_info.attr_display.fetch_restrict = True
            if not self.portdb.getfetchsizes(
                    pkg.cpv, useflags=pkg_info.use, myrepo=pkg.repo):
                pkg_info.attr_display.fetch_restrict_satisfied = True
                if pkg_info.ordered:
                    self.counters.restrict_fetch_satisfied += 1
            else:
                if pkg_info.ebuild_path is not None:
                    self.restrict_fetch_list[pkg] = pkg_info

        if self.vardb.cpv_exists(pkg.cpv):
            # Do a cpv match first, in case the SLOT has changed.
            pkg_info.previous_pkg = self.vardb.match_pkgs(Atom('=' +
                                                               pkg.cpv))[0]
        else:
            cp_slot_matches = self.vardb.match_pkgs(pkg.slot_atom)
            if cp_slot_matches:
                pkg_info.previous_pkg = cp_slot_matches[0]
            else:
                cp_matches = self.vardb.match_pkgs(Atom(pkg.cp))
                if cp_matches:
                    # Use highest installed other-slot package instance.
                    pkg_info.previous_pkg = cp_matches[-1]

        return pkg_info
Exemplo n.º 3
0
	def set_pkg_info(self, pkg, ordered):
		"""Sets various pkg_info dictionary variables

		@param pkg: _emerge.Package.Package instance
		@param ordered: bool
		@rtype pkg_info dictionary
		Modifies self.counters.restrict_fetch,
			self.counters.restrict_fetch_satisfied
		"""
		pkg_info = PkgInfo()
		pkg_info.ordered = ordered
		pkg_info.fetch_symbol = " "
		pkg_info.operation = pkg.operation
		pkg_info.merge = ordered and pkg_info.operation == "merge"
		if not pkg_info.merge and pkg_info.operation == "merge":
			pkg_info.operation = "nomerge"
		pkg_info.built = pkg.type_name != "ebuild"
		pkg_info.ebuild_path = None
		pkg_info.repo_name = pkg.repo
		if pkg.type_name == "ebuild":
			pkg_info.ebuild_path = self.portdb.findname(
				pkg.cpv, myrepo=pkg_info.repo_name)
			if pkg_info.ebuild_path is None:
				raise AssertionError(
					"ebuild not found for '%s'" % pkg.cpv)
			pkg_info.repo_path_real = os.path.dirname(os.path.dirname(
				os.path.dirname(pkg_info.ebuild_path)))
		else:
			pkg_info.repo_path_real = \
				self.portdb.getRepositoryPath(pkg.metadata["repository"])
		pkg_info.use = list(self.conf.pkg_use_enabled(pkg))
		if not pkg.built and pkg.operation == 'merge' and \
			'fetch' in pkg.metadata.restrict:
			pkg_info.fetch_symbol = red("F")
			if pkg_info.ordered:
				self.counters.restrict_fetch += 1
			if not self.portdb.getfetchsizes(pkg.cpv,
				useflags=pkg_info.use, myrepo=pkg.repo):
				pkg_info.fetch_symbol = green("f")
				if pkg_info.ordered:
					self.counters.restrict_fetch_satisfied += 1
		return pkg_info
Exemplo n.º 4
0
    def set_pkg_info(self, pkg, ordered):
        """Sets various pkg_info dictionary variables

		@param pkg: _emerge.Package.Package instance
		@param ordered: bool
		@rtype pkg_info dictionary
		Modifies self.counters.restrict_fetch,
			self.counters.restrict_fetch_satisfied
		"""
        pkg_info = PkgInfo()
        pkg_info.cp = pkg.cp
        pkg_info.ver = self.get_ver_str(pkg)
        pkg_info.slot = pkg.slot
        pkg_info.sub_slot = pkg.sub_slot
        pkg_info.repo_name = pkg.repo
        pkg_info.ordered = ordered
        pkg_info.operation = pkg.operation
        pkg_info.merge = ordered and pkg_info.operation == "merge"
        if not pkg_info.merge and pkg_info.operation == "merge":
            pkg_info.operation = "nomerge"
        pkg_info.built = pkg.type_name != "ebuild"
        pkg_info.ebuild_path = None
        if ordered:
            if pkg_info.merge:
                if pkg.type_name == "binary":
                    self.counters.binary += 1
            elif pkg_info.operation == "uninstall":
                self.counters.uninst += 1
        if pkg.type_name == "ebuild":
            pkg_info.ebuild_path = self.portdb.findname(
                pkg.cpv, myrepo=pkg_info.repo_name)
            if pkg_info.ebuild_path is None:
                raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
            pkg_info.repo_path_real = os.path.dirname(
                os.path.dirname(os.path.dirname(pkg_info.ebuild_path)))
        else:
            pkg_info.repo_path_real = \
             self.portdb.getRepositoryPath(pkg.metadata["repository"])
        pkg_info.use = list(self.conf.pkg_use_enabled(pkg))
        if not pkg.built and pkg.operation == 'merge' and \
         'fetch' in pkg.metadata.restrict:
            if pkg_info.ordered:
                self.counters.restrict_fetch += 1
            pkg_info.attr_display.fetch_restrict = True
            if not self.portdb.getfetchsizes(
                    pkg.cpv, useflags=pkg_info.use, myrepo=pkg.repo):
                pkg_info.attr_display.fetch_restrict_satisfied = True
                if pkg_info.ordered:
                    self.counters.restrict_fetch_satisfied += 1
            else:
                if pkg_info.ebuild_path is not None:
                    self.restrict_fetch_list[pkg] = pkg_info
        return pkg_info
Exemplo n.º 5
0
    def set_pkg_info(self, pkg, ordered):
        """Sets various pkg_info dictionary variables

		@param pkg: _emerge.Package.Package instance
		@param ordered: bool
		@rtype pkg_info dictionary
		Modifies self.counters.restrict_fetch,
			self.counters.restrict_fetch_satisfied
		"""
        pkg_info = PkgInfo()
        pkg_info.ordered = ordered
        pkg_info.fetch_symbol = " "
        pkg_info.operation = pkg.operation
        pkg_info.merge = ordered and pkg_info.operation == "merge"
        if not pkg_info.merge and pkg_info.operation == "merge":
            pkg_info.operation = "nomerge"
        pkg_info.built = pkg.type_name != "ebuild"
        pkg_info.ebuild_path = None
        pkg_info.repo_name = pkg.repo
        if pkg.type_name == "ebuild":
            pkg_info.ebuild_path = self.portdb.findname(
                pkg.cpv, myrepo=pkg_info.repo_name)
            if pkg_info.ebuild_path is None:
                raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
            pkg_info.repo_path_real = os.path.dirname(
                os.path.dirname(os.path.dirname(pkg_info.ebuild_path)))
        else:
            pkg_info.repo_path_real = \
             self.portdb.getRepositoryPath(pkg.metadata["repository"])
        pkg_info.use = list(self.conf.pkg_use_enabled(pkg))
        if not pkg.built and pkg.operation == 'merge' and \
         'fetch' in pkg.metadata.restrict:
            pkg_info.fetch_symbol = red("F")
            if pkg_info.ordered:
                self.counters.restrict_fetch += 1
            if not self.portdb.getfetchsizes(
                    pkg.cpv, useflags=pkg_info.use, myrepo=pkg.repo):
                pkg_info.fetch_symbol = green("f")
                if pkg_info.ordered:
                    self.counters.restrict_fetch_satisfied += 1
        return pkg_info