diff mbox series

[meta-swupdate,10/12] swupdate: update, fixes in do_install

Message ID 20191023211101.16591-11-adrian.freihofer@siemens.com
State Changes Requested
Headers show
Series simplify swupdate config | expand

Commit Message

Freihofer, Adrian Oct. 23, 2019, 9:10 p.m. UTC
Update swupdate to latest git version. This changes the filenames
of the tools binaries for several reasons:
- Binaries should not be named "client" or "progress"
  (also not accepted by Debian upstream)
- Inconsistent with names referred in the service files

The swupdate_tools.inc file gets merged into swupdate.inc file. By
removing the tools file some bugs are fixed:
- The tools binaries were installed twice.
- do_compile from swupdate.inc was over written resulting in wired
  behavior
- swupdate-progress.service file was part of swupdate package were the
  corresponding swupdate-progress binary was part of the tools package.

The tools are now installed by the "make install" target of swupdate's
Makefile. The related code here in meta-swupdate gets removed.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 recipes-support/swupdate/swupdate.inc        | 18 +++++++++++++-----
 recipes-support/swupdate/swupdate_2019.04.bb | 20 +++++++++++++++++++-
 recipes-support/swupdate/swupdate_git.bb     |  1 -
 recipes-support/swupdate/swupdate_tools.inc  | 24 ------------------------
 4 files changed, 32 insertions(+), 31 deletions(-)
 delete mode 100644 recipes-support/swupdate/swupdate_tools.inc
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 19ccf4a..ec7091f 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -12,14 +12,22 @@  SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=https \
      file://swupdate \
      "
 
+PACKAGES =+ "${PN}-www ${PN}-lua ${PN}-tools"
 INSANE_SKIP_${PN} = "ldflags"
-PACKAGES =+ "${PN}-www ${PN}-lua"
+INSANE_SKIP_${PN}-tools = "ldflags"
 
 FILES_${PN}-lua += "${libdir}/lua/"
 FILES_${PN}-www = " \
     ${libdir}/swupdate/conf.d/*mongoose* \
     /www/* \
 "
+FILES_${PN}-tools = " \
+    ${bindir}/swupdate-client \
+    ${bindir}/swupdate-progress \
+    ${systemd_system_unitdir}/swupdate-progress.service \
+    ${bindir}/swupdate-hawkbitcfg \
+    ${bindir}/swupdate-sendtohawkbit \
+"
 FILES_${PN} += " \
     ${libdir}/tmpfiles.d \
     ${libdir}/swupdate/* \
@@ -130,10 +138,7 @@  do_configure () {
 
 do_compile() {
   unset LDFLAGS
-  oe_runmake swupdate_unstripped progress_unstripped
-  cp swupdate_unstripped swupdate
-  cp progress_unstripped progress
-
+  oe_runmake
 }
 
 do_install () {
@@ -158,3 +163,6 @@  SYSTEMD_SERVICE_${PN} = " \
     swupdate.service \
     swupdate-usb@.service \
     "
+
+SYSTEMD_PACKAGES_append = " ${PN}-tools"
+SYSTEMD_SERVICE_${PN}-tools = "swupdate-progress.service"
diff --git a/recipes-support/swupdate/swupdate_2019.04.bb b/recipes-support/swupdate/swupdate_2019.04.bb
index 83785d7..5b0fb78 100644
--- a/recipes-support/swupdate/swupdate_2019.04.bb
+++ b/recipes-support/swupdate/swupdate_2019.04.bb
@@ -1,5 +1,4 @@ 
 require swupdate.inc
-require swupdate_tools.inc
 
 SRC_URI += " \
      file://swupdate.service \
@@ -10,3 +9,22 @@  SRC_URI += " \
      "
 
 SRCREV = "d39f4b8e00ef1929545b66158e45b82ea922bf81"
+
+do_install_append () {
+    # Rename the binaries installed by make install
+    test -f ${D}${bindir}/progress && mv ${D}${bindir}/progress ${D}${bindir}/swupdate-progress
+    test -f ${D}${bindir}/client && mv ${D}${bindir}/client ${D}${bindir}/swupdate-client
+    test -f ${D}${bindir}/hawkbitcfg && mv ${D}${bindir}/hawkbitcfg ${D}${bindir}/swupdate-hawkbitcfg
+    test -f ${D}${bindir}/sendtohawkbit && mv ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit
+
+    install -d ${D}${systemd_system_unitdir}
+    install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_system_unitdir}
+    install -m 644 ${WORKDIR}/swupdate-usb@.service ${D}${systemd_system_unitdir}
+    install -m 644 ${WORKDIR}/swupdate-progress.service ${D}${systemd_system_unitdir}
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${libdir}/tmpfiles.d
+        install -m 0644 ${WORKDIR}/systemd-tmpfiles-swupdate.conf ${D}${libdir}/tmpfiles.d/swupdate.conf
+        install -d ${D}${sysconfdir}/udev/rules.d
+        install -m 0644 ${WORKDIR}/swupdate-usb.rules ${D}${sysconfdir}/udev/rules.d/
+    fi
+}
diff --git a/recipes-support/swupdate/swupdate_git.bb b/recipes-support/swupdate/swupdate_git.bb
index a4289f6..8eef04e 100644
--- a/recipes-support/swupdate/swupdate_git.bb
+++ b/recipes-support/swupdate/swupdate_git.bb
@@ -1,5 +1,4 @@ 
 require swupdate.inc
-require swupdate_tools.inc
 
 DEFAULT_PREFERENCE = "-1"
 
diff --git a/recipes-support/swupdate/swupdate_tools.inc b/recipes-support/swupdate/swupdate_tools.inc
deleted file mode 100644
index d270dd4..0000000
--- a/recipes-support/swupdate/swupdate_tools.inc
+++ /dev/null
@@ -1,24 +0,0 @@ 
-PACKAGES =+ "${PN}-tools"
-
-INSANE_SKIP_${PN}-tools = "ldflags"
-
-FILES_${PN}-tools = "${bindir}/swupdate-client \
-                    ${bindir}/swupdate-progress \
-                    ${bindir}/swupdate-hawkbitcfg \
-                    ${bindir}/swupdate-sendtohawkbit"
-
-do_compile() {
-  unset LDFLAGS
-
-  oe_runmake
-  cp swupdate_unstripped swupdate
-}
-
-do_install_append () {
-
-  install -m 0755 tools/client_unstripped ${D}${bindir}/swupdate-client
-  install -m 0755 tools/progress_unstripped ${D}${bindir}/swupdate-progress
-  install -m 0755 tools/hawkbitcfg_unstripped ${D}${bindir}/swupdate-hawkbitcfg
-  install -m 0755 tools/sendtohawkbit_unstripped ${D}${bindir}/swupdate-sendtohawkbit
-
-}