Commit Graph

13 Commits (d24f3d77a3fd5dd12e4ea70f48e1db478c6e06a2)

Author SHA1 Message Date
Eric Antones e5f4fd42f0 [IMP] module_auto_update: black, isort, prettier 2021-12-27 16:49:36 +02:00
Alexey Pelykh da5d5d892d [IMP] module_auto_update: UI button 2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) 4fe1c0a110 [MIG] module_auto_update from 11 to 12
Use tagged to mark post install tests as previous mechanism
seems to be broken.
2021-12-27 16:49:36 +02:00
Simone Orsi f4588878da Global pylint cleanup 2021-12-27 16:49:36 +02:00
Denis Roussel c25aede879 [10.0][FIX] module_auto_update: Don't set 'to upgrade' on void recordset modules 2021-12-27 16:49:36 +02:00
Laurent Mignon (ACSONE) 0c1395a3d8 [FIX] Forward port module_auto_update refactoring from 9.0 2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) a1f71e9ad6 [REF] module_auto_update: Step 2, add new API
This code comes from the module_checksum_upgrade proposal
at https://github.com/OCA/server-tools/pull/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]
2021-12-27 16:49:36 +02:00
Jairo Llopis 015c18004d [REF] module_auto_update: Step 1, move all deprecated stuff to deprecated 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.
2021-12-27 16:49:36 +02:00
Jairo Llopis 4f351b283b [MIG] module_auto_update: Migrate to v11 2021-12-27 16:49:36 +02:00
Jairo Llopis ea9ae22d49 [FIX][module_auto_update] Record base addon checksum (#948) 2021-12-27 16:49:36 +02:00
Dave Lasley 3e868c0448 [FIX] module_auto_update: Don't compute upgrade on uninstall
* `button_uninstall` calls `get_module_list`, which subsequently forces module upgrades. Add a context validation to prevent that
* Add test for button_immediate_uninstall
* Mock commit for immediate uninstall
* Fix immediate uninstall test
* Switch nesting
* Bump module version
2021-12-27 16:49:36 +02:00
Jairo Llopis 2052967605 [REF][module_auto_update] Forward port v9 improvements
* Recompute dir hashes only when needed - By removing the recomputation from `update_list` we get faster CLI module upgrades and it only performs the autoupdate when using the autoupdate wizard or cron.
* Pass tests if addon is in readonly directory
* Set dependencies to upgrade

[FIX][module_auto_update] Pass tests if addon is in readonly directory

[FIX][module_auto_update] Set dependencies to upgrade
2021-12-27 16:49:36 +02:00
Brenton Hughes 890d8766e6 [ADD] module_auto_update: Create module (#882)
* [IMP] module_auto_update: Create new module
* Add checksum_dir and checksum_installed fields to ir.module.module
  * Add checksum_dir to compute current checksum of module directory
    in addons path
  * Add checksum_installed to store checksum of module directory
    when module was last installed or upgraded
* Use checksumdir Python library to compute module directory sha1
  hashes, ignoring pyc and pyo extensions
* Extend update_list method to compare modules' checksum_dir and
  checksum_installed, then change state of modules with differing
  checksums to 'to upgrade'
* Replace Apps/Updates menu item with menu item of same name, which
  updates apps list and displays tree view of ir.module.module
  records with state 'to upgrade'
* Extend create and write methods to store computed checksum_dir as
  checksum_installed during module installation and upgrade, and
  set checksum_installed to False on uninstall
* Use context to stop checksum_installed from being updated during
  upgrade/uninstall cancellation
* Add cron job to periodically check for module upgrades by
  comparing checksums, then perform any available upgrades
* Extend upgrade_module method (called by cron and 'Apply Scheduled
  Upgrades' menu item) to call update_list
* Add post_init_hook to store checksum_installed of existing
  modules
* Add test coverage

* [FIX] module_auto_update: Fix test broken by changes
* Use dummy module to test update_list method instead of
  module_auto_update
2021-12-27 16:49:36 +02:00