[Yum-devel] [PATCH] Be nice and don't traceback when people screw their rpmdb, BZ 522259

James Antill james at fedoraproject.org
Mon Sep 21 06:39:17 UTC 2009


On Mon, 2009-09-21 at 02:16 -0400, James Antill wrote:
>  
>      def getInstalledPackageObject(self, pkgtup):
> -        """returns a YumInstallPackage object for the pkgtup specified"""
> -        warnings.warn(_('getInstalledPackageObject() will go away, use self.rpmdb.searchPkgTuple().\n'),
> -                Errors.YumFutureDeprecationWarning, stacklevel=2)
> +        """ Returns a YumInstallPackage object for the pkgtup specified, or
> +            raises an exception. You should use this instead of
> +            searchPkgTuple() if you are assuming there is a value. """
>          
> +        if len(pkgs) == 0:
> +            raise Errors.RpmDBError, _('Package tuple %s could not be found in rpmdb') % str(pkgtup)
> +
> +        # Dito. FIXME from getPackageObject() for len() > 1 ... :)
>          po = self.rpmdb.searchPkgTuple(pkgtup)[0] # take the first one
>          return po

 Ignore this one, I somehow missed the "pkgs = " line :)



More information about the Yum-devel mailing list