Generating list of all RT CPAN dependencies

I responded to your message earlier from my email-client using the
“Followup” function in my client, but my response ended up un-connected
to this thread. Apparently responses must have the correct To-header for
the forum software to route responses correctly. Using the CC-header
does not seem to work.

My response ended up here:

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