On 02/08/2011 02:52 PM, Lucas Meneghel Rodrigues wrote:
> On Tue, 2011-02-08 at 14:48 -0200, Cleber Rosa wrote:
>> On 02/08/2011 02:41 PM, Lucas Meneghel Rodrigues wrote:
>>> On Tue, 2011-02-08 at 12:16 -0200, Cleber Rosa wrote:
>>>> Users of KojiDownloader usually rely on architecture detection
>>>> to find an RPM package to download. In some cases, the package
>>>> the user is trying to find is actually architecture independent.
>>>>
>>>> This patch adds another try with arch=noarch as a fallback when
>>>> the platform specific packages are not found.
>>>>
>>>> Signed-off-by: Cleber Rosa<cr...@redhat.com>
>>>> ---
>>>>    client/tests/kvm/kvm_utils.py |    8 ++++++++
>>>>    1 files changed, 8 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
>>>> index d8d3357..bb0ea36 100644
>>>> --- a/client/tests/kvm/kvm_utils.py
>>>> +++ b/client/tests/kvm/kvm_utils.py
>>>> @@ -1652,6 +1652,14 @@ class KojiDownloader(object):
>>>>
>>>>            rpms = self.session.listRPMs(buildID=info['id'],
>>>>                                         arches=arch)
>>>> +
>>>> +        if not rpms:
>>>> +            logging.info("Attempting to find platform independent package 
>>>> "
>>>> +                         "(arch=noarch)")
>>> ^ Did you verify if 'info' level is appropriate here? I mean, if 'info'
>>> is preferable over 'debug' for example
>> I think 'info' is more appropriate, since the user might be expecting an
>> arch specific package, and will instead (probably) get a noarch.
>>
>> Putting it in 'debug' would make it almost invisible, IMHO, but I'm open
>> to your suggestion!
> Log it as an error "Could not find [arch] package [pkg], searching for a
> platform independent one (arch=noarch)". This will be more visible and
> coherent with the fact that no packages were found before.
>

The reason for 'info' is that all code I've seen using this rely on 
platform detection, and this is, IMHO, an extension of the same idea.

I mean, wouldn't be an error if a user specifies package "vgabios", tag 
"x-stable" and omit the architecture, right? It's probably worth 
noticing though, that 'vgabios.x86_64' was not found, but 
'vgabios.noarch' was.

Anyway, you're the voice of experience here! :)

Shall we log in 'error' then?

>>>> +            arch = "noarch"
>>>> +            rpms = self.session.listRPMs(buildID=info['id'],
>>>> +                                         arches=arch)
>>>> +
>>>>            if not rpms:
>>>>                raise ValueError("No %s packages available for %s" %
>>>>                                 arch, koji.buildLabel(info))
>

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to