stop using epoch in NVR variables
We have found out that Koji has NVR as an unique identifies (though it
support epochs). That means we don't have to get messy with all that
epoch thingy if not necessary, working with NVR is usually sufficient.
This patch converts all ENVR references to NVR ones, where appropriate.
Let's have it simpler.
diff --git a/hooks/post-bodhi-update/README b/hooks/post-bodhi-update/README
index 4e72282..38460ce 100644
--- a/hooks/post-bodhi-update/README
+++ b/hooks/post-bodhi-update/README
@@ -10,13 +10,13 @@ The required arguments are:
plus one of:
--updateid: the bodhi-provided Update ID for this update, or
--title: the title of the update
-and finally a list of the ENVRs of the package builds in this update.
+and finally a list of the NVRs of the package builds in this update.
AutoQA tests can expect the following variables from post-bodhi-update hook:
name: title of the update request (one of 'name' or 'id' may be empty)
id: Unique ID of the update request (one of 'name' or 'id' may be empty)
kojitag: target koji tag for this update
- envrs: list of package envrs in this update request
+ nvrs: list of package NVRs in this update request
NOTE:
The watcher is actually in the post-koji-build directory.
diff --git a/hooks/post-bodhi-update/hook.py b/hooks/post-bodhi-update/hook.py
index bb9d14c..b6e3a50 100644
--- a/hooks/post-bodhi-update/hook.py
+++ b/hooks/post-bodhi-update/hook.py
@@ -25,7 +25,7 @@ name = 'post-bodhi-update'
def extend_parser(parser):
'''Extend the given OptionParser object with settings for this hook.'''
- parser.set_usage('%%prog %s [options] PKG_ENVR [PKG_ENVR ...]' % name)
+ parser.set_usage('%%prog %s [options] PKG_NVR [PKG_NVR ...]' % name)
group = optparse.OptionGroup(parser, '%s options' % name)
group.add_option('--title', default='',
help='Title for the given update')
@@ -44,13 +44,13 @@ def process_testdata(parser, opts, args, **extra):
populated.'''
if not args:
- parser.error('No ENVR was specified as a test argument!')
+ parser.error('No NVR was specified as a test argument!')
if not opts.targettag:
parser.error('--target-tag is a mandatory option!')
if not opts.title and not opts.updateid:
parser.error('At least one of --title or --updateid must be supplied!')
- testdata = {'envrs': args,
+ testdata = {'nvrs': args,
'kojitag': opts.targettag,
'id': opts.updateid,
'name': opts.title}
diff --git a/hooks/post-koji-build/README b/hooks/post-koji-build/README
index 2989bb9..7b4a4f1 100644
--- a/hooks/post-koji-build/README
+++ b/hooks/post-koji-build/README
@@ -5,9 +5,9 @@ to ensure the changes are reasonable, simple functional tests, etc.
The required arguments are:
--kojitag: the koji tag applied to the new build (e.g. dist-f14-updates-candidate)
-and finally the ENVR of the package build to be tested.
+and finally the NVR of the package build to be tested.
AutoQA tests can expect the following variables from post-koji-build hook:
- envr: package ENVR (epoch may be skipped if 0)
+ nvr: package NVR
name: package name
kojitag: koji tag applied to this package
diff --git a/hooks/post-koji-build/hook.py b/hooks/post-koji-build/hook.py
index af29b59..d0f5619 100644
--- a/hooks/post-koji-build/hook.py
+++ b/hooks/post-koji-build/hook.py
@@ -26,7 +26,7 @@ name = 'post-koji-build'
def extend_parser(parser):
'''Extend the given OptionParser object with settings for this hook.'''
- parser.set_usage('%%prog %s [options] PACKAGE_ENVR' % name)
+ parser.set_usage('%%prog %s [options] PACKAGE_NVR' % name)
group = optparse.OptionGroup(parser, '%s options' % name)
group.add_option('-k', '--kojitag', default='',
help='Koji tag that has just been applied to this new build')
@@ -41,14 +41,14 @@ def process_testdata(parser, opts, args, **extra):
populated.'''
if not args:
- parser.error('No ENVR was specified as a test argument!')
+ parser.error('No NVR was specified as a test argument!')
if not opts.kojitag:
parser.error('--kojitag is a mandatory option!')
- # parse name from ENVR
- envr = args[0]
- nvrea = rpmUtils.miscutils.splitFilename(envr + '.noarch')
+ # parse name from NVR
+ nvr = args[0]
+ nvrea = rpmUtils.miscutils.splitFilename(nvr + '.noarch')
name = nvrea[0]
- testdata = {'envr': envr, 'kojitag': opts.kojitag, 'name': name}
+ testdata = {'nvr': nvr, 'kojitag': opts.kojitag, 'name': name}
return testdata
diff --git a/hooks/post-koji-build/watch-koji-builds.py b/hooks/post-koji-build/watch-koji-builds.py
index 0d37600..c05a1de 100755
--- a/hooks/post-koji-build/watch-koji-builds.py
+++ b/hooks/post-koji-build/watch-koji-builds.py
@@ -375,11 +375,8 @@ class KojiWatcher(object):
for arch in testarches:
harnesscall += ['--arch', arch]
- if b['epoch']:
- envr = '%s:%s' % (b['epoch'], b['nvr'])
- else:
- envr = b['nvr']
- harnesscall.append(envr)
+ nvr = b['nvr']
+ harnesscall.append(nvr)
# if some builds were skipped during bodhi-event planning
# add the nvrs to the respective call
@@ -416,7 +413,7 @@ class KojiWatcher(object):
if len(new_builds[tag]) == 0:
continue
harness_arches = set()
- harness_envrs = []
+ harness_nvrs = []
p_tag = tag.replace('-pending', '')
repoarches = set(repoinfo.getrepo_by_tag(p_tag).get("arches"))
@@ -429,12 +426,8 @@ class KojiWatcher(object):
testarches = set(repoarches).intersection(arches)
harness_arches.update(testarches)
- if b['epoch']:
- envr = '%s:%s' % (b['epoch'], b['nvr'])
- else:
- envr = b['nvr']
-
- harness_envrs.append(envr)
+ nvr = b['nvr']
+ harness_nvrs.append(nvr)
harnesscall = ['autoqa']
# bodhi events
@@ -447,7 +440,7 @@ class KojiWatcher(object):
for a in harness_arches:
harnesscall += ['--arch', a]
- harnesscall.extend(harness_envrs)
+ harnesscall.extend(harness_nvrs)
if self.dry_run or self.verbose:
print " ".join(harnesscall)
diff --git a/lib/python/koji_utils.py b/lib/python/koji_utils.py
index 84c4959..7290680 100644
--- a/lib/python/koji_utils.py
+++ b/lib/python/koji_utils.py
@@ -48,7 +48,7 @@ class SimpleKojiClientSession(koji.ClientSession):
def latest_by_tag(self, tag, pkgname, max_evr=None):
'''Get the latest package for the given name in the given tag. If you
- set max_nvr, it is *exclusive*.
+ set max_evr, it is *exclusive*.
max_evr = (epoch, version, release)
'''
# allow epoch to be empty, transcode it to zero
diff --git a/tests/anaconda_storage/anaconda_storage.py b/tests/anaconda_storage/anaconda_storage.py
index 51f5044..24ff43f 100755
--- a/tests/anaconda_storage/anaconda_storage.py
+++ b/tests/anaconda_storage/anaconda_storage.py
@@ -55,10 +55,10 @@ class anaconda_storage(AutoQATest):
# Build arguments for the test script (runtest.py)
repos = []
if kwargs.get("hook","") == "post-koji-build":
- envr = kwargs.get('envr','')
+ nvr = kwargs.get('nvr','')
kojitag = kwargs.get('kojitag','')
name = kwargs.get('name','')
- assert envr.startswith("anaconda"), "This test is only applies to anaconda (not '%s')" % envr
+ assert nvr.startswith("anaconda"), "This test is only applies to anaconda (not '%s')" % nvr
# Add requested repo
repo = repoinfo.getrepo_by_tag(kojitag)
diff --git a/tests/compose_tree/compose_tree.py b/tests/compose_tree/compose_tree.py
index 4a662fb..9e7c5d7 100644
--- a/tests/compose_tree/compose_tree.py
+++ b/tests/compose_tree/compose_tree.py
@@ -47,8 +47,8 @@ class compose_tree(AutoQATest):
assert kwargs['hook'] in ['post-koji-build',], \
'Unexpected hook argument: %s' % kwargs['hook']
- assert kwargs.has_key('envr'), \
- 'Missing required argument: envr'
+ assert kwargs.has_key('nvr'), \
+ 'Missing required argument: nvr'
assert kwargs.has_key('kojitag'), \
'Missing required argument: kojitag'
@@ -71,7 +71,7 @@ class compose_tree(AutoQATest):
# Run test
cmd = '%s/compose_tree.sh -r %s -d %s -e "%s" ' % (self.bindir, \
- releasever, self.resultsdir, kwargs.get('envr'))
+ releasever, self.resultsdir, kwargs.get('nvr'))
cmd = 'su -c "%s" - autotest' % cmd
try:
out = utils.system_output(cmd, retain_output=True)
diff --git a/tests/compose_tree/compose_tree.sh b/tests/compose_tree/compose_tree.sh
index 4863832..b5e67e9 100755
--- a/tests/compose_tree/compose_tree.sh
+++ b/tests/compose_tree/compose_tree.sh
@@ -10,7 +10,7 @@ Options:
fedora-14, fedora-rawhide)
-a ARCH Value used for \$basearch
-d RESULTDIR Directory to store results (default: \$PWD)
- -e ENVR One or more RPM ENVR's to download from koji
+ -e NVR One or more RPM NVR's to download from koji
-t TMPDIR Temporary directory to use (default: /tmp)
EOF
exit 1
@@ -27,7 +27,7 @@ detect_releasever() {
elif [ -f /etc/redhat-release -a ! -L /etc/redhat-release ]; then
RELEASE="epel"
VER=$(gawk '{print $5}' /etc/redhat-release)
- case $VER in
+ case $VER in
4* ) VER=4 ;;
5* ) VER=5 ;;
6* ) VER=6 ;;
@@ -56,7 +56,7 @@ BASEARCH=$(uname -i)
RELEASEVER=$(detect_releasever)
RESULTSDIR=${PWD}/results/$(date +%Y%m%d)
TMPDIR=/tmp
-ENVR=""
+NVR=""
MOCKDIR=/etc/mock
# Process arguments
@@ -67,7 +67,7 @@ do
r ) RELEASEVER=$OPTARG ;;
d ) RESULTSDIR=$OPTARG ;;
t ) TMPDIR=$OPTARG ;;
- e ) ENVR=$OPTARG ;;
+ e ) NVR=$OPTARG ;;
\?|h ) usage ;;
* ) usage ;;
esac
@@ -92,7 +92,7 @@ cat > ${SETUP} << EOF
#!/bin/sh
## Use koji to download updated packages
-for E in ${ENVR}
+for E in ${NVR}
do
koji download-build --arch noarch --arch ${BASEARCH} \$E
done
@@ -101,7 +101,7 @@ done
yum -y localupdate *.rpm
## Make sure the requested packages were installed
-rpm -q ${ENVR}
+rpm -q ${NVR}
exit \$?
EOF
diff --git a/tests/initscripts/control.autoqa b/tests/initscripts/control.autoqa
index 00ed666..1fede00 100644
--- a/tests/initscripts/control.autoqa
+++ b/tests/initscripts/control.autoqa
@@ -6,11 +6,11 @@
labels = ['virt']
# because we install the package, the autotest label of the correct distribution
-# must be present (like 'fc13'); strip it from the envr (last part)
-if autoqa_args.has_key('envr'):
- labels.append(autoqa_args['envr'].split('.')[-1])
+# must be present (like 'fc13'); strip it from the NVR (last part)
+if autoqa_args.has_key('nvr'):
+ labels.append(autoqa_args['nvr'].split('.')[-1])
-# we want to run initscripts just for post-koji-build for now
+# we want to run initscripts just for post-koji-build for now
# (and post-bodhi-build in the near future)
if hook not in ['post-koji-build']:
execute = False
diff --git a/tests/initscripts/initscripts.py b/tests/initscripts/initscripts.py
index 51462c9..2261ceb 100644
--- a/tests/initscripts/initscripts.py
+++ b/tests/initscripts/initscripts.py
@@ -104,10 +104,10 @@ class initscripts(AutoQATest):
def run_once(self, kojitag, **kwargs):
super(self.__class__, self).run_once()
if kwargs['hook'] == 'post-koji-build':
- envrs = [kwargs['envr']]
- update_id = kwargs['envr']
+ nvrs = [kwargs['nvr']]
+ update_id = kwargs['nvr']
elif kwargs['hook'] == 'post-bodhi-update':
- envrs = kwargs['envrs']
+ nvrs = kwargs['nvrs']
update_id = kwargs['name'] or kwargs['id']
self.result = 'PASSED'
@@ -117,13 +117,13 @@ class initscripts(AutoQATest):
self.outputs = []
self.highlights = []
- for envr in envrs:
+ for nvr in nvrs:
# add header
- msg = '%s\n%s\n%s' % ('='*40, envr, '='*40)
+ msg = '%s\n%s\n%s' % ('='*40, nvr, '='*40)
print msg
self.outputs.append(msg)
#find all tests for package $name
- nvrea = rpmUtils.miscutils.splitFilename(envr + '.noarch')
+ nvrea = rpmUtils.miscutils.splitFilename(nvr + '.noarch')
name = nvrea[0]
testdir = os.path.join(self.bindir, "./tests/%s" % name)
assert os.path.isdir(testdir), "No initscript checker found for package %s" % name
@@ -140,7 +140,7 @@ class initscripts(AutoQATest):
#install packages from koji
koji = autoqa.koji_utils.SimpleKojiClientSession()
- pkgurls = koji.nvr_to_urls(envr, arches = os.uname()[-1])
+ pkgurls = koji.nvr_to_urls(nvr, arches = os.uname()[-1])
rpms = []
print "Saving RPMs to %s" % self.rpmdir
#download packages
diff --git a/tests/rpmguard/rpmguard.py b/tests/rpmguard/rpmguard.py
index faba8e0..c51a9a1 100644
--- a/tests/rpmguard/rpmguard.py
+++ b/tests/rpmguard/rpmguard.py
@@ -46,28 +46,28 @@ class rpmguard(AutoQATest):
def run_once(self, kojitag, **kwargs):
super(self.__class__, self).run_once()
if kwargs['hook'] == 'post-koji-build':
- envrs = [kwargs['envr']]
- update_id = kwargs['envr']
+ nvrs = [kwargs['nvr']]
+ update_id = kwargs['nvr']
elif kwargs['hook'] == 'post-bodhi-update':
- envrs = kwargs['envrs']
+ nvrs = kwargs['nvrs']
update_id = kwargs['name'] or kwargs['id']
self.result = 'PASSED'
# order for evaluation of final result; higher index means preference
self.result_order = ('PASSED','INFO','FAILED','ABORTED')
- self.envr_results = {} # results for invidual packages
+ self.nvr_results = {} # results for invidual packages
self.outputs = []
self.highlights = []
- for envr in envrs:
+ for nvr in nvrs:
# add header
- msg = '%s\n%s\n%s' % ('='*40, envr, '='*40)
+ msg = '%s\n%s\n%s' % ('='*40, nvr, '='*40)
print msg
self.outputs.append(msg)
- # run the test for this envr
- (result, highlights, outputs, warn_count) = self.test_envr(envr, kojitag)
+ # run the test for this nvr
+ (result, highlights, outputs, warn_count) = self.test_nvr(nvr, kojitag)
# collect output
- self.envr_results[envr] = result
+ self.nvr_results[nvr] = result
if self.result_order.index(result) > self.result_order.index(self.result):
self.result = result
if highlights:
@@ -82,7 +82,7 @@ class rpmguard(AutoQATest):
# email results to mailing list and to pkg owner if they optin
repo = repoinfo.getrepo_by_tag(kojitag)
- pkg_name = rpmUtils.miscutils.splitFilename(envr + '.noarch')[0]
+ pkg_name = rpmUtils.miscutils.splitFilename(nvr + '.noarch')[0]
send_optin_email = getbool(self.config.get('notifications', 'send_optin_email'))
if repo is not None and send_optin_email and \
autoqa.util.check_opt_in(pkg_name, repo['collection_name']):
@@ -99,16 +99,16 @@ class rpmguard(AutoQATest):
# create result line like "1 PASSED, 2 FAILED, 3 INFO"
result_count = []
for res in self.result_order:
- if res in self.envr_results.values():
- count = len([k for k in self.envr_results.keys() if self.envr_results[k] == res])
+ if res in self.nvr_results.values():
+ count = len([k for k in self.nvr_results.keys() if self.nvr_results[k] == res])
result_count.append('%d %s' % (count, res))
result_count = ', '.join(result_count)
self.summary = '%s for %s' % (result_count, update_id)
- def test_envr(self, envr, kojitag):
+ def test_nvr(self, nvr, kojitag):
'''
- Test a single ENVR.
+ Test a single NVR.
Returns (result, highlights, outputs, warn_count).
'''
result = 'PASSED'
@@ -127,20 +127,20 @@ class rpmguard(AutoQATest):
# get the most recent release available
# add .noarch to parse filename correctly
- nvrea = rpmUtils.miscutils.splitFilename(envr + '.noarch')
+ nvrea = rpmUtils.miscutils.splitFilename(nvr + '.noarch')
name = nvrea[0]
lastBuild = koji.list_previous_release(name, kojitag,
max_evr=(nvrea[3], nvrea[1], nvrea[2]))
# if there is no such build, we don't have anything to compare
if not lastBuild:
- msg = "N: There is no previous build of %s in %s tag (or its parents)." % (envr, kojitag)
+ msg = "N: There is no previous build of %s in %s tag (or its parents)." % (nvr, kojitag)
print msg
outputs.append(msg)
return get_result()
# now we need list of RPMs available for each build
- new_rpms = koji.nvr_to_rpms(envr, src=False)
+ new_rpms = koji.nvr_to_rpms(nvr, src=False)
old_rpms = koji.nvr_to_rpms(lastBuild['nvr'], src=False)
# and match the RPMs according to build name and architecture as
# (old one, new one)
diff --git a/tests/rpmlint/rpmlint.py b/tests/rpmlint/rpmlint.py
index b1ebb35..73d798f 100644
--- a/tests/rpmlint/rpmlint.py
+++ b/tests/rpmlint/rpmlint.py
@@ -46,24 +46,24 @@ class rpmlint(AutoQATest):
def run_once(self, kojitag, **kwargs):
super(self.__class__, self).run_once()
if kwargs['hook'] == 'post-koji-build':
- envrs = [kwargs['envr']]
- update_id = kwargs['envr']
+ nvrs = [kwargs['nvr']]
+ update_id = kwargs['nvr']
elif kwargs['hook'] == 'post-bodhi-update':
- envrs = kwargs['envrs']
+ nvrs = kwargs['nvrs']
update_id = kwargs['name'] or kwargs['id']
self.result = 'PASSED'
# order for evaluation of final result; higher index means preference
self.result_order = ('PASSED','INFO','FAILED','ABORTED')
- self.envr_results = {} # results for invidual packages
+ self.nvr_results = {} # results for invidual packages
self.outputs = []
self.highlights = []
koji = autoqa.koji_utils.SimpleKojiClientSession()
- for envr in envrs:
+ for nvr in nvrs:
# add header
- msg = '%s\n%s\n%s' % ('='*40, envr, '='*40)
+ msg = '%s\n%s\n%s' % ('='*40, nvr, '='*40)
print msg
self.outputs.append(msg)
@@ -74,7 +74,7 @@ class rpmlint(AutoQATest):
os.remove(os.path.join(self.rpmdir, rpm))
# download packages
- pkgurls = koji.nvr_to_urls(envr)
+ pkgurls = koji.nvr_to_urls(nvr)
print "Saving RPMs to %s" % self.rpmdir
for p in pkgurls:
print "Grabbing %s" % p
@@ -109,14 +109,14 @@ class rpmlint(AutoQATest):
result = 'INFO'
# collect output
- self.envr_results[envr] = result
+ self.nvr_results[nvr] = result
if self.result_order.index(result) > self.result_order.index(self.result):
self.result = result
self.outputs.append(outputs)
# email results to mailing list and to pkg owner if they optin
repo = repoinfo.getrepo_by_tag(kojitag)
- pkg_name = rpmUtils.miscutils.splitFilename(envr + '.noarch')[0]
+ pkg_name = rpmUtils.miscutils.splitFilename(nvr + '.noarch')[0]
send_optin_email = getbool(self.config.get('notifications', 'send_optin_email'))
if repo is not None and send_optin_email and \
autoqa.util.check_opt_in(pkg_name, repo['collection_name']):
@@ -133,8 +133,8 @@ class rpmlint(AutoQATest):
# create result line like "1 PASSED, 2 FAILED, 3 INFO"
result_count = []
for res in self.result_order:
- if res in self.envr_results.values():
- count = len([k for k in self.envr_results.keys() if self.envr_results[k] == res])
+ if res in self.nvr_results.values():
+ count = len([k for k in self.nvr_results.keys() if self.nvr_results[k] == res])
result_count.append('%d %s' % (count, res))
result_count = ', '.join(result_count)
self.summary = '%s for %s' % (result_count, update_id)