浏览代码

swupdate: check dependencies with defconfig

Instead of building with all possible options,
check the "defconfig" file and adds dependencies
based on requested features.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Stefano Babic 9 年之前
父节点
当前提交
8c4e6a3a1d
共有 1 个文件被更改,包括 45 次插入1 次删除
  1. 45 1
      recipes-support/swupdate/swupdate.inc

+ 45 - 1
recipes-support/swupdate/swupdate.inc

@@ -1,7 +1,7 @@
 SUMMARY="Image updater for Yocto projects"
 DESCRIPTION = "Application for automatic software update from USB Pen"
 SECTION="swupdate"
-DEPENDS = "mtd-utils libconfig libarchive openssl lua curl json-c u-boot-fw-utils gnutls zeromq"
+DEPENDS = "libconfig openssl gnutls"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 
@@ -26,6 +26,50 @@ S = "${WORKDIR}/git/"
 
 EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
 
+python () {
+    try:
+        defconfig = bb.fetch2.localpath('file://defconfig', d)
+    except bb.fetch2.FetchError:
+        return
+
+    try:
+        configfile = open(defconfig)
+    except IOError:
+        return
+
+    features = configfile.readlines()
+    configfile.close()
+
+    if 'CONFIG_REMOTE_HANDLER=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' zeromq')
+
+    if 'CONFIG_JSON=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' json-c')
+
+    if 'CONFIG_ARCHIVE=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' libarchive')
+
+    if 'CONFIG_LUA=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' lua')
+
+    if 'CONFIG_UBOOT=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' u-boot-fw-utils')
+
+    if 'CONFIG_DOWNLOAD=y\n' in features or 'CONFIG_SURICATTA=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' curl')
+
+    if 'CONFIG_MTD=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' mtd-utils')
+
+}
+
 do_configure () {
   cp ${WORKDIR}/defconfig ${S}/.config
   cml1_do_configure