mk: allow updates to build config on make install
PATCH 1/1 mk: allow updates to build config on make install
There was an issue with rebuilding the code following a change to one of the config files inside the "config" directory. If one did a "make install T=<target>" and then made a modification to the defconfig_<target> file (or applied a patch which modified that file) a subsequent re-run of the make install command would not rebuild the .config file leading to either build failures or an incorrect build. This change fixes that issue.
--- mk/rte.sdkinstall.mk | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
mk/rte.sdkinstall.mk +1 -3
@@ -56,9 +56,7 @@ install: $(INSTALL_TARGETS) %_install: @echo ================== Installing $* - $(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \ - $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ - fi + $(Q)$(MAKE) config T=$* O=$(BUILD_DIR)/$* $(Q)$(MAKE) all O=$(BUILD_DIR)/$* #
Signature · 1 line
1.7.0.7
A message that is not in the archive (sent off-list or not yet received): 1400062955-27338-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Hi Bruce
2014-05-14 11:22, Bruce Richardson:
Quoted 7 lines
There was an issue with rebuilding the code following a change to one of the config files inside the "config" directory. If one did a "make install T=<target>" and then made a modification to the defconfig_<target> file (or applied a patch which modified that file) a subsequent re-run of the make install command would not rebuild the .config file leading to either build failures or an incorrect build. This change fixes that issue.
Your patch is reverting this one:
mk: in install rule, don't overwrite .config if it already exists http://dpdk.org/browse/dpdk/commit/?id=1c858a7dfebd4e4092eb55
As stated in the commit log,
"This allows the user to prepare a configuration with make config before using make install."
So your patch is introducing a regression.
I think you are describing something which is not a bug.
If you make a modification to the configuration template, you must explicitly call "make config".
Signature · 1 line
Thomas
Quoted 26 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, May 14, 2014 11:34 AM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] mk: allow updates to build config on make installHi Bruce
2014-05-14 11:22, Bruce Richardson:
Quoted 7 lines
There was an issue with rebuilding the code following a change to one of the config files inside the "config" directory. If one did a "make install T=<target>" and then made a modification to the defconfig_<target> file (or applied a patch which modified that file) a subsequent re-run of the make install command would not rebuild the .config file leading to either build failures or an incorrect build. This change fixes that issue.
Your patch is reverting this one:
mk: in install rule, don't overwrite .config if it already exists http://dpdk.org/browse/dpdk/commit/?id=1c858a7dfebd4e4092eb55As stated in the commit log,
"This allows the user to prepare a configuration with make config before using make install."
Quoted 6 lines
So your patch is introducing a regression.
I think you are describing something which is not a bug.
If you make a modification to the configuration template, you must explicitly call "make config".
Ok, thanks for that Thomas.
However, I still think we have a bug here, or at least we need some discussion on the correct behaviour we expect to have. From my point of view, the new behaviour is problematic, as every time I apply a patch or do a pull, I need to do a "make uninstall" or "make config" before doing "make install" just in case something has changed in the defconfig file, even if I have changed nothing on my end. This is not expected behaviour: if a change is made to the repository, doing a rebuild should rebuild everything which needs to be built to take account of that change.
Regards,
/Bruce
A message that is not in the archive (sent off-list or not yet received): 59AF69C657FD0841A61C55336867B5B01AA196E4-kPTMFJFq+rELt2AQoY/[email protected]
2014-05-14 10:51, Richardson, Bruce:
Quoted 34 lines
Quoted 25 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, May 14, 2014 11:34 AM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] mk: allow updates to build config on make installHi Bruce
2014-05-14 11:22, Bruce Richardson:
Quoted 7 lines
There was an issue with rebuilding the code following a change to one of the config files inside the "config" directory. If one did a "make install T=<target>" and then made a modification to the defconfig_<target> file (or applied a patch which modified that file) a subsequent re-run of the make install command would not rebuild the .config file leading to either build failures or an incorrect build. This change fixes that issue.
Your patch is reverting this one:
mk: in install rule, don't overwrite .config if it already exists http://dpdk.org/browse/dpdk/commit/?id=1c858a7dfebd4e4092eb55As stated in the commit log,
Quoted 8 lines
"This allows the user to prepare a configuration with make config before using make install."
So your patch is introducing a regression.
I think you are describing something which is not a bug. If you make a modification to the configuration template, you must explicitly call "make config".
Quoted 9 lines
Ok, thanks for that Thomas.
However, I still think we have a bug here, or at least we need some discussion on the correct behaviour we expect to have. From my point of view, the new behaviour is problematic, as every time I apply a patch or do a pull, I need to do a "make uninstall" or "make config" before doing "make install" just in case something has changed in the defconfig file, even if I have changed nothing on my end. This is not expected behaviour: if a change is made to the repository, doing a rebuild should rebuild everything which needs to be built to take account of that change.
You would like to have a synchronization of your generated .config file with the configuration template. But it's not possible for the simple reason that you may have modified your .config file so there is no simple correlation with the original template.
Signature · 1 line
Thomas
Quoted 9 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, May 14, 2014 12:56 PM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] mk: allow updates to build config on make install
Quoted 5 lines
You would like to have a synchronization of your generated .config file with the configuration template. But it's not possible for the simple reason that you may have modified your .config file so there is no simple correlation with the original template.
Would you agree then that the ideal state matrix for a make install should probably be:
* template unmodified, config unmodified - No issue - regenerate or not as best suits the code
* template unmodified, config modified - don't regenerate, keep local config
* template modified, config modified - flag an error, since continuing compile with old config on new code will lead to undefined build results, since config template changes rarely occur without code changes to go with them.
* template modified, config unmodified - regenerate new config, overwriting old one, for the same reason above. [Optionally print out message stating that the config is being regenerated]
Does this seem reasonable to you? The last case is the common case for me in development, as I've had multiple build errors and unexpected build results in the last week alone due to config template changes not propagating as I switch development branches to work on different features.
/Bruce
A message that is not in the archive (sent off-list or not yet received): 59AF69C657FD0841A61C55336867B5B01AA19761-kPTMFJFq+rELt2AQoY/[email protected]
2014-05-14 12:33, Richardson, Bruce:
Quoted 18 lines
Quoted 6 lines
From: Thomas Monjalon [mailto:[email protected]]
You would like to have a synchronization of your generated .config file with the configuration template. But it's not possible for the simple reason that you may have modified your .config file so there is no simple correlation with the original template.
Would you agree then that the ideal state matrix for a make install should probably be: * template unmodified, config unmodified - No issue - regenerate or not as best suits the code * template unmodified, config modified - don't regenerate, keep local config * template modified, config modified - flag an error, since continuing compile with old config on new code will lead to undefined build results, since config template changes rarely occur without code changes to go with them. * template modified, config unmodified - regenerate new config, overwriting old one, for the same reason above. [Optionally print out message stating that the config is being regenerated]
Quoted 4 lines
Does this seem reasonable to you? The last case is the common case for me in development, as I've had multiple build errors and unexpected build results in the last week alone due to config template changes not propagating as I switch development branches to work on different features.
It seems reasonable.
So you plan to send a v2 with this algorithm?
Signature · 1 line
Thomas
Quoted 5 lines
It seems reasonable.
So you plan to send a v2 with this algorithm?
I haven't started investigating such a solution just yet, but I'll see what I can come up with and I'll let you know.
PATCH v2 1/1 mk: allow updates to build config on make install
In reply to a message not in the archiveWhen running "make config" and additional config.orig file is also generated, which is intended to hold the original, clean configuration from the template.
When running make install, we first check if there is no existing .config file, and run make config if not. If there is a file, we then check if it's unmodified, in which case we regenerate a new .config to take account of any possible updates to the template. Finally, in the case where there is an existing .config file, and it HAS been modified, we then do a check to see if the template has had further updates, and throw an error if so. If no updates, we continue with the build using the existing, user-modified config.
--- mk/rte.sdkconfig.mk | 1 + mk/rte.sdkinstall.mk | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-)
mk/rte.sdkconfig.mk +1 -0
@@ -74,6 +74,7 @@ $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \ if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \ cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \ + cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \ fi ; \ rm -f $(RTE_OUTPUT)/.config_tmp ; \ else \
mk/rte.sdkinstall.mk +10 -0
@@ -54,10 +54,20 @@ INSTALL_TARGETS := $(addsuffix _install,\ .PHONY: install install: $(INSTALL_TARGETS) + %_install: @echo ================== Installing $* $(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \ $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + elif cmp -s $(BUILD_DIR)/$*/.config.orig $(BUILD_DIR)/$*/.config; then \ + $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + else \ + $(MAKE) config T=$* O=/tmp/$*; \ + if ! cmp -s /tmp/$*/.config.orig $(BUILD_DIR)/$*/.config.orig ; then \ + echo "Config Conflict: Local config and standard config have both changed" ; \ + exit 1; \ + fi ; \ + echo "Using local configuration" ; \ fi $(Q)$(MAKE) all O=$(BUILD_DIR)/$*
Signature · 1 line
1.7.0.7
A message that is not in the archive (sent off-list or not yet received): 1400082910-16804-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Olivier MATZ
Acked-byHi Bruce,
Quoted 12 lines · Bruce Richardson
When running "make config" and additional config.orig file is also generated, which is intended to hold the original, clean configuration from the template.
When running make install, we first check if there is no existing .config file, and run make config if not. If there is a file, we then check if it's unmodified, in which case we regenerate a new .config to take account of any possible updates to the template. Finally, in the case where there is an existing .config file, and it HAS been modified, we then do a check to see if the template has had further updates, and throw an error if so. If no updates, we continue with the build using the existing, user-modified config.
Quoted 1 line
Signed-off-by Bruce Richardson <[email protected]>
It looks good to me, except the small typos below.
mk/rte.sdkinstall.mk INSTALL_TARGETS := $(addsuffix _install,\ · line 61
Quoted 11 lines
mk/rte.sdkinstall.mk +1
-0@@ -54,10 +54,20 @@ INSTALL_TARGETS := $(addsuffix _install,\ .PHONY: install install: $(INSTALL_TARGETS) + %_install: @echo ================== Installing $* $(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \ $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \
No need to add an extra line here.
mk/rte.sdkinstall.mk INSTALL_TARGETS := $(addsuffix _install,\ · line 68
Quoted 7 lines
mk/rte.sdkinstall.mk +7
-0+ elif cmp -s $(BUILD_DIR)/$*/.config.orig $(BUILD_DIR)/$*/.config; then \ + $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + else \ + $(MAKE) config T=$* O=/tmp/$*; \ + if ! cmp -s /tmp/$*/.config.orig $(BUILD_DIR)/$*/.config.orig ; then \ + echo "Config Conflict: Local config and standard config have both changed" ; \ + exit 1; \
I would remove extra upper-case chars and say "template" instead of "standard". Like that:
echo "Config conflict: local config and template config have both
changed"
Apart from these minor changes,
Regards,
Olivier
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 mk: allow updates to build config on make install
From: Bruce Richardson <[email protected]>
When running "make config", an additional config.orig file is also generated, which is intended to hold the original, clean configuration from the template.
When running make install, we first check if there is no existing .config file, and run make config if not. If there is a file, we then check if it's unmodified, in which case we regenerate a new .config to take account of any possible updates to the template. Finally, in the case where there is an existing .config file, and it HAS been modified, we then do a check to see if the template has had further updates, and throw an error if so. If no updates, we continue with the build using the existing, user-modified config.
--- mk/rte.sdkconfig.mk | 1 + mk/rte.sdkinstall.mk | 13 +++++++++++++ 2 files changed, 14 insertions(+)
changes in v3:
- typos commented by Olivier
- compatibility with old builds without .orig
- prefix and suffix in tmp path
- remove tmp directory if no conflict
mk/rte.sdkconfig.mk +1 -0
@@ -74,6 +74,7 @@ $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \ if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \ cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \ + cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \ fi ; \ rm -f $(RTE_OUTPUT)/.config_tmp ; \ else \
mk/rte.sdkinstall.mk +13 -0
@@ -58,6 +58,19 @@ install: $(INSTALL_TARGETS) @echo ================== Installing $* $(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \ $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + elif cmp -s $(BUILD_DIR)/$*/.config.orig $(BUILD_DIR)/$*/.config; then \ + $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + else \ + if [ -f $(BUILD_DIR)/$*/.config.orig ] ; then \ + tmp_build=/tmp/dpdk-$*-$$$$; \ + $(MAKE) config T=$* O=$$(tmp_build); \ + if ! cmp -s $(BUILD_DIR)/$*/.config.orig $$(tmp_build)/.config ; then \ + echo "Conflict: local config and template config have both changed"; \ + exit 1; \ + fi; \ + rm -rf $$(tmp_build); \ + fi; \ + echo "Using local configuration"; \ fi $(Q)$(MAKE) all O=$(BUILD_DIR)/$*
Signature · 1 line
2.0.0
A message that is not in the archive (sent off-list or not yet received): 1402408293-19426-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
Hi Thomas,
mk/rte.sdkinstall.mk install: $(INSTALL_TARGETS) · line 69
Quoted 6 lines · Thomas Monjalon
mk/rte.sdkinstall.mk +6
-0+ if [ -f $(BUILD_DIR)/$*/.config.orig ] ; then \ + tmp_build=/tmp/dpdk-$*-$$$$; \ + $(MAKE) config T=$* O=$$(tmp_build); \ + if ! cmp -s $(BUILD_DIR)/$*/.config.orig $$(tmp_build)/.config ; then \ + echo "Conflict: local config and template config have both changed"; \ + exit 1; \
I missed it the first time, but what do you think about using $(BUILD_DIR)/$*/.config.tmp instead of /tmp/dpdk-$*-$$ ? I think using /tmp should be avoided when possible as it is a shared folder.
Regards,
Olivier
A message that is not in the archive (sent off-list or not yet received): [email protected]
Yes, good point. I'll try and redraft a v3 of the patch (thanks Thomas for doing a V2), with that in it. I also think if we keep everything in the build dir we should not the rm afterwards. [In my previous tests when doing V1 patch, I found that deleting the directory each time seemed to slow things down for the next run. I'll test if that is still the case when doing V3]
Quoted 26 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Olivier MATZ
Sent: Tuesday, June 10, 2014 9:03 AM
To: Thomas Monjalon; [email protected]
Subject: Re: [dpdk-dev] [PATCH v3] mk: allow updates to build config on make installHi Thomas,
mk/rte.sdkinstall.mk install: $(INSTALL_TARGETS)
Quoted 4 lines · Thomas Monjalon
mk/rte.sdkinstall.mk +4
-0+ if [ -f $(BUILD_DIR)/$*/.config.orig ] ; then \ + tmp_build=/tmp/dpdk-$*-$$$$; \ + $(MAKE) config T=$* O=$$(tmp_build); \ + if ! cmp -s $(BUILD_DIR)/$*/.config.orig$$(tmp_build)/.config ; then \
Review
Quoted 1 line
(quoted diff) +1
-0+ echo "Conflict: local config and templateconfig have both changed"; \
mk/rte.sdkinstall.mk install: $(INSTALL_TARGETS) · line 69
Quoted 1 line
mk/rte.sdkinstall.mk +1
-0+ exit 1; \I missed it the first time, but what do you think about using $(BUILD_DIR)/$*/.config.tmp instead of
/tmp/dpdk-$*-$$? I think using /tmp should be avoided when possible as it is a shared folder.Regards,
Olivier
A message that is not in the archive (sent off-list or not yet received): 59AF69C657FD0841A61C55336867B5B01AA3475A-kPTMFJFq+rELt2AQoY/[email protected]
PATCH v4 1/1 mk: allow updates to build config on make install
From: Bruce Richardson <[email protected]>
When running "make config", an additional config.orig file is also generated, which is intended to hold the original, clean configuration from the template.
When running make install, we first check if there is no existing .config file, and run make config if not. If there is a file, we then check if it's unmodified, in which case we regenerate a new .config to take account of any possible updates to the template. Finally, in the case where there is an existing .config file, and it HAS been modified, we then do a check to see if the template has had further updates, and throw an error if so. If no updates, we continue with the build using the existing, user-modified config.
--- mk/rte.sdkconfig.mk | 1 + mk/rte.sdkinstall.mk | 12 ++++++++++++ 2 files changed, 13 insertions(+)
changes in v3:
- typos commented by Olivier
- compatibility with old builds without .orig
- prefix and suffix in tmp path
- remove tmp directory if no conflict
changes in v4:
- tmp directory in build directory
- do not remove tmp directory to speed up rebuild
mk/rte.sdkconfig.mk +1 -0
@@ -74,6 +74,7 @@ $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \ if ! cmp -s $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config; then \ cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config ; \ + cp $(RTE_OUTPUT)/.config_tmp $(RTE_OUTPUT)/.config.orig ; \ fi ; \ rm -f $(RTE_OUTPUT)/.config_tmp ; \ else \
mk/rte.sdkinstall.mk +12 -0
@@ -58,6 +58,18 @@ install: $(INSTALL_TARGETS) @echo ================== Installing $* $(Q)if [ ! -f $(BUILD_DIR)/$*/.config ]; then \ $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + elif cmp -s $(BUILD_DIR)/$*/.config.orig $(BUILD_DIR)/$*/.config; then \ + $(MAKE) config T=$* O=$(BUILD_DIR)/$*; \ + else \ + if [ -f $(BUILD_DIR)/$*/.config.orig ] ; then \ + tmp_build=$(BUILD_DIR)/$*/.config.tmp; \ + $(MAKE) config T=$* O=$$tmp_build; \ + if ! cmp -s $(BUILD_DIR)/$*/.config.orig $$tmp_build/.config ; then \ + echo "Conflict: local config and template config have both changed"; \ + exit 1; \ + fi; \ + fi; \ + echo "Using local configuration"; \ fi $(Q)$(MAKE) all O=$(BUILD_DIR)/$*
Signature · 1 line
2.0.0
A message that is not in the archive (sent off-list or not yet received): 1402418283-21950-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org
Richardson, Bruce
Tested-byQuoted 23 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Tuesday, June 10, 2014 9:38 AM
To: [email protected]
Cc: Richardson, Bruce
Subject: [PATCH v4] mk: allow updates to build config on make installFrom: Bruce Richardson <[email protected]>
When running "make config", an additional config.orig file is also generated, which is intended to hold the original, clean configuration from the template.
When running make install, we first check if there is no existing .config file, and run make config if not. If there is a file, we then check if it's unmodified, in which case we regenerate a new .config to take account of any possible updates to the template. Finally, in the case where there is an existing .config file, and it HAS been modified, we then do a check to see if the template has had further updates, and throw an error if so. If no updates, we continue with the build using the existing, user-modified config.
Quoted 2 lines
Signed-off-by Bruce Richardson <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
A message that is not in the archive (sent off-list or not yet received): 59AF69C657FD0841A61C55336867B5B01AA34876-kPTMFJFq+rELt2AQoY/[email protected]
Quoted 14 lines
Quoted 14 lines
From: Bruce Richardson <[email protected]>
When running "make config", an additional config.orig file is also generated, which is intended to hold the original, clean configuration from the template.
When running make install, we first check if there is no existing .config file, and run make config if not. If there is a file, we then check if it's unmodified, in which case we regenerate a new .config to take account of any possible updates to the template. Finally, in the case where there is an existing .config file, and it HAS been modified, we then do a check to see if the template has had further updates, and throw an error if so. If no updates, we continue with the build using the existing, user-modified config.
Quoted 4 lines
Quoted 2 lines
Signed-off-by Bruce Richardson <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>Tested-by Bruce Richardson <[email protected]>
Previous version was acked by Olivier.
It is now applied for version 1.7.0.
Signature · 1 line
Thomas