diff mbox series

[2/2] Makefile: always delete hwdb sources

Message ID 20220728193726.1465662-2-arnout@mind.be
State Accepted
Headers show
Series [1/2] package/eudev: remove HOST_EUDEV_SYSCONFDIR | expand

Commit Message

Arnout Vandecappelle July 28, 2022, 7:37 p.m. UTC
In eudev and systemd, we have code that deletes the hwdb sources from
the target - they are not useful since a binary hwdb is created from
them. However, if eudev or systemd is not used, then those sources are
not useful either. It's possible that other packages than eudev or
systemd install hwdb files, which would be left on the system.

Always remove the hwdb files.

Note that we don't expect much space savings from this, but anything may
help. It's certainly more consistent to do it always than just in eudev
and systemd.

We do this both from /usr/lib/udev (usual installation path for systemd)
and in /etc/udev (usual installation path for eudev) because packages
may install in either location.

We keep the comment explaining why it's done in rootfs-pre-cmd instead
of target-finalize - this was only present in eudev.mk.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 Makefile                   | 8 ++++++++
 package/eudev/eudev.mk     | 8 --------
 package/systemd/systemd.mk | 5 -----
 3 files changed, 8 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f116ccb5bc..e30e778346 100644
--- a/Makefile
+++ b/Makefile
@@ -807,6 +807,14 @@  endif # merged /usr
 
 	touch $(TARGET_DIR)/usr
 
+# Note: this will run in the filesystem context, so will use a copy
+# of target/, not the real one, so the files are still available on
+# re-builds (foo-rebuild, etc...)
+define ROOTFS_RM_HWDB_DATA
+	rm -rf $(TARGET_DIR)/usr/lib/udev/hwdb.d/ $(TARGET_DIR)/etc/udev/hwdb.d/
+endef
+ROOTFS_PRE_CMD_HOOKS += ROOTFS_RM_HWDB_DATA
+
 .PHONY: target-post-image
 target-post-image: $(TARGETS_ROOTFS) target-finalize staging-finalize
 	@rm -f $(ROOTFS_COMMON_TAR)
diff --git a/package/eudev/eudev.mk b/package/eudev/eudev.mk
index f050563feb..feb5505289 100644
--- a/package/eudev/eudev.mk
+++ b/package/eudev/eudev.mk
@@ -81,13 +81,5 @@  define HOST_EUDEV_BUILD_HWDB
 endef
 HOST_EUDEV_TARGET_FINALIZE_HOOKS += HOST_EUDEV_BUILD_HWDB
 
-# Note: this will run in the filesystem context, so will use a copy
-# of tharget/, not the real one, so the files are still available on
-# re-builds (foo-rebuild, etc...)
-define HOST_EUDEV_RM_HWDB_SRC
-	rm -rf $(TARGET_DIR)/etc/udev/hwdb.d/
-endef
-HOST_EUDEV_ROOTFS_PRE_CMD_HOOKS += HOST_EUDEV_RM_HWDB_SRC
-
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 19fd525534..1d7452de19 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -732,11 +732,6 @@  endef
 SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_UPDATE_CATALOGS
 endif
 
-define SYSTEMD_RM_HWDB_DATA
-	rm -rf $(TARGET_DIR)/usr/lib/udev/hwdb.d/ $(TARGET_DIR)/etc/udev/hwdb.d/
-endef
-SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_RM_HWDB_DATA
-
 define SYSTEMD_RM_CATALOG_UPDATE_SERVICE
 	rm -rf $(TARGET_DIR)/usr/lib/systemd/catalog \
 		$(TARGET_DIR)/usr/lib/systemd/system/systemd-journal-catalog-update.service \