coala / cEPs

coala Enhancement Proposals
MIT License
33 stars 53 forks source link

cEP-0017.md: cEP describing design of cib #117

Closed saksham189 closed 6 years ago

saksham189 commented 6 years ago

Closes https://github.com/coala/cEPs/issues/10

jayvdb commented 6 years ago

I would dearly love to see https://github.com/coala/coala-bears/blob/master/bears/generate_package.py moved from coala-bears to a different location. it could be coala, cib, dependency_management. I really dont care. Ah, https://github.com/coala/coala-bears/issues/1199 is the related issue in that repo. And PEP 420 (https://github.com/coala/coala/issues/3545) is why I want it removed .. ;-)

Also I would like to see some evaluation of https://github.com/mbodenhamer/depman (who is a co-mentor on this project) to see if some of its functionality may help this project.

xferra commented 6 years ago

Before performing review itself I would like to raise several questions/topics; if they're out of the scope please just skip it; if it could be a critical open question - I suggest to mention it in the doc:

saksham189 commented 6 years ago

We could get the password using import getpass getpass.getpass('Password:') if root access is required.

If more than 1 package managers are available to install the linter on the platform, I think we could simply chose any 1 and continue. But if we should be giving a higher priority to any one such as apt-get over yum then they could be arranged in that order of priority.

For conflicting dependencies, print a warning to the user regarding the conflict or simply putting out verbose output of running the command.

jayvdb commented 6 years ago

Another packaging system which probably has enough complexity to meet our needs is the Ansible packaging modules.

xferra commented 6 years ago

@jayvdb Nice one, here is the link to the source code: https://github.com/ansible/ansible/tree/devel/lib/ansible/modules/packaging Please note that the license is GPL-3.0

saksham189 commented 6 years ago

This looks very cool! we could create a new role for package management and easily install dependencies for different platforms. I will investigate more and change cEP accordingly.

saksham189 commented 6 years ago

I have read the documentation for ansible. It is simple to install packages

- name: install basic package
  action: >
    {{ ansible_pkg_mgr }} name=some_name state=present

Information such as ansible_pkg_mgr is automatically collected by ansible from the host. DartLintBear can also be handled without using conda packages.

- name: install some package based on distro
  pip: name=some_name state=latest 
  when: ansible_distribution == "Darwin"

- name: install some package based on distro
  apt: name=some_name upgrade=dist 
  when: ansible_distribution == "Ubuntu"

Again ansible_distribution is collected by ansible.

Also, if we create a large playbook and add tags for the installation of each bear as shown

tasks:
   - name: Install PycodeStyleBear
     pip:
       name: PycodeStyleBear
       state: latest
     tags: PycodeStyleBear
ansible-playbook example.yml --tags "PycodeStyleBear"

This would install the required Bear. Tags are reusable so, we could add language tags etc. to filter and install the required bears. The only problem being that if the user forgets to specify tags option then all the bears would get installed.

Also, there are other option such as --ask-become-pass --become-method=sudo to gain root access. I will update this cEP soon.

saksham189 commented 6 years ago

@Udayan12167 please review

jayvdb commented 6 years ago

ack https://github.com/coala/cEPs/pull/117/commits/ca27c58eef778fd7b3aff3b874b0e58f56e4a559

jayvdb commented 6 years ago

@gitmate-bot ff

gitmate-bot commented 6 years ago

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently :warning:

gitmate-bot commented 6 years ago

Automated fastforward with GitMate.io was successful! :tada: