-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible: fix scripts for LinuxONE and SmartOS (#2569)
Move non-package manager ccache tasks into partial tasks to avoid the different platforms interfering which each other.
- Loading branch information
1 parent
7034b89
commit f65a7e6
Showing
7 changed files
with
220 additions
and
172 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
63
ansible/roles/baselayout/tasks/partials/ccache/rhel7-s390x.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.