package/pkg-generic.mk: add '<pkg>-dirclean-rdepends' command
cover package/pkg-generic.mk: add '<pkg>-dirclean-rdepends' command
This series adds a build target similar to '<pkg>-dirclean' that cleans a package and all of its reverse dependencies (rdepends).
I'm interested in this command as a short-term workaround for reinstalling the target/ and host/ directories when using PER_PACKAGE_DIRECTORIES, as described in this old patch[1]. This command is more reliable then manually picking out the right targets to dirclean.
This command may also be useful when not using PER_PACKAGE_DIRECTORIES, as it can be used to rebuild a library and force dependent packages to rebuild.
[1] https://lore.kernel.org/buildroot/20191212130253.2cb543ba@windsurf/
---
Brandon Maier (2):
package/pkg-generic.mk: add '<pkg>-dirclean-rdepends' command
Makefile: document <pkg>-dirclean-rdepends
Makefile | 3 +++ package/pkg-generic.mk | 12 ++++++++++++ 2 files changed, 15 insertions(+)
---
base-commit: 0196ec4198771e5fe83d6df02c7cd3b13c0ce05f
change-id: 20240820-package-dirclean-rdep-50ca01382136
Best regards,
Signature · 6 lines
Brandon Maier <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 package/pkg-generic.mk: add '<pkg>-dirclean-rdepends' command
Add a build target similar to '<pkg>-dirclean' that cleans a package and all of its reverse dependencies (rdepends).
This is useful for resyncing the target/ and host/ directories of a package when using per-package directory. And to force a rebuild of any packages depending on a package.
--- package/pkg-generic.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+)
package/pkg-generic.mk +12 -0
@@ -407,6 +407,13 @@ $(BUILD_DIR)/%/.stamp_dircleaned: $(if $(BR2_PER_PACKAGE_DIRECTORIES),rm -Rf $(PER_PACKAGE_DIR)/$(NAME)) rm -Rf $(@D) +# Remove package and reverse-dependencies sources +$(BUILD_DIR)/%/.stamp_rdepends_dircleaned: + $(foreach rdep,$(NAME) $($(PKG)_FINAL_RECURSIVE_RDEPENDENCIES), \ + $(if $(BR2_PER_PACKAGE_DIRECTORIES), \ + rm -Rf $(PER_PACKAGE_DIR)/$(rdep)$(sep)) \ + rm -Rf $($(call UPPERCASE,$(rdep))_BUILDDIR)$(sep)) + ################################################################################ # virt-provides-single -- check that provider-pkg is the declared provider for # the virtual package virt-pkg
@@ -858,6 +865,7 @@ $(2)_TARGET_EXTRACT = $$($(2)_DIR)/.stamp_extracted $(2)_TARGET_SOURCE = $$($(2)_DIR)/.stamp_downloaded $(2)_TARGET_ACTUAL_SOURCE = $$($(2)_DIR)/.stamp_actual_downloaded $(2)_TARGET_DIRCLEAN = $$($(2)_DIR)/.stamp_dircleaned +$(2)_TARGET_DIRCLEAN_RDEPENDS = $$($(2)_DIR)/.stamp_rdepends_dircleaned # default extract command $(2)_EXTRACT_CMDS ?= \
@@ -1055,6 +1063,7 @@ $(1)-all-legal-info: $(1)-legal-info $(1)-all-legal-info: $$(foreach p,$$($(2)_FINAL_ALL_DEPENDENCIES),$$(p)-all-legal-info) $(1)-dirclean: $$($(2)_TARGET_DIRCLEAN) +$(1)-dirclean-rdepends: $$($(2)_TARGET_DIRCLEAN_RDEPENDS) $(1)-clean-for-reinstall: ifneq ($$($(2)_OVERRIDE_SRCDIR),)
@@ -1100,6 +1109,8 @@ $$($(2)_TARGET_ACTUAL_SOURCE): PKG=$(2) $$($(2)_TARGET_ACTUAL_SOURCE): PKGDIR=$(pkgdir) $$($(2)_TARGET_DIRCLEAN): PKG=$(2) $$($(2)_TARGET_DIRCLEAN): NAME=$(1) +$$($(2)_TARGET_DIRCLEAN_RDEPENDS): PKG=$(2) +$$($(2)_TARGET_DIRCLEAN_RDEPENDS): NAME=$(1) # Compute the name of the Kconfig option that correspond to the # package being enabled.
@@ -1293,6 +1304,7 @@ DL_TOOLS_DEPENDENCIES += $$(call extractor-system-dependency,$$($(2)_SOURCE)) $(1)-configure \ $(1)-depends \ $(1)-dirclean \ + $(1)-dirclean-rdepends \ $(1)-external-deps \ $(1)-extract \ $(1)-graph-depends \
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 Makefile: document <pkg>-dirclean-rdepends
In reply to Brandon Maier via buildroot--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -1176,6 +1176,9 @@ help: @echo ' - Generate a graph of both <pkg>'\''s forward and' @echo ' reverse dependencies.' @echo ' <pkg>-dirclean - Remove <pkg> build directory' + @echo ' <pkg>-dirclean-rdepends' + @echo ' - Remove build directory of <pkg> and <pkg>'\''s' + @echo ' reverse dependencies' @echo ' <pkg>-reconfigure - Restart the build from the configure step' @echo ' <pkg>-rebuild - Restart the build from the build step' @echo ' <pkg>-reinstall - Restart the build from the install step'
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot