Mailinglist Archive: opensuse-buildservice (233 mails)

< Previous Next >
Re: [opensuse-buildservice] little patch for osc rprjresults filter option
  • From: Werner Hoch <werner.ho@xxxxxx>
  • Date: Mon, 22 Dec 2008 11:47:27 +0100
  • Message-id: <200812221147.27878.werner.ho@xxxxxx>
On Sonntag, 21. Dezember 2008, Werner Hoch wrote:
this is a small patch to enhance the osc rpjresuls status filter
option.

osc currently accepts only one filter letter.

osc rprjresults -q -s s science

With attached patch you can use as many status letters as you like:
osc rprjresults -q -s "%sBEFfb" science

Oops, the code can not handle undefined status names.

First and second patch attached.

Regards
Werner (werner2101)


From 062352ffa77c323bd8c6416fcbb6748dc670956e Mon Sep 17 00:00:00 2001
From: Werner Hoch <werner.ho@xxxxxx>
Date: Mon, 22 Dec 2008 00:31:08 +0100
Subject: [PATCH] added missing values to buildstatus_symbols

Added the values dispatching, excluded and unknown.
Using dict.get() is more save the just using the direct
dict[] syntax to get the symbol shortcut.

This fixes a keyerror that was raised with the last commit
if an undefined symbol was in the package.

Default to unknown in the case there's still another undefined
symbol.
---
osc/core.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/osc/core.py b/osc/core.py
index 243aea1..673b9f3 100755
--- a/osc/core.py
+++ b/osc/core.py
@@ -177,6 +177,9 @@ buildstatus_symbols = {'succeeded': '.',
'building': '%',
'finished': 'f',
'scheduled': 's',
+ 'dispatching': 'd',
+ 'excluded': 'x',
+ 'unknown': 'u',
}


@@ -2680,7 +2683,8 @@ def get_prj_results(apiurl, prj, hide_legend=False,
csv=False, status_filter=Non
if status_filter:
for pkg in status.keys():
for repo in status[pkg].keys():
- if buildstatus_symbols[status[pkg][repo]] in status_filter:
+ buildst = buildstatus_symbols.get(status[pkg][repo],'u')
+ if buildst in status_filter:
if not name_filter:
pacs_to_show.append(pkg)
targets_to_show.append(repo)
--
1.6.0.2

From 8e4e1e9d97ce30297c7d17bdec2c74718faad99d Mon Sep 17 00:00:00 2001
From: Werner Hoch <werner.ho@xxxxxx>
Date: Mon, 22 Dec 2008 00:18:34 +0100
Subject: [PATCH] little patch for osc rprjresults filter option

osc currently accepts only one filter letter.
osc rprjresults -q -s s science
With attached patch you can use as many status letters as you like:
osc rprjresults -q -s "%sBEFfb" science
---
osc/core.py | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/osc/core.py b/osc/core.py
index 17fd945..243aea1 100755
--- a/osc/core.py
+++ b/osc/core.py
@@ -2676,22 +2676,18 @@ def get_prj_results(apiurl, prj, hide_legend=False,
csv=False, status_filter=Non
pacs_to_show = []
targets_to_show = []

- #filtering for Package Status
+ #filtering for Package Status
if status_filter:
- if status_filter in buildstatus_symbols.values():
- for txt, sym in buildstatus_symbols.items():
- if sym == status_filter:
- filt_txt = txt
- for pkg in status.keys():
- for repo in status[pkg].keys():
- if status[pkg][repo] == filt_txt:
- if not name_filter:
- pacs_to_show.append(pkg)
- targets_to_show.append(repo)
- elif name_filter in pkg:
- pacs_to_show.append(pkg)
-
- #filtering for Package Name
+ for pkg in status.keys():
+ for repo in status[pkg].keys():
+ if buildstatus_symbols[status[pkg][repo]] in status_filter:
+ if not name_filter:
+ pacs_to_show.append(pkg)
+ targets_to_show.append(repo)
+ elif name_filter in pkg:
+ pacs_to_show.append(pkg)
+
+ #filtering for Package Name
elif name_filter:
for pkg in pacs:
if name_filter in pkg:
--
1.6.0.2

< Previous Next >
This Thread
References