Skip to content
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

[IMP]runbot:add 'config' field and 'addons path' field to support additional config param and multi addons directories. #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions runbot/runbot.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def _get_base(self, cr, uid, ids, field_name, arg, context=None):
help="Community addon repos which need to be present to run tests."),
'token': fields.char("Github token"),
'group_ids': fields.many2many('res.groups', string='Limited to groups'),
'addons_path': fields.text('Addons Paths'),
'config': fields.text('Config'),
}
_defaults = {
'mode': 'poll',
Expand Down Expand Up @@ -595,9 +597,9 @@ def create(self, cr, uid, values, context=None):

# detect duplicate
domain = [
('repo_id','=',build.repo_id.duplicate_id.id),
('name', '=', build.name),
('duplicate_id', '=', False),
('repo_id','=',build.repo_id.duplicate_id.id),
('name', '=', build.name),
('duplicate_id', '=', False),
'|', ('result', '=', False), ('result', '!=', 'skipped')
]
duplicate_ids = self.search(cr, uid, domain, context=context)
Expand Down Expand Up @@ -762,6 +764,21 @@ def filter_modules(self, cr, uid, modules, available_modules, explicit_modules):
)
return uniq_list(filter(mod_filter, modules))

def get_addons_path(self, cr, uid, ids, context=None):
get_addons = []
for build in self.browse(cr, uid, ids, context=None):
root_path = build.path()
additional_path_list = build.repo_id.addons_path.split(',')
if additional_path_list:
for path in additional_path_list:
full_path = '%s%s' % (root_path, path if path.startswith('/') else '/' + path)
if os.path.exists(full_path):
get_addons.append(full_path)
get_addons.append('%s/%s' % (root_path, 'openerp/addons'))

return get_addons


def checkout(self, cr, uid, ids, context=None):
for build in self.browse(cr, uid, ids, context=context):
# starts from scratch
Expand Down Expand Up @@ -823,10 +840,11 @@ def checkout(self, cr, uid, ids, context=None):
shutil.rmtree(build.server('addons', basename))
shutil.move(module, build.server('addons'))

available_modules = [
os.path.basename(os.path.dirname(a))
for a in glob.glob(build.server('addons/*/__openerp__.py'))
]
available_modules = []
all_addons_path = build.get_addons_path()
for path in all_addons_path:
available_modules += [os.path.basename(os.path.dirname(a)) for a in glob.glob(build.server('%s/*/__openerp__.py' % path))]

if build.repo_id.modules_auto == 'all' or (build.repo_id.modules_auto != 'none' and has_server):
modules_to_test += available_modules

Expand Down Expand Up @@ -868,6 +886,17 @@ def cmd(self, cr, uid, ids, context=None):
server_path,
"--xmlrpc-port=%d" % build.port,
]
# add addons path if defined
addons = build.get_addons_path()
if addons:
cmd.append("--addons-path=%s" % ','.join(addons))
# create config file if needed
if build.repo_id.config:
file_path = build.path() + '/odoo.conf'
config_file = open(file_path, 'w')
config_file.write(build.repo_id.config)
config_file.close()
cmd.append('--config=%s' % file_path)
# options
if grep(build.server("tools/config.py"), "no-xmlrpcs"):
cmd.append("--no-xmlrpcs")
Expand Down Expand Up @@ -1225,7 +1254,7 @@ def repo(self, repo=None, search='', limit='100', refresh='', **post):
repo_ids = repo_obj.search(cr, uid, [])
repos = repo_obj.browse(cr, uid, repo_ids)
if not repo and repos:
repo = repos[0]
repo = repos[0]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will be asked to reset this commit to don't touch git blame

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a lot of times, this still happen, Is this the git core.autocrlf problem? I set it to false or true is not working, or maybe the IDE problem? I use PYCHARM

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a IDE issue. You can either try to turn it off (I don't know how) or review git diff before make a commit and revert such automatic changes


context = {
'repos': repos,
Expand Down
2 changes: 2 additions & 0 deletions runbot/runbot.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
<field name="duplicate_id"/>
<field name="dependency_ids" widget="many2many_tags"/>
<field name="modules"/>
<field name="addons_path"/>
<field name="modules_auto"/>
<field name="token"/>
<field name="group_ids" widget="many2many_tags"/>
<field name="config"/>
<field name="hook_time" readonly="1"/>
</group>
</sheet>
Expand Down