-
Notifications
You must be signed in to change notification settings - Fork 310
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
[WIP] Autogenerate repos.yaml for missing addons #86
Conversation
build.d/300-oca-dependencies
Outdated
if len(parts) > 2: | ||
branch = parts[2] | ||
else: | ||
branch = os.environ.get('VERSION', '10.0') |
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 env var is called ODOO_VERSION
, and you should not default to any value. It is considered an error if it is not available. Just use brackets and let the proper KeyError
bubble up if it ever happens.
build.d/300-oca-dependencies
Outdated
|
||
# Method from maintainer-quality-tools | ||
def parse_depfile(depfile, owner='OCA'): | ||
deps = [] |
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.
I think this should be a set, to avoid possible duplicates.
build.d/300-oca-dependencies
Outdated
|
||
def process_dependencies(dep_list): | ||
for dep in dep_list: | ||
if dep in processed_dependencies: |
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.
declare this in the method?
build.d/300-oca-dependencies
Outdated
return True | ||
|
||
addons_yaml = yaml.load(open('%s/addons.yaml' % CUSTOM_DIR, 'r')) | ||
repos_yaml = yaml.load(open('%s/repos.yaml' % CUSTOM_DIR, 'r')) |
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.
Get these from odoobaselib
build.d/300-oca-dependencies
Outdated
addons_yaml = yaml.load(open('%s/addons.yaml' % CUSTOM_DIR, 'r')) | ||
repos_yaml = yaml.load(open('%s/repos.yaml' % CUSTOM_DIR, 'r')) | ||
|
||
branch = os.environ.get('VERSION', '10.0') |
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.
Same as above, no .get
!
build.d/300-oca-dependencies
Outdated
|
||
branch = os.environ.get('VERSION', '10.0') | ||
processed_dependencies = set() | ||
base_url = 'https://raw.githubusercontent.com/OCA' |
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 should be a constant at the top of the file
build.d/300-oca-dependencies
Outdated
base_url = 'https://raw.githubusercontent.com/OCA' | ||
|
||
# Find all dependency files after initial aggregation | ||
dep_files = glob.glob('%s/**/oca_dependencies.txt' % CUSTOM_DIR) |
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.
Use iglob
build.d/300-oca-dependencies
Outdated
process_dependencies(initial_dependencies) | ||
|
||
auto_addons_yaml = open('%s/addons.yaml' % ADDONS_DIR, 'w') | ||
auto_repos_yaml = open('%s/repos.yaml' % ADDONS_DIR, 'w') |
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.
Declare these at odoobaselib
build.d/300-oca-dependencies
Outdated
'target': {'origin': '$ODOO_VERSION'}, | ||
'merges': [{'origin': '$ODOO_VERSION'}], | ||
} | ||
repos_yaml[dep[0]] = {'./%s' % dep[0]: repo_vals} |
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.
Remove the ./
please
635050e
to
e88faa0
Compare
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.
LGTM outside of @yajo comments
@yajo added the mentioned changes. However in local tests it fails, i need to debug to fix the issues (one being it should not run if AGGREGATE env var is not defined). It also has to start the second aggregation once everything worked. |
docker-compose.yml
Outdated
@@ -0,0 +1 @@ | |||
devel.yaml |
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.
Remove this file.
build.d/300-oca-dependencies
Outdated
|
||
# Find all dependency files after initial aggregation | ||
dep_files = glob.glob('%s/**/oca_dependencies.txt' % CUSTOM_DIR) | ||
dep_files = iglob('%s/**/oca_dependencies.txt' % CUSTOM_DIR) |
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.
No need for double asterisk, I think the file can only be found at repo root
build.d/300-oca-dependencies
Outdated
if len(parts) > 1: | ||
url = parts[1] | ||
else: | ||
url = 'https://github.com/%s/%s.git' % (owner, repo) |
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 should add to the dockerfile ONBUILD ARG DEFAULT_REPO_PATTERN="https://github.com/OCA/%s.git"
and rely on that env variable instead.
build.d/300-oca-dependencies
Outdated
repo_vals = { | ||
'defaults': {'depth': '$DEPTH_DEFAULT'}, | ||
'remotes': {'origin': dep[1]}, | ||
'target': {'origin': '$ODOO_VERSION'}, |
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.
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.
I think I checked the output of this and it made the proper output i.e:
target: origin $ODOO_VERSION
Isn't that right?
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, that's the proper output, although I'd be surprised if it gets there like that. I'd expect this line to be 'target': 'origin $ODOO_VERSION',
instead.
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.
Oh I see, because in the link you gave and in the default repos yaml it's not as a string
build.d/300-oca-dependencies
Outdated
|
||
# Generate auto_addons and auto_repos yaml files | ||
for dep in dependencies: | ||
ADDONS_YAML[dep[0]] = ['*'] |
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.
ADDONS_YAML
only contains the string of the file location. The actual parsing is done at odoobaselib.addons_config()
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.
Ah so I need to use the result from that method to find out the actual addons instead of just using the file itself. Any idea how I can debug easier maybe even use PDB to save time and not build everything from scratch to test the python script?
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.
Try running a project with scaffolding and everything, and mounting this script as a volume under it. Then run it manually inside the container.
build.d/300-oca-dependencies
Outdated
'target': {'origin': '$ODOO_VERSION'}, | ||
'merges': [{'origin': '$ODOO_VERSION'}], | ||
} | ||
REPOS_YAML[dep[0]] = {'%s' % dep[0]: repo_vals} |
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.
REPOS_YAML
contains only the file string. Its actual parsing is done by git-aggregator itself by using the autoaggregate
script. Possibly you'll need to add an argument to that string that lets you specify the file you are aggregating (from custom or from auto).
I will resume work on this when I get a bit more time. I couldn't follow every reply on the mailing list regarding the pip installing method vs Doodba. This is still needed right? |
Yes, as explained in OCA/runbot-addons#144 (comment), I still see many benefits on addons.yaml system, I don't think it will fade away soon (although pip installing support is still there, of course) |
According to OCA/runbot-addons#144 (comment) (and mostly to the whole conversation) it seems OCA is not interested in this project, so please @PCatinean could you split this PR in 2?
... Or otherwise just do step 1. Step 2 was a step needed to use Doodba in OCA. Since that's not going to happen, most likely it means that it goes to the collection of stuff that we just won't need. 🤔 |
@yajo I see, so basically in step 1 whenever an addon is declared in addons.yaml but it's not present in repos.yaml assume it's an oca repo and update repos.yaml accordingly? |
yep! |
With this change, definitely we can have a Doodba scaffolding without `repos.yaml` file. It will do this: 1. Download all git code from repos in `repos.yaml`, if any. 2. Get the list of expected code repos from `addons.yaml`. 3. Autogenerate a `repos.yaml` file for all expected but absent repos, based on the provided patterns. 4. Download all of that missing code. 5. Continue normal operation. As a 🎁, we now download git code in parallel if the building machine has more than 1 CPU. Some tests have been modified to ensure they still pass with this new feature.
- `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+.
Since Tecnativa/doodba#86, no addons or repos are required. This comment is an old true that is today a lie, so it's better away from here.
Since Tecnativa/doodba#86, no addons or repos are required. This comment is an old true that is today a lie, so it's better away from here.
Since Tecnativa/doodba#86, no addons or repos are required. This comment is an old true that is today a lie, so it's better away from here.
Since Tecnativa/doodba#86, no addons or repos are required. This comment is an old true that is today a lie, so it's better away from here.
…r automatic dependency resolution