Skip to content

Wrong ODOO_VERSION in bootstrap #51

@ddejong-therp

Description

@ddejong-therp

I've noticed that when I use the migration script to set up build directories for a migration, it may go wrong because the build has been set up to use a wrong python version.

After investigating this issue, I've noticed that it would set up certain files (like .env-default, .python-version) from the wrong template file.
See these logs for example:

INFO: Link /home/ubuntu/odoo/migration/build-12.0/waftlib/templates/16.0/.env-default to /home/ubuntu/odoo/migration/build-12.0/.env-default
INFO: Link /home/ubuntu/odoo/migration/build-12.0/waftlib/templates/12.0/.python-version to /home/ubuntu/odoo/migration/build-12.0/.python-version

It links .env-default from the 16.0 instead of 12.0
It could link the .python-version from 16.0 instead 12.0 too, which will break a lot more.

See this line: https://github.com/sunflowerit/waftlib/blob/master/bootstrap#L41C66-L41C78
At this point, $ODOO_VERSION is still not necessarily set by anything in waft.
The .env-default file may have been edited to not define the variable, so then it would use the value for $ODOO_VERSION, which could have been previously defined.
In the migration script, $ODOO_VERSION is already defined because waftlib/bin/migrate.py loads them from the .env-* files in the top build directory. Then that script invokes the bootstrap script of another waft build while $ODOO_VERSION is already defined.

I think what needs to happen, is that somewhere at the top of the script the .env-* files need to be called if they exist, so that all the variables (including $ODOO_VERSION) of the waft sub-build are available.
Even if the migration script is not involved, someone could edit and remove the $ODOO_VERSION variable from .env-default, then use ./bootstrap, and then things would break, because $ODOO_VERSION would not be set yet.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions