[Yum-devel] pkg.committer addition?
seth vidal
skvidal at fedoraproject.org
Mon Jan 21 23:42:34 UTC 2008
On Mon, 2008-01-21 at 18:44 -0500, James Antill wrote:
> What does everyone think of having a pkg.commiter property? I realize
> it's kind of a work around for the fact Fedora takes both the packager
> and vendor fields, but it's useful so here is an initial implementation:
>
> diff --git a/yum/packages.py b/yum/packages.py
> index 0830258..7ae3cf3 100644
> --- a/yum/packages.py
> +++ b/yum/packages.py
> @@ -461,6 +461,34 @@ class YumAvailablePackage(PackageObject, RpmBase):
> remote_path = property(_remote_path)
> remote_url = property(_remote_url)
>
> + def _committer(self):
> + "Returns the name of the last person to do a commit to the changelog."
> +
> + if hasattr(self, '_committer_ret'):
> + return self._committer_ret
> +
> + def _nf2ascii(x):
> + """ does .encode("ascii", "replace") but it never fails. """
> + ret = []
> + for val in x:
> + if ord(val) >= 128:
> + val = '?'
> + ret.append(val)
> + return "".join(ret)
> +
> + if not len(self.changelog): # Empty changelog is _possible_ I guess
> + self._committer_ret = self.packager
> + return self._committer_ret
> +
> + val = self.changelog[0][1]
> + # Chagnelog data is in multiple locale's, so we convert to ascii
> + # ignoring "bad" chars.
> + val = _nf2ascii(val)
> + # Hacky way to get rid of version numbers...
> + self._committer_ret = re.sub("""> .*""", '>', val)
> + return self._committer_ret
> +
> + committer = property(_committer)
>
why wouldn't we add it lower in the stack?
-sv
More information about the Yum-devel
mailing list