From: Seth Vidal skvidal@fedoraproject.org
--- lib/python/repoinfo.py | 3 ++- lib/python/util.py | 18 ++++++++++++++++++ repoinfo.conf | 14 ++++++++++++++ tests/rpmguard/rpmguard.py | 18 ++++++++++++++---- tests/rpmlint/rpmlint.py | 18 ++++++++++++++---- 5 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/lib/python/repoinfo.py b/lib/python/repoinfo.py index f5d1044..de7332c 100644 --- a/lib/python/repoinfo.py +++ b/lib/python/repoinfo.py @@ -47,7 +47,8 @@ class RepoinfoConfig(object): 'tag': self.config.get(name,'tag'), 'url': self.config.get(name,'url'), 'path': self.config.get(name,'path'), - 'name': name # kind of unnecessary + 'name': name, # kind of unnecessary + 'collection_name': self.config.get(name, 'collection_name'), } return repo def getrepo_by_tag(self, tag): diff --git a/lib/python/util.py b/lib/python/util.py index 4a533ec..67ae699 100644 --- a/lib/python/util.py +++ b/lib/python/util.py @@ -27,6 +27,8 @@ import datetime import urlgrabber.grabber import urlgrabber.progress import config +import urllib +import socket
def timestamp_to_compose_id(timestamp=None, serial=1): if not timestamp: @@ -91,6 +93,22 @@ def checkhash(filename, algo, hexdigest): hasher.hexdigest() == hexdigest) return r
+def check_opt_in(pkgname, release): + """take a package name and release and check for an autoqa-optin file""" + + url = 'http://fedorapeople.org/packages/' + fullurl = url + '%s/%s/%s/autoqa-optin' % (name[0].lower(), name, release) + tmout = socket.getdefaulttimeout() + socket.setdefaulttimeout(5) # if it takes more than + try: + h = urllib.urlopen(fullurl) + except IOError, e: + return False + if h.getcode() == 200: + return True + return False + + grabber = urlgrabber.grabber.URLGrabber() if hasattr(sys.stdout, "fileno") and os.isatty(sys.stdout.fileno()): grabber.opts.progress_obj = urlgrabber.progress.TextMeter() diff --git a/repoinfo.conf b/repoinfo.conf index d1dc535..a3ebed4 100644 --- a/repoinfo.conf +++ b/repoinfo.conf @@ -12,66 +12,80 @@ rawhideurl = %(baseurl)s/%(path)s/%(arch)s/os arches = i386, x86_64 path = development/rawhide url = %(rawhideurl)s +collection_name = devel
[branched] arches = i386, x86_64 # path will change when Fedora 13 is released path = development/13 url = %(rawhideurl)s +collection_name = F-13
[f13] # path will change when Fedora 13 is released path = development/13 url = %(rawhideurl)s +collection_name = F-13
[f13-updates] path = 13 url = %(updatesurl)s parents = f13 +collection_name = F-13
[f13-updates-testing] path = testing/13 url = %(updatesurl)s parents = f13-updates, f13 +collection_name = F-13
[f12] path = 12 url = %(goldurl)s +collection_name = F-12
[f12-updates] path = 12 url = %(updatesurl)s parents = f12 +collection_name = F-12
[f12-updates-testing] path = testing/12 url = %(updatesurl)s parents = f12-updates, f12 +collection_name = F-12
[f11] path = 11 url = %(goldurl)s +collection_name = F-11
[f11-updates] path = 11 url = %(updatesurl)s parents = f11 +collection_name = F-11
[f11-updates-testing] path = testing/11 url = %(updatesurl)s parents = f11-updates, f11 +collection_name = F-11
[f10] path = 10 url = %(goldurl)s +collection_name = F-10
[f10-updates] path = 10 url = %(updatesurl)s parents = f10 +collection_name = F-10
[f10-updates-testing] path = testing/10 url = %(updatesurl)s parents = f10-updates, f10 +collection_name = F-10 diff --git a/tests/rpmguard/rpmguard.py b/tests/rpmguard/rpmguard.py index 61eec64..e91b1bf 100644 --- a/tests/rpmguard/rpmguard.py +++ b/tests/rpmguard/rpmguard.py @@ -23,6 +23,7 @@ from autotest_lib.client.bin.test_config import config_loader from autotest_lib.client.common_lib import error import autoqa.koji_utils import autoqa.util +from autoqa.repoinfo import repoinfo import os import rpmUtils.miscutils
@@ -175,13 +176,22 @@ rpmlint | cut -d ' ' -f 1", retain_output=True) out.write(log) out.close()
- # email results to mailing list + # email results to mailing list and to pkg owner if they optin + send_to = [] result_email = self.config.get('test','result_email') - if result_email: + if result_email and isinstance(result_email, str): + send_to = mail_to.split(',') + + collection_name = repoinfo.config.getrepo_by_tag(kojitag)['collection_name'] + if collection_name and autoqa.util.check_opt_in(name, collection_name): + #FIXME - hardcoded partial email address here - obviously sub-par + send_to.append('%s-owner@fedoraproject.org') % name + + if send_to: warning_count = len([line for line in log.splitlines() \ if line.startswith('W: ')]) - print 'Sending email with results to %s ...' % result_email - utils.send_email(mail_to=result_email, + print 'Sending email with results to %s ...' % ', '.join(send_to) + utils.send_email(mail_to=send_to, mail_from=self.config.get('test','mail_from'), mail_server=self.config.get('test','smtpserver'), subject='rpmguard: %u warnings for package %s' % \ diff --git a/tests/rpmlint/rpmlint.py b/tests/rpmlint/rpmlint.py index 7ad6f90..304d42c 100644 --- a/tests/rpmlint/rpmlint.py +++ b/tests/rpmlint/rpmlint.py @@ -22,6 +22,7 @@ from autotest_lib.client.bin.test_config import config_loader from autotest_lib.client.common_lib import error import autoqa.koji_utils, autoqa.util import os +from autoqa.repoinfo import repoinfo
class rpmlint(test.test): version = 1 # increment if setup() changes @@ -60,13 +61,22 @@ class rpmlint(test.test): out.write(self.results) out.close()
- # email results to mailing list + # email results to mailing list and to pkg owner if they optin + send_to = [] result_email = self.config.get('test','result_email') - if result_email: + if result_email and isinstance(result_email, str): + send_to = mail_to.split(',') + + collection_name = repoinfo.config.getrepo_by_tag(kojitag)['collection_name'] + if collection_name and autoqa.util.check_opt_in(name, collection_name): + #FIXME - hardcoded partial email address here - obviously sub-par + send_to.append('%s-owner@fedoraproject.org') % name + + if send_to: # parse last line for summary ('N errors, N warnings') summary = ((self.results.splitlines()[-1]).split(';')[-1])[1:-1] - print 'Sending email with results to %s ...' % result_email - utils.send_email(mail_to=result_email, + print 'Sending email with results to %s ...' % ', '.join(send_to) + utils.send_email(mail_to=send_to, mail_from=self.config.get('test','mail_from'), mail_server=self.config.get('test','smtpserver'), subject='rpmlint: %s for package %s' % \
From: Seth Vidal skvidal@fedoraproject.org
--- lib/python/util.py | 8 +++++--- tests/rpmguard/rpmguard.py | 2 +- tests/rpmlint/rpmlint.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/python/util.py b/lib/python/util.py index 67ae699..91cf566 100644 --- a/lib/python/util.py +++ b/lib/python/util.py @@ -93,17 +93,19 @@ def checkhash(filename, algo, hexdigest): hasher.hexdigest() == hexdigest) return r
-def check_opt_in(pkgname, release): +def check_opt_in(pkgname, dist_release): """take a package name and release and check for an autoqa-optin file"""
url = 'http://fedorapeople.org/packages/' - fullurl = url + '%s/%s/%s/autoqa-optin' % (name[0].lower(), name, release) + fullurl = url + '%s/%s/%s/autoqa-optin' % (name[0].lower(), name, dist_release) tmout = socket.getdefaulttimeout() - socket.setdefaulttimeout(5) # if it takes more than + socket.setdefaulttimeout(10) # if it takes more than try: h = urllib.urlopen(fullurl) except IOError, e: + socket.setdefaulttimeout(tmout) return False + socket.setdefaulttimeout(tmout) if h.getcode() == 200: return True return False diff --git a/tests/rpmguard/rpmguard.py b/tests/rpmguard/rpmguard.py index e91b1bf..bb69058 100644 --- a/tests/rpmguard/rpmguard.py +++ b/tests/rpmguard/rpmguard.py @@ -180,7 +180,7 @@ rpmlint | cut -d ' ' -f 1", retain_output=True) send_to = [] result_email = self.config.get('test','result_email') if result_email and isinstance(result_email, str): - send_to = mail_to.split(',') + send_to = result_email.split(',')
collection_name = repoinfo.config.getrepo_by_tag(kojitag)['collection_name'] if collection_name and autoqa.util.check_opt_in(name, collection_name): diff --git a/tests/rpmlint/rpmlint.py b/tests/rpmlint/rpmlint.py index 304d42c..2e345fc 100644 --- a/tests/rpmlint/rpmlint.py +++ b/tests/rpmlint/rpmlint.py @@ -65,7 +65,7 @@ class rpmlint(test.test): send_to = [] result_email = self.config.get('test','result_email') if result_email and isinstance(result_email, str): - send_to = mail_to.split(',') + send_to = result_email.split(',')
collection_name = repoinfo.config.getrepo_by_tag(kojitag)['collection_name'] if collection_name and autoqa.util.check_opt_in(name, collection_name):
On Thu, 2010-04-29 at 11:23 -0400, skvidal@fedoraproject.org wrote:
From: Seth Vidal skvidal@fedoraproject.org
lib/python/util.py | 8 +++++--- tests/rpmguard/rpmguard.py | 2 +- tests/rpmlint/rpmlint.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
With these fixups, the patch looks good to me. I'm going to apply it to master.
I'll probably modify it slightly, using Kamil's suggestion and turning off sending email unless result_email is set - i.e. local runs of the test won't send mail, but runs on the autoqa server (where result_email is set) will.
Thanks a million for the patch, Seth!
-w
On Fri, 2010-05-07 at 12:27 -0400, Will Woods wrote:
On Thu, 2010-04-29 at 11:23 -0400, skvidal@fedoraproject.org wrote:
From: Seth Vidal skvidal@fedoraproject.org
lib/python/util.py | 8 +++++--- tests/rpmguard/rpmguard.py | 2 +- tests/rpmlint/rpmlint.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
With these fixups, the patch looks good to me. I'm going to apply it to master.
I'll probably modify it slightly, using Kamil's suggestion and turning off sending email unless result_email is set - i.e. local runs of the test won't send mail, but runs on the autoqa server (where result_email is set) will.
Patch applied to master with modification I mentioned above; the complete diff is attached, for anyone who wants to review it.
-w
----- "Will Woods" wwoods@redhat.com wrote:
On Fri, 2010-05-07 at 12:27 -0400, Will Woods wrote:
On Thu, 2010-04-29 at 11:23 -0400, skvidal@fedoraproject.org wrote:
From: Seth Vidal skvidal@fedoraproject.org
lib/python/util.py | 8 +++++--- tests/rpmguard/rpmguard.py | 2 +- tests/rpmlint/rpmlint.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-)
With these fixups, the patch looks good to me. I'm going to apply it
to
master.
I'll probably modify it slightly, using Kamil's suggestion and
turning
off sending email unless result_email is set - i.e. local runs of
the
test won't send mail, but runs on the autoqa server (where
result_email
is set) will.
Patch applied to master with modification I mentioned above; the complete diff is attached, for anyone who wants to review it.
Will, this patch is currently broken:
15:15:52 INFO | FAIL rpmlint rpmlint timestamp=1273583752 localtime=May 11 15:15:52 Unhandled str: Unhandled AttributeError: SafeConfigParser instance has no attribute 'getrepo_by_tag' Traceback (most recent call last): File "/usr/share/autotest/client/common_lib/test.py", line 545, in _call_test_function return func(*args, **dargs) File "/usr/share/autotest/client/common_lib/test.py", line 261, in execute postprocess_profiled_run, args, dargs) File "/usr/share/autotest/client/common_lib/test.py", line 185, in _call_run_once self.run_once(*args, **dargs) File "/usr/share/autotest/client/site_tests/rpmlint/rpmlint.py", line 69, in run_once collection_name = repoinfo.config.getrepo_by_tag(kojitag)['collection_name'] AttributeError: SafeConfigParser instance has no attribute 'getrepo_by_tag'
There are more issues than this one (from what I remember). I know I promised to review and test it (and I did some of it), but I was really busy with all the RCs floating around. Once the release frenzy fades out I can post updated patch, unless you want to fix it yourself.
The current patch should either be uncommitted or no new autoqa build should be deployed at the moment, because the present build is currently broken.
On Tue, 2010-05-11 at 09:23 -0400, Kamil Paral wrote:
Will, this patch is currently broken:
15:15:52 INFO | FAIL rpmlint rpmlint timestamp=1273583752 localtime=May 11 15:15:52 Unhandled str: Unhandled AttributeError: SafeConfigParser instance has no attribute 'getrepo_by_tag' Traceback (most recent call last): File "/usr/share/autotest/client/common_lib/test.py", line 545, in _call_test_function return func(*args, **dargs) File "/usr/share/autotest/client/common_lib/test.py", line 261, in execute postprocess_profiled_run, args, dargs) File "/usr/share/autotest/client/common_lib/test.py", line 185, in _call_run_once self.run_once(*args, **dargs) File "/usr/share/autotest/client/site_tests/rpmlint/rpmlint.py", line 69, in run_once collection_name = repoinfo.config.getrepo_by_tag(kojitag)['collection_name'] AttributeError: SafeConfigParser instance has no attribute 'getrepo_by_tag'
There are more issues than this one (from what I remember). I know I promised to review and test it (and I did some of it), but I was really busy with all the RCs floating around. Once the release frenzy fades out I can post updated patch, unless you want to fix it yourself.
I've committed a fix, which is attached. If that doesn't work any better either revert to commit 6ce3cadb or let's work on fixing the problems.
-w
----- "Will Woods" wwoods@redhat.com wrote:
I've committed a fix, which is attached. If that doesn't work any better either revert to commit 6ce3cadb or let's work on fixing the problems.
Yes, it has other issues (still crashes). Working on it...
----- "Kamil Paral" kparal@redhat.com wrote:
----- "Will Woods" wwoods@redhat.com wrote:
I've committed a fix, which is attached. If that doesn't work any better either revert to commit 6ce3cadb or let's work on fixing the problems.
Yes, it has other issues (still crashes). Working on it...
Committed in 2b1f3c8aa25beb91d2d4b5bba00e2d50f5d4d608. It should work now.
autoqa-devel@lists.fedorahosted.org