Beispiel #1
0
def process_cp(arg):
	if -1 == arg.find('/'):
		if 'gentoo' != system:
			report(LOGLEVELS.fatal,
					'Without Portage API I could not expand package names.')
		arg = portage.dep_expand(arg, db_port)
		if arg.startswith('null/'):
			report(LOGLEVELS.fatal, 'Failed to expand package name to CP.')
	return tuple(arg.split('/', 1))
Beispiel #2
0
    def __xmatch(self, pdb, package):
        """xmatch function that searches for all packages over all repos"""
        try:
            mycp = port.dep_expand(package, mydb=pdb, settings=pdb.settings).cp
        except port.exception.AmbiguousPackageName as Arg:
            msg_err = 'Ambiguous package name "%s".\n' % package
            found = 'Possibilities: %s' % Arg
            raise SystemExit('%s%s' % (msg_err, found))
        except port.exception.InvalidAtom:
            msg_err = 'No such package "%s"' % package
            raise SystemExit(msg_err)

        mysplit = mycp.split('/')
        mypkgs = []
        for oroot in pdb.porttrees:
            try:
                file_list = os.listdir(os.path.join(oroot, mycp))
            except OSError:
                continue
            for x in file_list:
                pf = x[:-7] if x[-7:] == '.ebuild' else []
                if pf:
                    ps = port.pkgsplit(pf)
                    if not ps or ps[0] != mysplit[1]:
                        # we got garbage or ebuild with wrong name in the dir
                        continue
                    ver_match = port.versions.ver_regexp.match("-".join(
                        ps[1:]))
                    if ver_match is None or not ver_match.groups():
                        # version is not allowed by portage or unset
                        continue
                    # obtain related data from metadata and append to the pkg list
                    keywords, slot = self.__getMetadata(
                        pdb, mysplit[0] + '/' + pf, oroot)
                    mypkgs.append(
                        [mysplit[0] + '/' + pf, oroot, slot, keywords])

        self.__packages_sort(mypkgs)
        return mypkgs
Beispiel #3
0
	def __xmatch(self, pdb, package):
		"""xmatch function that searches for all packages over all repos"""
		try:
			mycp = port.dep_expand(package, mydb=pdb, settings=pdb.settings).cp
		except port.exception.AmbiguousPackageName as Arg:
			msg_err = 'Ambiguous package name "%s".\n' % package
			found = 'Possibilities: %s' % Arg
			raise SystemExit('%s%s' % (msg_err, found))
		except port.exception.InvalidAtom:
			msg_err = 'No such package "%s"' % package
			raise SystemExit(msg_err)

		mysplit = mycp.split('/')
		mypkgs = []
		for oroot in pdb.porttrees:
			try:
				file_list = os.listdir(os.path.join(oroot, mycp))
			except OSError:
				continue
			for x in file_list:
				pf = x[:-7] if x[-7:] == '.ebuild' else []
				if pf:
					ps = port.pkgsplit(pf)
					if not ps or ps[0] != mysplit[1]:
						# we got garbage or ebuild with wrong name in the dir
						continue
					ver_match = port.versions.ver_regexp.match("-".join(ps[1:]))
					if ver_match is None or not ver_match.groups():
						# version is not allowed by portage or unset
						continue
					# obtain related data from metadata and append to the pkg list
					keywords, slot = self.__getMetadata(pdb, mysplit[0]+'/'+pf, oroot)
					mypkgs.append([mysplit[0]+'/'+pf, oroot, slot, keywords])

		self.__packages_sort(mypkgs)
		return mypkgs