-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REF] module_auto_update: Deprecate buggy features, add new API #1190
[REF] module_auto_update: Deprecate buggy features, add new API #1190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedrobaeza In a lot of comments, @sbidoul explained his motivations for keeping the work he did in a new module. I fully share his point of view on this topic. This PR looks like an attempt to impose your way of seeing things regardless of the arguments expressed. Moreover, in #1176 the commit history is very clean and each commit is signed while here all the work done is summarized into one commit with @yajo as author. For me, this PR is disrespectful and does not respect the ownership of the work done. The name |
Sorry, but you are the ones that want to make the things their way. This module is already in all existing versions, and you are forcing to use 2 modules and break possible installations imposing a new dependency. As you know, other things (some of mine for example) have been blocked because the same reason. The only thing for not forcing this was that we don't want you to load extra work, but now that we have made it, there's no excuse. I agree to rename the module in newer versions (v12), or even to try to put a link to make some kind of alias. About the commits, if you insist, we can bring here that commits, and the final one will remove all and put it like it is now. |
@yajo what you are doing here is extremely rude. |
I don't agree, Stéphane. Check my previous comment. |
Yes, commits matter, of course they do. It's not you vs us. I was just expecting an answer to my last comment. Frankly all this deprecated stuff is so messy, for what benefit? Saving the uninstallation of one deprecated module. I just don't understand. As said before, I don't care about the module name. So if you are ready to port and maintain all this from 8 to 11... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, at the very least, preserve my commits.
Can't get this thing out of my head :) I try to put myself in your shoes, so:
Is that correct? |
Hi there pals, sorry if I offended somebody, 😞 that wasn't my intention at all! I just wanted to stop discussing and just get the job done. When doing the job, I found myself on the situation on what to do with the commit history:
So, considering all points above, I decided to own the commit but credit @sbidoul in the README, in the commit message and in the copyright of the files. This is all open source software, so it's not actually wrong to copy and paste with the same license, but please keep in mind that my intention on the git history has been to find a good balance between being pragmatic and respectful. If you still want, I can squash all into a @sbidoul's commit; I'm open to suggestions since I consider @sbidoul the original designer of this code (I just did the duck-taping). When thinking on this matter, please also consider these points:
It would require quite a bit of manual job in our side that we want to avoid. Besides, if the addon was broken, we think that it's better to fix it than to dump it. At the end of the day, once the job is done, there's no more reason to split things.
Since Laslabs went away, we are almost the only maintainer of this code from 9-11, so obviously yes, we'll maintain it. Here we are deprecating some code that now will have reduced (if any) maintenance from us from now on, of course. Most of the new, undeprecated, code is yours, so I'm pretty sure you'll be ready to co-maintain it too, no matter the addon name. 😊 When backporting to v8, all deprecated options can be dropped, since there's no chance to break existing installations, and we just have to make sure it creates a When forward-porting to future v12, it would be the same, except that we don't need to care about such parameter anymore.
With this patch, this parameter is only set to In case you had an old deployment and want to disable them, you can set the parameter to |
@yajo I'm very tired with your continuous squash by default of the commit histroy. If the history is proper and the author ask you to keep it, just keep it. I agree that sometimes we can squash some useless commits but if we take the time to write and organise our dev into proper and well structured commit, there's no reason to squash the history. |
No hard feelings either, trust me. Commits are important because it's all that remains over time. When we look at contribution history, it's easy to analyse commits, while it's hard to analyse unstructured code headers. And a well crafted commit history provides valuable information on the reason why things end up being how they are.
That is false: the commits remain in the history of server-tools.
That is true: a few tests and one method name. A tiny fraction. I now give more prominent credit to laslabs for the idea, though.
Absolutely, that's what I always do too. In this case however, it is not a fix, it is a full deprecation.
That is the only argument I see so far in favor of this PR over #1176. And IMO it is dwarfed by the additional complexity. If I understood it better I could change my mind. @yajo would you like to explain why uninstalling |
Basically with the next update, our automated systems would be calling It's similar to some systems that provide a very basic base for others and need to vendorize libraries instead of relying on automatic dependency resolution systems. Pipenv is an example that comes to my mind. Also, I know that's not your case, but some people still install addons with the git clone and symlink method. This update would break their flow too. This is a very important piece in automated deployments and has to be treated with the care it deserves. The deprecation process, however (adding the parameter), makes the addon work as it did before out of the box, breaking nothing. It lets the operators decide at which point and in which projects to stop using the deprecated features. The deprecation diff wouldn't be so big were this the original mindset when proposing the patch, but since you fully rewrote the addon (and honestly it looks better), I think it's fair to use your code instead. About the idea attribution, I'll comment in the other PR. |
It is true that Anyway if that's the only way to progress let's go. Could you clarify the problem you see with clone+symlinks deployments? Do you prefer to rebase this on top of my commits, or do you want me to do it? |
Yep, the problem would be that, even if you updated
I don't want your commits to be lost in migrations due to what I explained in #1190 (comment) 😕, let me squash all into your 1st commit so you appear as the author. You deserve such recognition indeed! 🙌 |
f836adf
to
b3a2d32
Compare
Why don't you make 2 commits: one with my work and one with yours? |
b3a2d32
to
d7e0266
Compare
Hmm yes, that'd be better indeed, I'll do ASAP. 😉 |
ae4952b
to
fdfbe52
Compare
…ated files - Files are clearly suffixed with `_deprecated` so we know those features have no support nor migrations. - Views are removed, since updating from UI was too buggy to support it anymore.
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]
fdfbe52
to
78473b7
Compare
OK, I have done it in 3 commits so everything is clear and still we have all history in the same addon, so we avoid losing your commits by accident in the future:
|
There was a commit implied when updating it. |
I added a patch that makes the 1st autoupgrade since the module update know it needs to update all. Since the sha algorightm has changed, this addon upgrade will mean the upgrade of every addons in the database. This seems a little bit bad, but after all it's not such a really big problem since it should happen only once, and it's not that uncommon. |
FROM ir_module_module | ||
WHERE checksum_installed""") | ||
checksums = dict(env.cr.fetchall()) | ||
env["ir.module.module"]._save_checksums(checksums) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note the checksum algorithm has changed so this not help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, I'll do a couple of upgrade tests just to be sure and remove it, thanks 😉
Note: this method commits the current transaction at each important | ||
step, it is therefore not intended to be run as part of a | ||
larger transaction. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raise an error here if enable_deprecated is set? I'm not sure the two methods work well together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to my tests, they work fine together.
]) | ||
if int(own_module.latest_version.split(".")[2]) < 2: | ||
deprecated = "1" | ||
return deprecated == "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
headache 😄
8c2b50c
to
2d4a737
Compare
Cool, this one should be ready to review.
|
) | ||
|
||
tools.config['overwrite_existing_translations'] = \ | ||
overwrite_existing_translations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This translation option may not work as expected. We are investigating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'm gonna rebase all my commits in one, with another fix. Do you have push access to this PR? If so, you can push here the fix for that part after that 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My last functional tests show that overwrite_existing_translations
works well. Our doubts came from an external factor. 😃
The previous implementation of this addon proved being extremely buggy: - It supplied out of the box a enabled cron to update Odoo that didn't restart the server, which possibly meant that upgrades broke things. - It overloaded standard Odoo upgrade methods that made i.e. installing an addon sometimes forced to upgrade all other addons in the database. - The checksum system wasn't smart enough, and some files that didn't need a module upgrade triggered the upgrade. - It was based on a dirhash library that was untested. - Some updates were not detected properly. - Storing a column into `ir.module.module` sometimes forbids uninstalling the addon. Thanks to Stéphane Bidoul (ACSONE), now we have new methods to perform the same work in a safer and more stable way. All I'm doing here is: - Cron is disabled by default. - Installed checksums are no longer saved at first install. - Old installations should keep most functionality intact thanks to the migration script. - Drop some duplicated tests. - Allow module uninstallation by pre-removing the fields from ir.mode.model. - When uninstalling the addon, the deprecated features will get removed for next installs always. Besides that, fixes for the new implementation too: - When uninstalling the addon, we remove the stored checksum data, so further installations work as if the addon was installed from scratch.
e3ffa9d
to
f2d10e1
Compare
I squashed my commits so you can continue work on top of this; AFAICS my part should be ready to merge. I patched another little thing: when uninstalling the addon, the stored checksums now disappear. |
) | ||
|
||
@api.model | ||
def upgrade_changed_checksum(self, overwrite_existing_translations=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it would be a good idea to add here a different default?: overwrite_existing_translations=os.environ.get("ODOO_I18N_OVERWRITE", False)
, so we can set this directly through an env variable in automated environments? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Not 100% sure about the ODOO_
prefix, but otherwise 👍 .
8a3c57f
to
f2d10e1
Compare
This one seems ready to merge. |
Thanks to all! |
- `l10n-spain` was never a good sample, since only Spanish projects would have it. Since Tecnativa/doodba#86 it's simply not needed in most cases. Devs can check the docs to know the structure. Thus, it can be removed from here. - `checksumdir` is not used anymore in `module_auto_update` since OCA/server-tools#1190. - `xlsxwriter` is included in Odoo 10+. - `requests` is included in Odoo 8+.
- `l10n-spain` was never a good sample, since only Spanish projects would have it. Since Tecnativa/doodba#86 it's simply not needed in most cases. Devs can check the docs to know the structure, and a vscode snippet has been added. Thus, it can be removed from here. - `checksumdir` is not used anymore in `module_auto_update` since OCA/server-tools#1190. - `xlsxwriter` is included in Odoo 10+. - `requests` is included in Odoo 8+.
- `l10n-spain` was never a good sample, since only Spanish projects would have it. Since Tecnativa/doodba#86 it's simply not needed in most cases. Devs can check the docs to know the structure, and a vscode snippet has been added. Thus, it can be removed from here. - `checksumdir` is not used anymore in `module_auto_update` since OCA/server-tools#1190. - `xlsxwriter` is included in Odoo 10+. - `requests` is included in Odoo 8+.
- `l10n-spain` was never a good sample, since only Spanish projects would have it. Since Tecnativa/doodba#86 it's simply not needed in most cases. Devs can check the docs to know the structure, and a vscode snippet has been added. Thus, it can be removed from here. - `checksumdir` is not used anymore in `module_auto_update` since OCA/server-tools#1190. - `xlsxwriter` is included in Odoo 10+. - `requests` is included in Odoo 8+.
- `l10n-spain` was never a good sample, since only Spanish projects would have it. Since Tecnativa/doodba#86 it's simply not needed in most cases. Devs can check the docs to know the structure, and a vscode snippet has been added. Thus, it can be removed from here. - `checksumdir` is not used anymore in `module_auto_update` since OCA/server-tools#1190. - `xlsxwriter` is included in Odoo 10+. - `requests` is included in Odoo 8+.
Syncing from upstream OCA/server-tools (16.0)
The previous implementation of this addon proved being extremely buggy:
ir.module.module
sometimes forbids uninstalling the addon.For all of these reasons, the addon has been refactored:
*_deprecated.*
files.Most of the job is copied from @sbidoul's #1176, so credits are added where needed too.
@Tecnativa