Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible: fix scripts for LinuxONE and SmartOS #2569

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 0 additions & 125 deletions ansible/roles/baselayout/tasks/ccache.yml

This file was deleted.

51 changes: 9 additions & 42 deletions ansible/roles/baselayout/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@
- "{{ role_path }}/tasks/partials/repo/{{ os|stripversion }}.yml"
skip: true

- name: check for a recent enough ccache
when: os in ccache_no_binpkg or 'rhel7-s390x' in inventory_hostname
stat: path="{{ binary_dest }}"
register: has_ccache

- name: check for ccache aix
when: os|startswith("aix")
stat:
path: /opt/ccache-3.7.4/bin/ccache
register: has_ccache

- name: check for a recent enough git
when: os in git_no_binpkg
stat: path="{{ binary_dest }}"
Expand Down Expand Up @@ -107,20 +96,6 @@
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"

- name: Check whether /etc/paths contains "/usr/local/opt/ccache/libexec" (macos)
when: os|startswith("macos")
command: grep -Fxq "/usr/local/opt/ccache/libexec" /etc/paths
register: ccache_mac
check_mode: no
ignore_errors: yes
changed_when: no

- name: add ccache to the path (macos)
when: os|startswith("macos") and ccache_mac.rc == 1
lineinfile: dest=/etc/paths
insertbefore=BOF
line='/usr/local/opt/ccache/libexec'

- name: centos7_ppc64 | update package alternatives
when: os == "centos7" and arch == "ppc64"
alternatives:
Expand Down Expand Up @@ -213,23 +188,15 @@
- curl_64

- name: run ccache installer
when: os == "rhel7" and arch == "s390x" and not has_ccache.stat.exists
include: ccache.yml
static: false
vars:
- version: 3.3.3

- name: run ccache installer
when: os in ccache_no_binpkg and not has_ccache.stat.exists
include: ccache.yml
static: false

- name: run ccache installer
when: os|startswith("aix") and not has_ccache.stat.exists
include: ccache.yml
static: false
vars:
- version: 3.7.4
include: "{{ ccache_include }}"
loop_control:
loop_var: ccache_include
with_first_found:
- files:
- "{{ role_path }}/tasks/partials/ccache/{{ os }}-{{ arch }}.yml"
- "{{ role_path }}/tasks/partials/ccache/{{ os }}.yml"
- "{{ role_path }}/tasks/partials/ccache/{{ os|stripversion }}.yml"
skip: true

- name: set up ntp
include: "{{ ntp_include }}"
Expand Down
70 changes: 70 additions & 0 deletions ansible/roles/baselayout/tasks/partials/ccache/aix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
#
# Downloads and installs ccache
#

- name: "ccache : check for a recent enough ccache"
stat:
path: "/opt/ccache-3.7.4/bin/ccache"
register: has_ccache

- name: "ccache : fetch tarball - aix"
shell:
chdir: "/tmp"
cmd: "curl -L -o ccache-3.7.4.tar.gz https://github.com/ccache/ccache/releases/download/v3.7.4/ccache-3.7.4.tar.gz"
when: not has_ccache.stat.exists

- name: "ccache : extract tarball - aix"
shell:
chdir: "/tmp"
cmd: "/opt/freeware/bin/tar -xzf ccache-3.7.4.tar.gz"
when: not has_ccache.stat.exists

- name: "ccache : compile - aix"
shell:
chdir: "/tmp/ccache-3.7.4"
cmd: './configure CC="/opt/freeware/bin/gcc -maix64" && /opt/freeware/bin/gmake'
when: not has_ccache.stat.exists

- name: "ccache : install - create directory aix"
file:
path: /opt/ccache-3.7.4/{{ item.dest }}
state: directory
mode: '0755'
loop:
- { dest: bin }
- { dest: libexec }
when: not has_ccache.stat.exists

- name: "ccache : install - move file aix"
shell:
chdir: "/tmp"
cmd: "mv ccache-3.7.4/ccache /opt/ccache-3.7.4/bin"
when: not has_ccache.stat.exists

- name: "ccache : create symlinks - aix"
file:
src: /opt/ccache-3.7.4/bin/ccache
dest: /opt/ccache-3.7.4/libexec/{{ item.dest }}
owner: root
group: system
state: link
loop:
- { dest: gcc }
- { dest: g++ }
- { dest: gcov }
- { dest: cpp }
- { dest: c++ }
when: not has_ccache.stat.exists

- name: "ccache : cleanup - aix tarball"
file:
path: "/tmp/ccache-3.7.4.tar.gz"
state: absent
when: not has_ccache.stat.exists

- name: "ccache : cleanup - aix directory"
file:
path: /tmp/ccache-3.7.4
state: absent
when: not has_ccache.stat.exists
13 changes: 13 additions & 0 deletions ansible/roles/baselayout/tasks/partials/ccache/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: "ccache : check whether /etc/paths contains '/usr/local/opt/ccache/libexec' (macos)"
command: grep -Fxq "/usr/local/opt/ccache/libexec" /etc/paths
register: ccache_mac
check_mode: no
ignore_errors: yes
changed_when: no

- name: "ccache : add ccache to the path (macos)"
when: ccache_mac.rc == 1
lineinfile:
dest: "etc/paths"
insertbefore: BOF
line: "usr/local/opt/ccache/libexec"
63 changes: 63 additions & 0 deletions ansible/roles/baselayout/tasks/partials/ccache/rhel7-s390x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
#
# Downloads and installs ccache
#

- name: "ccache : check for a recent enough ccache"
stat:
path: "/usr/local/bin/ccache"
register: has_ccache

- name: "ccache : fetch samba ccache HTML page"
# This depends on ansible being able to run curl locally, YMMV, if it doesn't
# work, try changing the local_action to a remote one:
# raw: curl -sL https://www.samba.org/ftp/ccache/
local_action: shell curl -sL https://www.samba.org/ftp/ccache/ | sed -n -e 's/.*"ccache-\([0-9.]*\).tar.gz".*/\1/p' | tail -1
register: ccache_html_content
when: not has_ccache.stat.exists

- name: "ccache : extract ccache latest version"
set_fact:
ccache_latest: "{{ ccache_html_content.stdout }}"
when: not has_ccache.stat.exists

- name: "ccache : download and extract"
unarchive:
dest: /tmp/
remote_src: yes
src: "https://www.samba.org/ftp/ccache/ccache-{{ ccache_latest }}.tar.gz"
register: new_archive
when: not has_ccache.stat.exists

- name: "ccache : prepare for compilation"
shell: ./configure -q
args:
chdir: "/tmp/ccache-{{ ccache_latest }}"
when: not has_ccache.stat.exists

- name: "ccache : compile"
make:
chdir: "tmp/ccache-{{ ccache_latest }}"
when: not has_ccache.stat.exists

- name: "ccache : install"
copy:
dest: "/usr/local/bin"
mode: 0755
remote_src: yes
src: "/tmp/ccache-{{ ccache_latest }}/ccache"
when: not has_ccache.stat.exists

- name: "ccache : create symlinks"
loop_control:
loop_var: destination
with_items: [ 'gcc', 'cc', 'g++', 'c++' ]
file:
dest: "/usr/local/bin/{{ destination }}"
src: /usr/local/bin/ccache
state: link
when: not has_ccache.stat.exists

- name: "ccache : cleanup"
file: path="/tmp/ccache-{{ ccache_latest }}" state=absent
when: not has_ccache.stat.exists
Loading