Generating list of all RT CPAN dependencies

I’m trying to automate the installation of RT so I can easily create/destroy VMs for testing. To do this, I need to know which CPAN modules RT depends on so they can be installed before I start the RT installation.

Is there a way to generate all the RT CPAN dependencies in a machine-parseable format (one module per line would be fine)? make testdeps and ./sbin/rt-test-dependencies almost give me what I want, except they include lots of extra text that gets in the way of processing (e.g. I don’t want to know if a module is installed or not).

See etc/cpanfile in your RT dir

Thanks, unfortunately even using that I couldn’t get all the CPAN depedencies to install so I’m probably going to look at another system.

Couldn’t you use the’make fixdeps’ command in a script to automate the install? Or just copy what the make file does when you run that?

The reason I wanted a one-per-line list of dependencies was so I could pull them into Ansible and run them through the cpanm module to make sure they were all installed. make fixdeps doesn’t do that (and failed repeatedly when run manually).

Oh you are having trouble installing the modules? There are usually a few OS packages you need to install for some of the Perl packages to work

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