Skip to contentSkip to conversation

selftest/signing: Use packagedata to obtain PR value for signing test

PATCH New Richard Purdie 1 participant 1 message Mar 31, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftest/signing: Use packagedata to obtain PR value for signing test

Using PF to calculate the rpm filename doesn't work when PR server is enabled and an extra PR value can be injected. Add code to use packagedata to obtain the full name, allowing the test to work when PR server is in use.

meta/lib/oeqa/selftest/signing.py +7 -1
index 312e502..681a959 100644
@@ -46,6 +46,7 @@ class Signing(oeSelfTest):
         Author:      Daniel Istrate <[email protected]>
         AutomatedBy: Daniel Istrate <[email protected]>
         """
+        import oe.packagedata
 
         package_classes = get_bb_var('PACKAGE_CLASSES')
         if 'package_rpm' not in package_classes:
@@ -65,13 +66,18 @@ class Signing(oeSelfTest):
         bitbake(test_recipe)
         self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
 
-        pf = get_bb_var('PF', test_recipe)
+        pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe)
+        pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed")
+        if 'PKGE' in pkgdata:
+            pf = pkgdata['PN'] + "-" + pkgdata['PKGE'] + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
+        else:
+            pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
         deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe)
         package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_')
         staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE')
 
         pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm')))
 
         # Use a temporary rpmdb
         rpmdb = tempfile.mkdtemp(prefix='oeqa-rpmdb')