Explorar o código

Merge pull request #3 from jviguera/jethro-next

Cherry-pick fixes from master to jethro
Stefano Babic %!s(int64=9) %!d(string=hai) anos
pai
achega
de08e6f72c

+ 1 - 1
classes/swupdate.bbclass

@@ -80,7 +80,7 @@ do_package_write_rpm[noexec] = "1"
 
 python () {
     deps = " " + swupdate_getdepends(d)
-    d.appendVarFlag('do_build', 'depends', deps)
+    d.appendVarFlag('do_swuimage', 'depends', deps)
 }
 
 do_install () {

+ 1 - 1
recipes-extended/images/bbb-swu-image.bb

@@ -5,7 +5,7 @@ DESCRIPTION = "Example Compound image for beaglebone "
 SECTION = ""
 
 # Note: sw-description is mandatory
-SRC_URI = "file://sw-description \
+SRC_URI_beaglebone = "file://sw-description \
            "
 inherit swupdate
 

+ 1 - 1
recipes-extended/images/swupdate-image.bb

@@ -10,7 +10,7 @@ IMAGE_INSTALL = "base-files \
 		libconfig \
 		swupdate \
 		swupdate-www \
-                ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'initscripts-swupdate u-boot-fw-utils', 'initscripts sysvinit', d)} \
+                ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'initscripts-swupdate', 'initscripts sysvinit', d)} \
 		util-linux-sfdisk \
 		 "
 

+ 72 - 9
recipes-support/swupdate/swupdate.inc

@@ -1,33 +1,91 @@
 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"
+DEPENDS = "libconfig openssl gnutls"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 
-inherit cml1
+inherit cml1 update-rc.d systemd
 
 SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=git \
      file://defconfig \
+     file://swupdate \
+     file://swupdate.service \
      "
 
+SRCREV = "${AUTOREV}"
+
 PACKAGES =+ "${PN}-www"
 
 FILES_${PN}-www = "/www/*"
 FILES_${PN}-dev = "${includedir}"
 FILES_${PN}-staticdev = "${libdir}"
-FILES_${PN} = "${bindir}/* /etc/init.d"
-CONFFILES_${PN} += "${sysconfdir}/init.d/recovery"
+FILES_${PN} = "${bindir}/* /etc"
 
 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
 }
 
+do_compile() {
+  unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+  oe_runmake swupdate_unstripped
+  cp swupdate_unstripped swupdate
+
+  if [ "${@bb.utils.vercmp_string('${PV}', '2016.07')}" = "1"  ]; then
+    oe_runmake progress_unstripped
+    cp progress_unstripped progress
+  fi
+}
+
 do_install () {
   install -d ${D}${bindir}/
   install -m 0755 swupdate ${D}${bindir}/
@@ -39,10 +97,15 @@ do_install () {
   install -d ${D}${includedir}/
   install -m 0644 ${S}include/network_ipc.h ${D}${includedir}
   install -m 0755 ${S}ipc/lib.a ${D}${libdir}/libswupdate.a
-}
 
-do_compile() {
-  unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
-  oe_runmake swupdate_unstripped
-  cp swupdate_unstripped swupdate
+  install -d ${D}${sysconfdir}/init.d
+  install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
+
+  install -d ${D}${systemd_unitdir}/system
+  install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_unitdir}/system
 }
+
+INITSCRIPT_NAME = "swupdate"
+INITSCRIPT_PARAMS = "defaults 70"
+
+SYSTEMD_SERVICE_${PN} = "swupdate.service"

+ 1 - 15
recipes-support/swupdate/swupdate_2016.07.bb

@@ -1,17 +1,3 @@
 require swupdate.inc
 
-inherit update-rc.d
-
-SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=git;tag=2016.07 \
-     file://defconfig \
-     file://swupdate \
-     file://swupdate.service \
-     "
-
-do_install_append() {
-  install -d ${D}${sysconfdir}/init.d
-  install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
-}
-
-INITSCRIPT_NAME = "swupdate"
-INITSCRIPT_PARAMS = "defaults 70"
+SRCREV = "458d8122cf93ec295195342846cc6e879951aa44"

+ 1 - 14
recipes-support/swupdate/swupdate_git.bb

@@ -1,16 +1,3 @@
 require swupdate.inc
 
-inherit update-rc.d
-
-# this is 2016.10-rc1
-SRCREV = "8abacd3613410002c0cd05a12e82d695d3e4bf6f"
-
-SRC_URI += "file://swupdate"
-
-do_install_append() {
-  install -d ${D}${sysconfdir}/init.d
-  install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
-}
-
-INITSCRIPT_NAME = "swupdate"
-INITSCRIPT_PARAMS = "defaults 70"
+DEFAULT_PREFERENCE = "-1"