Re: [Request Tracker Community Forum] [RT Developers] Generating list of all RT CPAN dependencies

I have created a ansible role for installing RT. The role performs a
fully automatic installation of RT for our purposes. The complete role
is not generic enough to distribute in full (Debian-specific), but the
role contains some ansible tasks which (somewhat hackishly) tries to
resolve RT dependencies. First by deducing suitable Debian packages, and
then be falling back to installing missing perl modules from CPAN.

Hopefully you can get some ideas on how to automate your installation
from this.

----- snip - snip -------------------------------------------------

  • name: Try to deduce and install APT packages from RT’s dependency test
    shell: |
    make testdeps |
    perl -lne β€˜print if (/dependencies:/ … eof())’ |
    grep β€˜.MISSING’ |
    perl -pe β€˜s/\s(\S+)\s.*MISSING/lc β€œlib$1-perl”/e’ |
    sed β€˜s/::/-/g’ |
    while read x; do if apt-cache show $x >/dev/null 2>&1; then echo $x; fi; done
    args:
    chdir: β€œ{{ rt_src_path }}/rt-{{ rt_version }}”
    register: rt_dep_pkgs
    tags:

    • rt_dep
  • name: Register missing packages as a variable/fact
    set_fact:
    rt_missing_pkgs: β€œ{{ rt_dep_pkgs.stdout.split() }}”
    tags:

    • rt_dep
  • name: Install missing Perl dependencies as Debian packages
    apt:
    name: β€œ{{ item }}”
    state: present
    with_items: β€œ{{ rt_missing_pkgs }}”
    ignore_errors: true
    tags:

    • rt_dep
  • name: Detect missing packages
    shell: |
    make testdeps |
    grep β€˜.MISSING’ |
    perl -ne β€˜($module, $version) = m/\s(\S+)\s*(?:>=)?\s*(\d+(.\d+)+)?\s*.*MISSING/; printf $module.($version ? β€œ~$version\n”:"\n")’ |
    sort | uniq
    args:
    chdir: β€œ{{ rt_src_path }}/rt-{{ rt_version }}”
    register: rt_cpanm_pkgs
    tags:

    • rt_dep
  • name: Register missing packages as a variable/fact
    set_fact:
    rt_cpanm_missing_pkgs: β€œ{{ rt_cpanm_pkgs.stdout.split() }}”
    tags:

    • rt_dep
  • name: Install missing Perl dependencies as CPAN packages
    cpanm:
    name: β€œ{{ item }}”
    with_items: β€œ{{ rt_cpanm_missing_pkgs }}”
    ignore_errors: true
    tags:

    • rt_dep
  • name: Finally, test remaining RT dependencies
    shell: |
    make testdeps
    args:
    chdir: β€œ{{ rt_src_path }}/rt-{{ rt_version }}”
    register: rt_testdeps
    changed_when: False
    failed_when: False
    tags:

    • rt_dep
  • name: Install RT
    shell: |
    make install
    args:
    chdir: β€œ{{ rt_src_path }}/rt-{{ rt_version }}”
    creates: β€œ{{ rt_install_path }}/sbin”

----- snip - snip -------------------------------------------------

1 Like