[9.0] add module_checksum_upgrade and refactor module_auto_update - #1176
[9.0] add module_checksum_upgrade and refactor module_auto_update#1176sbidoul wants to merge 9 commits into
Conversation
| # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
|
||
| { | ||
| 'name': 'Module Auto Update Base', |
There was a problem hiding this comment.
name and summary does'nt seems to fit with the objective of the module. don't you think ?
There was a problem hiding this comment.
@legalsylvain I fixed the name. How would you suggest to change the summary?
|
|
||
| def test_saved_checksums(self): | ||
| Imm = self.env['ir.module.module'] | ||
| base_module = self.env['ir.module.module'].search([ |
|
The problem with this is that in OCA we can't have several things for the same goal. We should work to have a common ground, not to duplicate modules. |
|
@pedrobaeza that is why I propose to make module_auto_update depend on this one, so there is no code duplication. This would look like this: acsone@63b5fc9. This way people can choose to use |
|
But I don't want to have 2 modules for performing the same that I'm doing now with one. Integrate your solution in the other. |
|
I don't see how to integrate them without breaking backward compatibility. The point is that we don't want the What is the problem of having one module that provides a base functionality, and another one that extends it and make it automatic? |
|
The problem is that I'm rising my complexity, number of modules and so on for no benefit in my approach. The auto part in module_auto_update can be disabled if you want or making parametric. |
|
Let's see what other say. I can maintain this outside of OCA. That would be a pity. |
|
Regarding the complexity argument, I argue that a two modules approach is less complex and much cleaner than littering |
| @@ -0,0 +1,6 @@ | |||
| This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. | |||
There was a problem hiding this comment.
Oops. Well spotted. Removed.
|
The code LGTM 👍 |
ThomasBinsfeld
left a comment
There was a problem hiding this comment.
(Nitpicking)
Code and functional reviews 👍
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues | ||
| <https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please |
There was a problem hiding this comment.
@sbidoul s/{project_repo}/server-tools
| ], limit=1)) | ||
|
|
||
| @api.model | ||
| def _modules_with_changed_checksum(self): |
There was a problem hiding this comment.
@sbidoul s/_modules_with_changed_checksum/_get_modules_with_changed_checksum?
|
Another thing to have in mind is that currently the other module doesn't work in v9. For v10 and v11 it does. You have to check that ones. |
|
I looked at the code of 10 and 11 before coding this. It is very similar and does not change my reasoning. |
yajo
left a comment
There was a problem hiding this comment.
I like this new design.
To be honest, at the end of the day we were not using the cron because of its problems. Just manual upgrading. Yikes! odoo is so anti-HA by design... 🤦♂️
Well, I added some comments, and before we continue I think we really need to test the upgrade_changed_checksum method. As you said, we've found so many corner cases that I really feel we need that, please.
About having 2 addons for the same thing... That part I don't like it TBH. This could become an upgrade to the original one.
I'd appreciate having some UI exposing this to the user too. Not a blocker.
| 'automatically', | ||
| 'version': '9.0.1.0.0', | ||
| 'category': 'Extra Tools', | ||
| 'website': 'https://odoo-community.org/', |
| 'base', | ||
| ], | ||
| 'data': [ | ||
| ], |
| Installation | ||
| ============ | ||
|
|
||
| There are no specific installation instructions. |
| Configuration | ||
| ============= | ||
|
|
||
| There is nothing to configure. |
| This is by design, priviledging safety. Should this be an issue, | ||
| the method ``_save_installed_checksums`` can be invoked in a situation | ||
| where one is sure all modules on disk are installed and up-to-date in the | ||
| database. |
There was a problem hiding this comment.
How can you call the method before installing the addon? 🤔
There was a problem hiding this comment.
You don't. Installing this module does nothing until upgrade_changed_checksum is called.
There was a problem hiding this comment.
Oh sorry I understood bad; it's OK then
|
|
||
| _logger.info("Upgrade successful, updating checksums...") | ||
| self._save_installed_checksums() | ||
| self.env.cr.commit() # pylint: disable=invalid-commit |
There was a problem hiding this comment.
Could you explain why the commits instead of savepoints? I'm pretty sure it makes sense, but a comment would be quite useful. 😉
There was a problem hiding this comment.
What would be the benefit of savepoints?
There was a problem hiding this comment.
Savepoints produce the same effect as a commit, but just for the current cursor. At the end, the cursor is committed automatically by Odoo following its usual rules.
Please read this section: https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#never-commit-the-transaction
There was a problem hiding this comment.
Savepoint are not the same as commits: https://www.postgresql.org/docs/9.6/static/sql-savepoint.html.
I'm aware of the risks of commits in normal business logic. Here I really want to commit at each step (to be sure also to have the same behaviour with each Odoo version). There is no risk of corruption because this method is not intended to be invoked as part of a larger transaction. I'll update the docstring on this topic.
| """It should exclude .pyc/.pyo extensions from checksum | ||
| calculations""" | ||
| if not self.own_writeable: | ||
| self.skipTest("Own directory not writeable") |
There was a problem hiding this comment.
The original addon test does it differently.
Instead, it writes a false checksum before checking the upgrade behavior:
It makes addon testable everywhere; please do that instead. 😊
There was a problem hiding this comment.
This particular test comes unchanged from the original module:
server-tools/module_auto_update/tests/test_module.py
Lines 58 to 59 in 3ed2a55
| """It should return a different value when a non-.pyc/.pyo file is | ||
| added to the module directory""" | ||
| if not self.own_writeable: | ||
| self.skipTest("Own directory not writeable") |
| 'sha1', | ||
| excluded_extensions=['pyc', 'pyo'], | ||
| ) | ||
| self.own_writeable = os.access(self.own_dir_path, os.W_OK) |
|
|
||
| excluded_extensions = self.env["ir.config_parameter"].get_param( | ||
| PARAM_EXCLUDED_EXTENSIONS, | ||
| 'pyc,pyo', |
There was a problem hiding this comment.
Yes, makes sense. Would be nice to have a mechanism to exclude/include languages too.
|
@yajo thanks for the detailed review. |
|
Regarding the duplicate, may I suggest deprecating module_auto_update. Again I don't see the benefit of upgrading it. Fixing while keeping it backward compatible is impossible. Actuallly, I'm more and more convinced module_auto_update is dangerous. If you update the code then run the upgrade without restarting the server, I can imagine situations where a migration runs with a previous version of the code in memory. |
842304a to
69da932
Compare
|
@sbidoul please tell me which compatibility do you break doing this on the existing module. I think that can be reasonable if the new method is better as said. |
As pointed out #1151 a restart is needed to have the new python code. Since python code maybe needed in upgrades involving So I want to get rid of everything that is potentially unsafe in the existing module.
To sum up: everything. Except the fundamental idea which is brilliant as I said, but needs to be implemented differently to be safe. |
Lol, quite right! 😆 OK, let me see if we can get to an agreement 😊
The cron job is currently buggy, as you specified, because it doesn't restart the server. However it's also true that some people might find useful run unattended upgrades. Just upgrade code and, when you know the upgrade is not dangerous, keep it running until it gets upgraded. In fact, that was my initial thought, although we "rolled back" the idea internally due to the obvious problems it has. So we have 2 paths:
I think option 1 is better. It's a breaking change, but after all it wasn't working fine in the first place. I'd merge that happily.
The real problem is not having a UI, but instead:
However, overriding the standard Odoo methods has its advantage: it forces consistency. If you're installing or upgrading an addon, it makes sure all other addons are currently up to date before doing that. That's a good thing IMHO, although in some situations it seems a little bit excessive. For instance, if you're installing a new addon and have to upgrade all others, it could take quite a bit of time. Also, providing an UI also empowers less technical users to use this good feature. Flattening the learn curve is always a good thing. Then the best solution would be:
This is also true, although it's something that can be easily achieved with a premigration script. So, after looking at this with perspective, I agree with both:
@sbidoul In case you were worried about breaking changes not being merged, don't worry, I won't block those if they make sense. 😉 So, do we all agree now? |
|
Yes, of course. |
|
@pedrobaeza @yajo I think you missed my main point. What I say is that the server must be restarted BEFORE the upgrade, not after. Indeed, when a migration runs, it may invoke methods that already loaded in memory and therefore can potentially run with the previous version of the code. That is why I say this method must not have a UI. Moreover, if we agree the current module is broken in subtle ways, and we don't need a UI why taking the burden of maintaining it? |
|
What I don't want is to change the module name to ease the transition to this new method. That's why I insist to change current module. |
|
Yes, @sbidoul, I didn't get that point 😉 However, I also think you didn't get ours: you're right, the addon was broken, so go on and break backwards compatibility, we won't block that. We don't want to maintain a broken addon, but we also don't want to maintain 2; it's just that. |
9fd031c to
595b762
Compare
|
Of course it seems not much useful to you because your target is to not install I understand you don't want to work for me, so I did it here: #1190. Basically, all of your job in a single addon, with a clear deprecation path: the best of both worlds 😊 |
| * Juan José Scarafía <jjs@adhoc.com.ar> | ||
| * Jairo Llopis <jairo.llopis@tecnativa.com> | ||
|
|
||
| The main idea of this module comes from `module_auto_update` by LasLabs Inc. |
There was a problem hiding this comment.
Please reword to avoid confusing readers: you can credit LasLabs for their initial implementation, but the idea comes from somebody else. 😉
There was a problem hiding this comment.
I did not know the idea was yours. Credits updated.
d0ca7f7 to
d67619c
Compare
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
|
Moved to #1190 |
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
This code comes from the module_checksum_upgrade proposal at OCA#1176. * [ADD] module_checksum_upgrade It provides the core mechanism of module_auto_update without the cron nor any change to the standard upgrade mechanism. Instead it provides an API on which module_auto_update can build, as well as a method which can be called from a script to run the upgrade of modules for which the checksum has changed. * [IMP] refactor module_auto_update Make it depend on module_checksum_upgrade which provides the core mechanisms of managing the checksums. module_auto_update makes it automatic. * [IMP] module_checksum_upgrade: better exclusion mechanism Ignore files based on exclude patterns. Ignore uninstalled languages. Better default for patterns to ignore (*.pyc,*.pyo,*.pot,static/*) For better control on the hashing mechanism implement our own: it's quite easy, and the checksumdir module used previously had no test. * [MIG] module_auto_update: adapt to new checksum mechanism * [IMP] module_checksum_upgrade: raise in case of incomplete upgrade * [IMP] module_checksum_upgrade: improve default exclusion pattern * [IMP] module_checksum_upgrade: control translations overwrite * [IMP] module_checksum_upgrade: one more test * [IMP] module_checksum_upgrade: credits [ci skip]
Syncing from upstream OCA/server-tools (16.0)
Following the very interesting conversation in #1151 I've had a deeper look into module_auto_update. The idea is indeed brilliant. However I came to the conclusion that
module_auto_updateis not adequate for our needs for the following reasons:In general by looking at the history of
module_auto_update, we can see that it started with a simple and elegant idea, but the resulting implementation taking into account of the edge cases has become very complex and difficult to understand and looks fragile. I believe this comes from the fact that it tries to immediately update the installed hash whatever the mean of installing a module or running the upgrade.So I came up with this new module
module_checksum_upgradethat provides the basic scriptable building blocks (ie computing hashes, and saving them, and upgrading the changed modules only).The approach is a little bit different from module_auto_update as it saves the checksums in a ir.config_parameter instead as a field on the module (this is necessary for the uninstall to work, at least in 9).
We intend to port this module from 8 to 11.
If there is interest, it is easy to adapt module_auto_update to depend on this new module, therefore fixing the uninstall issue in module_auto_update, and avoiding code duplication. I've a commit ready that does just that.