示例#1
0
def get_slotted_cps(cpvs, logger):
	"""Uses portage to reduce the cpv list into a cp:slot list and returns it
	"""
	from portage.versions import catpkgsplit
	from portage import portdb

	cps = []
	for cpv in cpvs:
		parts = catpkgsplit(cpv)
		if not parts:
			logger.warning(('\t' + red("Failed to split the following pkg: "
				"%s, not a valid cat/pkg-ver" %cpv)))
			continue

		cp = parts[0] + '/' + parts[1]
		try:
			slot = portdb.aux_get(cpv, ["SLOT"])
		except KeyError:
			match, slot = get_best_match(cpv, cp, logger)
			if not match:
				logger.warning('\t' + red("Installed package: "
					"%s is no longer available" %cp))
				continue

		if slot[0]:
			cps.append(cp + ":" + slot[0])
		else:
			cps.append(cp)

	return cps
示例#2
0
文件: flag.py 项目: swegener/esearch
def get_iuse(cpv, settings=default_settings):
    """Gets the current IUSE flags from the tree

    To be used when a gentoolkit package object is not needed
    @type: cpv: string
    @param cpv: cat/pkg-ver
    @type root: string
    @param settings: optional portage config settings instance.
        defaults to portage.api.settings.default_settings
    @rtype list
    @returns [] or the list of IUSE flags
    """
    try:
        return portdb.aux_get(cpv, ["IUSE"])[0].split()
    except:
        return []
示例#3
0
def get_iuse(cpv, settings=default_settings):
    """Gets the current IUSE flags from the tree

    To be used when a gentoolkit package object is not needed
    @type: cpv: string
    @param cpv: cat/pkg-ver
    @type root: string
    @param settings: optional portage config settings instance.
        defaults to portage.api.settings.default_settings
    @rtype list
    @returns [] or the list of IUSE flags
    """
    try:
        return portdb.aux_get(cpv, ["IUSE"])[0].split()
    except:
        return []
示例#4
0
def get_slotted_cps(cpvs, logger):
	"""Uses portage to reduce the cpv list into a cp:slot list and returns it
	"""

	cps = []
	for cpv in cpvs:
		parts = catpkgsplit(cpv)
		cp = parts[0] + '/' + parts[1]
		try:
			slot = portdb.aux_get(cpv, ["SLOT"])
		except KeyError:
			match, slot = get_best_match(cpv, cp, logger)
			if not match:
				logger.warn(red("Installed package: "
					"%s is no longer available" %cp))
				continue

		if slot[0]:
			cps.append(cp + ":" + slot[0])
		else:
			cps.append(cp)

	return cps
示例#5
0
def get_slotted_cps(cpvs, logger):
    """Uses portage to reduce the cpv list into a cp:slot list and returns it
	"""

    cps = []
    for cpv in cpvs:
        parts = catpkgsplit(cpv)
        cp = parts[0] + '/' + parts[1]
        try:
            slot = portdb.aux_get(cpv, ["SLOT"])
        except KeyError:
            match, slot = get_best_match(cpv, cp, logger)
            if not match:
                logger.warn(
                    red("Installed package: "
                        "%s is no longer available" % cp))
                continue

        if slot[0]:
            cps.append(cp + ":" + slot[0])
        else:
            cps.append(cp)

    return cps