<commit_before>---

###########################################################
#   1- OS dependencies (debian packages)
###########################################################

- name: "Add multiverse repositories"
  become: "yes"
  apt_repository:
    repo: "{{ item }}"
    state: "present"
  with_items:
    - "deb http://archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }} multiverse"
    - "deb http://archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }}-security universe"
    - "deb http://archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }}-updates multiverse"

- name: "Install archivematica-common package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_common_pkgdeps }}"

- name: "Install archivematica-dashboard package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_dashboard_pkgdeps }}"

- name: "Install archivematica-mcp-server package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_mcpserver_pkgdeps }}"

- name: "Install archivematica-mcp-client package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_mcpclient_pkgdeps }}"

# Have found that installation often stalls in freshclam
# Will download signatures from our repo to try to avoid this

#- name: "Download clamav signatures"
#  command: "freshclam"

# Check if clamav files exist already

- stat:
    path: "/var/lib/clamav/bytecode.cvd"
  register: "clamf1"

- stat:
    path: "/var/lib/clamav/bytecode.cld"
  register: "clamf1a"

- stat:
    path: "/var/lib/clamav/daily.cvd"
  register: "clamf2"

- stat:
    path: "/var/lib/clamav/daily.cld"
  register: "clamf2a"

- stat:
    path: "/var/lib/clamav/main.cvd"
  register: "clamf3"

- stat:
    path: "/var/lib/clamav/main.cld"
  register: "clamf3a"

- set_fact:
    clamav_download: "{{ not ( ( clamf1.stat.exists or clamf1a.stat.exists ) and
                               ( clamf2.stat.exists or clamf2a.stat.exists ) and
                               ( clamf3.stat.exists or clamf3a.stat.exists ) ) }}"

- debug:
    msg: "Need to download clamav signatures"
  when: "clamav_download"

- name: "Get clamav signatures from our github repo"
  git:
    repo: "https://github.com/artefactual-labs/clamav-files.git"
    dest: "/tmp/clamav-files"
  when: "clamav_download"

- name: "Copy clamav signatures to /var/lib/clamav"
  command: "cp /tmp/clamav-files/{{ item }} /var/lib/clamav/"
  become: yes
  with_items:
    - "bytecode.cvd"
    - "daily.cvd"
    - "main.cvd"
  when: "clamav_download"

- name: "Set user ownership for clamav files"
  file:
    path: "/var/lib/clamav"
    owner: "clamav"
    group: "clamav"
    state: "directory"
    recurse: "yes"
  when: "clamav_download"

- name: "Enable services"
  service:
    name: "{{ item }}"
    state: "started"
    enabled: "yes"
  with_items:
    - "fits"
    - "clamav-daemon"


###########################################################
#   2- python dependencies (pip packages)
###########################################################

- name: "Install archivematica-common pip dependencies"
  pip:
    requirements: "{{ archivematica_src_dir }}/archivematica/src/archivematicaCommon/requirements.txt"
    state: "latest"

- name: "Install archivematica-dashboard pip dependencies"
  pip:
    requirements: "{{ archivematica_src_dir }}/archivematica/src/dashboard/src/requirements.txt"
    state: "latest"

- name: "Check if MCPClient requirements file exists"
  stat:
    path: "{{ archivematica_src_dir }}/archivematica/src/MCPClient/requirements.txt"
    register: "requirements_file"

- name: "Install archivematica-mcp-client pip dependencies"
  pip:
    requirements: "{{ archivematica_src_dir }}/archivematica/src/MCPClient/requirements.txt"
    state: "latest"
  when: "requirements_file.stat.exists == True"
<commit_msg>Fix typo<commit_after>---

###########################################################
#   1- OS dependencies (debian packages)
###########################################################

- name: "Add multiverse repositories"
  become: "yes"
  apt_repository:
    repo: "{{ item }}"
    state: "present"
  with_items:
    - "deb http://archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }} multiverse"
    - "deb http://archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }}-security universe"
    - "deb http://archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }}-updates multiverse"

- name: "Install archivematica-common package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_common_pkgdeps }}"

- name: "Install archivematica-dashboard package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_dashboard_pkgdeps }}"

- name: "Install archivematica-mcp-server package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_mcpserver_pkgdeps }}"

- name: "Install archivematica-mcp-client package dependencies"
  apt:
    pkg: "{{ item }}"
    state: "latest"
  with_items: "{{ archivematica_src_am_mcpclient_pkgdeps }}"

# Have found that installation often stalls in freshclam
# Will download signatures from our repo to try to avoid this

#- name: "Download clamav signatures"
#  command: "freshclam"

# Check if clamav files exist already

- stat:
    path: "/var/lib/clamav/bytecode.cvd"
  register: "clamf1"

- stat:
    path: "/var/lib/clamav/bytecode.cld"
  register: "clamf1a"

- stat:
    path: "/var/lib/clamav/daily.cvd"
  register: "clamf2"

- stat:
    path: "/var/lib/clamav/daily.cld"
  register: "clamf2a"

- stat:
    path: "/var/lib/clamav/main.cvd"
  register: "clamf3"

- stat:
    path: "/var/lib/clamav/main.cld"
  register: "clamf3a"

- set_fact:
    clamav_download: "{{ not ( ( clamf1.stat.exists or clamf1a.stat.exists ) and
                               ( clamf2.stat.exists or clamf2a.stat.exists ) and
                               ( clamf3.stat.exists or clamf3a.stat.exists ) ) }}"

- debug:
    msg: "Need to download clamav signatures"
  when: "clamav_download"

- name: "Get clamav signatures from our github repo"
  git:
    repo: "https://github.com/artefactual-labs/clamav-files.git"
    dest: "/tmp/clamav-files"
  when: "clamav_download"

- name: "Copy clamav signatures to /var/lib/clamav"
  command: "cp /tmp/clamav-files/{{ item }} /var/lib/clamav/"
  become: yes
  with_items:
    - "bytecode.cvd"
    - "daily.cvd"
    - "main.cvd"
  when: "clamav_download"

- name: "Set user ownership for clamav files"
  file:
    path: "/var/lib/clamav"
    owner: "clamav"
    group: "clamav"
    state: "directory"
    recurse: "yes"
  when: "clamav_download"

- name: "Enable services"
  service:
    name: "{{ item }}"
    state: "started"
    enabled: "yes"
  with_items:
    - "fits"
    - "clamav-daemon"


###########################################################
#   2- python dependencies (pip packages)
###########################################################

- name: "Install archivematica-common pip dependencies"
  pip:
    requirements: "{{ archivematica_src_dir }}/archivematica/src/archivematicaCommon/requirements.txt"
    state: "latest"

- name: "Install archivematica-dashboard pip dependencies"
  pip:
    requirements: "{{ archivematica_src_dir }}/archivematica/src/dashboard/src/requirements.txt"
    state: "latest"

- name: "Check if MCPClient requirements file exists"
  stat:
    path: "{{ archivematica_src_dir }}/archivematica/src/MCPClient/requirements.txt"
  register: "requirements_file"

- name: "Install archivematica-mcp-client pip dependencies"
  pip:
    requirements: "{{ archivematica_src_dir }}/archivematica/src/MCPClient/requirements.txt"
    state: "latest"
  when: "requirements_file.stat.exists == True"

{'fraction_non_alphanumeric': 0.18694175367970814, 'fraction_numerical': 0.0035224556547993457, 'mean_word_length': 3.622093023255814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2230820', 'n_tokens_mistral': 2749, 'n_tokens_neox': 2708, 'n_words': 571}