Skip to contentSkip to conversation

archiver: don't require that images are built using RPM to build SRPMs

PATCH New Ross Burton 1 participant 1 message Jan 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 archiver: don't require that images are built using RPM to build SRPMs

The requirement for images being built using RPM is too strict to have access to the RPM functions, simply checking that package_rpm is in PACKAGE_CLASSES is sufficient.

Also fail if SRPMs are requested but package_rpm isn't enabled, instead of silently not doing what we were asked.

---
 meta/classes/archiver.bbclass | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
meta/classes/archiver.bbclass +5 -4
index ec80ad47a40..0a9c5c16403 100644
@@ -114,10 +114,9 @@ python () {
     if ar_recipe == "1":
         d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_recipe' % pn)
 
-    # Output the srpm package
-    ar_srpm = d.getVarFlag('ARCHIVER_MODE', 'srpm')
-    if ar_srpm == "1":
-        if d.getVar('PACKAGES') != '' and d.getVar('IMAGE_PKGTYPE') == 'rpm':
+    # Output the SRPM package
+    if d.getVarFlag('ARCHIVER_MODE', 'srpm') == "1" and d.getVar('PACKAGES'):
+        if "package_rpm" in d.getVar('PACKAGE_CLASSES'):
             d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn)
             if ar_dumpdata == "1":
                 d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn)
@@ -129,6 +128,8 @@ python () {
                 d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_patched' % pn)
             elif ar_src == "configured":
                 d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_configured' % pn)
+        else:
+            bb.fatal("ARCHIVER_MODE[srpm] needs package_rpm in PACKAGE_CLASSES")
 }
 
 # Take all the sources for a recipe and puts them in WORKDIR/archiver-work/.
Signature · 1 line
2.11.0