Re: [PATCH] keep control files on dry run
by Kamil Paral
Because nobody argued and to speed things up a little bit, I have
taken the liberty to commit it.
----- "Kamil Páral" <kparal(a)redhat.com> wrote:
> When using dry run, it's almost certain the user will want to inspect
> contents of the config file, so let's keep it on the disk
> automatically.
> ---
> autoqa | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/autoqa b/autoqa
> index 5723498..10f53f9 100755
> --- a/autoqa
> +++ b/autoqa
> @@ -132,7 +132,8 @@ parser.add_option('-t', '--test',
> action='append',
> parser.add_option('--keep-control-file', action='store_true',
> help='Do not delete generated control files')
> parser.add_option('--dryrun', '--dry-run', action='store_true',
> dest='dryrun',
> - help='Do not actually execute commands, just show what would be
> done')
> + help='Do not actually execute commands, just show what would be
> done \
> +(implies --keep-control-file)')
> parser.add_option('--local', action='store_true', dest='local',
> help='Do not schedule jobs - run test(s) directly on the local
> machine')
> parser.add_option('-l', '--list-tests', action='store_true',
> dest='listtests',
> @@ -218,7 +219,7 @@ for arch in archlist:
> if retval != 0:
> print "ERROR: failed to schedule job %s" % testname
>
> - if opts.keep_control_file:
> + if opts.keep_control_file or opts.dryrun:
> print "keeping %s at user request" % control
> else:
> os.remove(control)
> --
> 1.6.5.2
>
> _______________________________________________
> autoqa-devel mailing list
> autoqa-devel(a)lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/autoqa-devel
14 years, 5 months
Remove any keywords that aren't attributes of Tree()
by James Laska
Greetings,
I'm not sure why this wasn't a problem when connecting to irb when run as a stand-alone service on port 8080. However, when run through wsgi, it was preventing rats_sanity from getting a list of trees ("/get_trees) when posting results to irb. The attached patch addresses the problem.
Thanks,
James
14 years, 5 months
architecture for tests
by Kamil Paral
I have a question, how does a test (rpmguard in my case)
know, which architecture to test? This is a method header:
def run_once(self, nvr, name, kojitag):
I receive the package NVR, but architecture is not included
in that. On the other hand, the architecture is communicated
from the watcher to the harness:
autoqa post-koji-build --name vim --kojitag dist-f10-updates-candidate --arch x86_64 vim-7.2.315-1.fc10
I have looked at rpmlint test and it simply tests
all architectures of a NVR. But is that correct?
Because if one architecture is built sooner then the other,
say x86_64 sooner then i686, then our tests may pick it up
in that moment and test only x86_64 arch. After a while when
we check again:
1) will we test the i686 arch, or will we consider this NVR
as "done"?
2) if we pick up the NVR again, won't we test now both
architectures (and therefore report x86_64 errors twice)?
Thanks for explanation.
14 years, 5 months
[PATCH] fix traceback on 'autoqa post-koji-build -l'
by Kamil Paral
I don't know if this patch is the best solution, I would have to study the
code longer, but it certainly fixes the traceback:
Traceback (most recent call last):
File "/usr/bin/autoqa", line 166, in <module>
testlist = hook.process_testlist(opts, args, testlist)
File "/usr/share/autoqa/post-koji-build/hook.py", line 31, in process_testlist
if 'x86_64' not in opts.arch and 'rpmlint' in testlist:
TypeError: argument of type 'NoneType' is not iterable
14 years, 5 months
[PATCH] provide --help and --dry-run for all watchers
by Kamil Paral
All the watchers have standardized --help and --dry-run now. This will
ease the development of your own tests. Koji watcher was modified not to
save any information in dry run (in compliance with other watchers).
---
hooks/post-koji-build/watch-koji-builds.py | 30 ++++++++++++++++++---------
hooks/post-repo-update/watch-repos.py | 10 +++++++-
hooks/post-tree-compose/watch-composes.py | 10 +++++++-
3 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/hooks/post-koji-build/watch-koji-builds.py b/hooks/post-koji-build/watch-koji-builds.py
index 6a27aee..19b6a60 100755
--- a/hooks/post-koji-build/watch-koji-builds.py
+++ b/hooks/post-koji-build/watch-koji-builds.py
@@ -16,6 +16,7 @@ import time
import pickle
import xmlrpclib
import subprocess
+import optparse
from autoqa import koji_utils
# Directory where we cache info between runs
@@ -60,7 +61,7 @@ def save_list(pkglist):
pickle.dump(pkglist, out)
out.close()
-def new_tagged_builds_since(session, taglist, prevtime):
+def new_builds_since(session, taglist, prevtime):
untagged_builds = []
tagged_builds = {}
for tag in taglist:
@@ -78,19 +79,25 @@ def new_tagged_builds_since(session, taglist, prevtime):
untagged_builds.append(nvr)
#print "untagged: %s" % " ".join(untagged_builds)
#print "tagged: %s" % " ".join(tagged_builds)
- save_list(untagged_builds)
- return tagged_builds
+ return (tagged_builds, untagged_builds)
if __name__ == '__main__':
- # TODO: optparse for verbose/prevtime/dryrun
- verbose = ('--verbose' in sys.argv)
- dryrun = ('--dryrun' in sys.argv)
+ # Set up the option parser
+ # TODO: optparse for prevtime
+ parser = optparse.OptionParser(description='Script to watch a set of koji \
+tags for new builds and kick off tests when new builds/packages are found.')
+ parser.add_option('--dry-run', action='store_true', dest='dryrun',
+ help='Do not actually execute commands, just show what would be done')
+ parser.add_option('--verbose', action='store_true',
+ help='Print extra information')
+ (opts, args) = parser.parse_args()
+
# load prevtime from some saved timestamp
prevtime = get_prevtime()
if not prevtime:
print "No previous run - checking builds in the past 3 hours"
prevtime = time.time() - 10800
- if verbose:
+ if opts.verbose:
print "Looking up builds since %s" % time.ctime(prevtime)
# Set up the koji connection
kojiopts = {} # Possible items: user, password, debug_xmlrpc, debug..
@@ -99,8 +106,11 @@ if __name__ == '__main__':
tagged_builds = []
try:
session.ensure_connection()
- new_builds = new_tagged_builds_since(session, taglist, prevtime)
- for tag, builds in new_builds.items():
+ (tagged_builds, untagged_builds) = new_builds_since(session,
+ taglist, prevtime)
+ if not opts.dryrun:
+ save_list(untagged_builds)
+ for tag, builds in tagged_builds.items():
for b in builds:
# Get a list of all package arches in this build
arches = [r['arch'] for r in session.listRPMs(b['build_id'])]
@@ -116,7 +126,7 @@ if __name__ == '__main__':
for arch in testarches:
harnesscall += ['--arch', arch]
harnesscall.append(b['nvr'])
- if dryrun:
+ if opts.dryrun:
print " ".join(harnesscall)
continue
subprocess.call(harnesscall)
diff --git a/hooks/post-repo-update/watch-repos.py b/hooks/post-repo-update/watch-repos.py
index 7f96264..3de5083 100755
--- a/hooks/post-repo-update/watch-repos.py
+++ b/hooks/post-repo-update/watch-repos.py
@@ -13,8 +13,14 @@ import os
import sys
import subprocess
from autoqa.repoinfo import repoinfo
+import optparse
-dryrun = ('--dryrun' in sys.argv)
+# Set up the option parser
+parser = optparse.OptionParser(description='A utility to watch a set of repos \
+for changes and to kick off tests if the repo changes.')
+parser.add_option('--dry-run', action='store_true', dest='dryrun',
+ help='Do not actually execute commands, just show what would be done')
+(opts, args) = parser.parse_args()
# Set the default arch to our placeholder, '%a'
repoinfo.setarch('%%a') # two %% because of ConfigParser interpolation
@@ -69,7 +75,7 @@ for reponame, arches in testable.items():
harnesscall += ['--parent', repoinfo.get(preponame,'url')]
harnesscall.append(repo['url'])
- if dryrun:
+ if opts.dryrun:
print ' '.join(harnesscall)
continue
diff --git a/hooks/post-tree-compose/watch-composes.py b/hooks/post-tree-compose/watch-composes.py
index 868cd71..6fc3632 100755
--- a/hooks/post-tree-compose/watch-composes.py
+++ b/hooks/post-tree-compose/watch-composes.py
@@ -13,8 +13,14 @@ import os
import sys
import subprocess
from autoqa.repoinfo import repoinfo
+import optparse
-dryrun = ('--dryrun' in sys.argv)
+# Set up the option parser
+parser = optparse.OptionParser(description='A utility to watch a set of \
+compose trees for changes and to kick off tests if the compose changes.')
+parser.add_option('--dry-run', action='store_true', dest='dryrun',
+ help='Do not actually execute commands, just show what would be done')
+(opts, args) = parser.parse_args()
# Set the default arch to our placeholder, '%a'
repoinfo.setarch('%%a') # two %% because of ConfigParser interpolation
@@ -70,7 +76,7 @@ for reponame, arches in testable.items():
for arch in arches:
harnesscall += ['--arch', arch]
harnesscall.append(repo['url'])
- if dryrun:
+ if opts.dryrun:
print ' '.join(harnesscall)
continue
--
1.6.5.2
14 years, 5 months