From ee372af8c07fa5f4c78ce0add4d779a8efb61625 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 4 May 2020 15:54:37 +0100 Subject: Roll training into main tesseract role; no need to keep it separate --- roles/tesseractor/tasks/leptonica.yml | 9 ++++- roles/tesseractor/tasks/tesseract.yml | 29 ++++++++++++--- roles/tesstrainer/handlers/main.yml | 3 -- roles/tesstrainer/tasks/ldlocal.yml | 9 ----- roles/tesstrainer/tasks/main.yml | 3 -- roles/tesstrainer/tasks/tesseract.yml | 67 ----------------------------------- trainer.yml | 9 ----- 7 files changed, 32 insertions(+), 97 deletions(-) delete mode 100644 roles/tesstrainer/handlers/main.yml delete mode 100644 roles/tesstrainer/tasks/ldlocal.yml delete mode 100644 roles/tesstrainer/tasks/main.yml delete mode 100644 roles/tesstrainer/tasks/tesseract.yml delete mode 100644 trainer.yml diff --git a/roles/tesseractor/tasks/leptonica.yml b/roles/tesseractor/tasks/leptonica.yml index 0664529..9b07c9b 100644 --- a/roles/tesseractor/tasks/leptonica.yml +++ b/roles/tesseractor/tasks/leptonica.yml @@ -3,8 +3,15 @@ - name: Install leptonica dependencies apt: - name: ['g++', 'git', 'libjpeg62-turbo-dev', 'libpng-dev', 'libtiff-dev', 'make', 'zlib1g-dev'] state: present + name: + - g++ + - git + - libjpeg62-turbo-dev + - libpng-dev + - libtiff-dev + - make + - zlib1g-dev - name: Clone leptonica repository git: diff --git a/roles/tesseractor/tasks/tesseract.yml b/roles/tesseractor/tasks/tesseract.yml index 99d15f8..56d8750 100644 --- a/roles/tesseractor/tasks/tesseract.yml +++ b/roles/tesseractor/tasks/tesseract.yml @@ -3,8 +3,23 @@ - name: Install tesseract dependencies apt: - name: ['g++', 'git', 'libjpeg62-turbo-dev', 'libpng-dev', 'libtiff-dev', 'make', 'zlib1g-dev'] state: present + name: + - g++ + - git + - libjpeg62-turbo-dev + - libpng-dev + - libtiff-dev + - make + - zlib1g-dev + +- name: Install tesseract training dependencies + apt: + state: present + name: + - libcairo2-dev + - libicu-dev + - libpango1.0-dev - name: Clone tesseract repository git: @@ -15,12 +30,16 @@ become: no register: tessclone -- name: Build tesseract - make: chdir=/home/{{ ansible_user }}/src/tesseract/simplemake +- name: Build tesseract and training tools + command: make all training + args: + chdir=/home/{{ ansible_user }}/src/tesseract/simplemake become: no when: tessclone.changed -- name: Install tesseract - make: chdir=/home/{{ ansible_user }}/src/tesseract/simplemake target=install +- name: Install tesseract and training tools + command: make install install-training + args: + chdir=/home/{{ ansible_user }}/src/tesseract/simplemake when: tessclone.changed notify: update ld.so diff --git a/roles/tesstrainer/handlers/main.yml b/roles/tesstrainer/handlers/main.yml deleted file mode 100644 index 12df781..0000000 --- a/roles/tesstrainer/handlers/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- name: update ld.so - command: /sbin/ldconfig diff --git a/roles/tesstrainer/tasks/ldlocal.yml b/roles/tesstrainer/tasks/ldlocal.yml deleted file mode 100644 index 2fd5fac..0000000 --- a/roles/tesstrainer/tasks/ldlocal.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# Sets ld.so to search /usr/local/lib for libraries - -- name: Add local path to ld.so.conf search path - lineinfile: - dest: /etc/ld.so.conf.d/locallib.conf - create: true - line: /usr/local/lib - notify: update ld.so diff --git a/roles/tesstrainer/tasks/main.yml b/roles/tesstrainer/tasks/main.yml deleted file mode 100644 index 33d6a30..0000000 --- a/roles/tesstrainer/tasks/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- include: tesseract.yml -- include: ldlocal.yml diff --git a/roles/tesstrainer/tasks/tesseract.yml b/roles/tesstrainer/tasks/tesseract.yml deleted file mode 100644 index 477c0e4..0000000 --- a/roles/tesstrainer/tasks/tesseract.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -# Installs tesseract - -- name: Install tesseract dependencies - package: name={{ item }} state=present - with_items: - - gcc-c++ - - git - - libjpeg-turbo-devel - - libpng12-devel - - libtiff-devel - - make - - zlib-devel - -- name: Install tesseract training dependencies - package: name={{ item }} state=present - with_items: - - cairo-devel - - libicu-devel - - pango-devel - -- name: Clone leptonica repository - git: - repo: https://github.com/nickjwhite/leptonica - dest: /home/ec2-user/src/leptonica - version: addinstall - depth: 1 - become: no - register: leptclone - -- name: Build leptonica - command: make -f makefile.static {{ item }} - args: - chdir: /home/ec2-user/src/leptonica/src - with_items: - - nodebug - - SHARED=yes shared - become: no - when: leptclone.changed - -- name: Install leptonica - command: make -f makefile.static install - args: - chdir: /home/ec2-user/src/leptonica/src - when: leptclone.changed - -- name: Clone tesseract repository - git: - repo: https://github.com/nickjwhite/tesseract - dest: /home/ec2-user/src/tesseract - version: amibuild - depth: 1 - become: no - register: tessclone - -- name: Build tesseract and training tools - command: make all training - args: - chdir: /home/ec2-user/src/tesseract/simplemake - become: no - when: tessclone.changed - -- name: Install tesseract and training tools - command: make install install-training - args: - chdir: /home/ec2-user/src/tesseract/simplemake - when: tessclone.changed diff --git a/trainer.yml b/trainer.yml deleted file mode 100644 index fb392b3..0000000 --- a/trainer.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- - -- name: Configure trainer servers - hosts: trainerami - become: yes - - roles: - - server - - tesstrainer -- cgit v1.2.1-24-ge1ad