Commit Graph

21 Commits (0c91ca664f9947b154bad5bbdfa35b0443347cc4)

Author SHA1 Message Date
OCA-git-bot 93d085b228 module_auto_update 15.0.1.0.1 2023-01-15 16:52:14 +00:00
Miku Laitinen ae00f76f38 [MIG] module_auto_update: Migration to 15.0 2021-12-27 17:39:03 +02:00
OCA-git-bot 86cced3486 module_auto_update 14.0.1.0.1 2021-12-27 16:49:36 +02:00
Manuel Engel 5106bcf5d7 [MIG] module_auto_update: Migration to 14.0 2021-12-27 16:49:36 +02:00
Eric Antones 30a9d259d0 [MIG] module_auto_update: Migration to 13.0 2021-12-27 16:49:36 +02:00
Eric Antones e5f4fd42f0 [IMP] module_auto_update: black, isort, prettier 2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) 2040a2d32d module_auto_update: remove maintainer 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) 9c0fe371c7 module_auto_update: cosmetics 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
Stéphane Bidoul (ACSONE) 4cc73f43db module_auto_update: 11.0.2.0.4 2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) d010cc579e module_auto_update: sbidoul as maintainer
Plus Stable development status
2021-12-27 16:49:36 +02:00
Jairo Llopis 2c034991c1 [FIX] module_auto_update: Ignore `__pycache__` in hash test
Python >= 3.2 implements [PEP 3147](https://www.python.org/dev/peps/pep-3147/), so in a precompiled environment, the patched test could fail with this or similar:

    FAIL: test_basic (odoo.addons.module_auto_update.tests.test_addon_hash.TestAddonHash)
    Traceback (most recent call last):
    `   File "/opt/odoo/auto/addons/module_auto_update/tests/test_addon_hash.py", line 42, in test_basic
    `     'static/src/some.js',
    ` AssertionError: Lists differ: ['REA[237 chars]o', 'models/__pycache__/stuff.cpython-35.opt-1[23 chars].js'] != ['REA[237 chars]o', 'static/src/some.js']
    `
    ` First differing element 14:
    ` 'models/__pycache__/stuff.cpython-35.opt-1.pyc'
    ` 'static/src/some.js'
    `
    ` First list contains 1 additional elements.
    ` First extra element 15:
    ` 'static/src/some.js'
    `
    `   ['README.rst',
    `    'data/f1.xml',
    `    'data/f2.xml',
    `    'i18n/en.po',
    `    'i18n/en_US.po',
    `    'i18n/fr.po',
    `    'i18n/fr_BE.po',
    `    'i18n/test.pot',
    `    'i18n_extra/en.po',
    `    'i18n_extra/fr.po',
    `    'i18n_extra/nl_NL.po',
    `    'models/stuff.py',
    `    'models/stuff.pyc',
    `    'models/stuff.pyo',
    ` -  'models/__pycache__/stuff.cpython-35.opt-1.pyc',
    `    'static/src/some.js']

With this patch, we fix all those failing tests in integration environments.
2021-12-27 16:49:36 +02:00
Stéphane Bidoul (ACSONE) 483d52b080 module_auto_update: bump version 2021-12-27 16:49:36 +02:00
Benjamin Willig 07d7f01f9f [CHG] updated version number 2021-12-27 16:49:36 +02:00
Jairo Llopis 3f81cc8906 [REF] module_auto_update: Step 3, backwards compatibility
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.
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
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
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