ansible: Use 'compilers_legacy_install' to control legacy CC installation
[lttng-ci.git] / automation / ansible / roles / cross-compilers / tasks / setup-Debian.yml
index d2be6b9b97cee1590c21dc0b8289b6936abaf92d..a03cfa9de0e4006e055ae2e60b510be997d2bb00 100644 (file)
@@ -2,6 +2,46 @@
 - name: Update apt cache.
   apt: update_cache=yes cache_valid_time=86400
 
+- name: Add snapshot soures for gcc-11-powerpc/riscv64
+  when: ansible_distribution == 'Debian'
+  block:
+    - ansible.builtin.copy:
+        dest: /etc/apt/preferences.d/snapshot.pref
+        content: "Package: *\nPin: origin \"snapshot.debian.org\"\nPin-Priority: 400\n"
+      when: cross_compilers_debian_bookworm_snapshot
+    - ansible.builtin.apt_repository:
+        repo: 'deb [check-valid-until=no] https://snapshot.debian.org/archive/debian/20230109T091852Z/ bookworm main'
+        state: "{{cross_compilers_debian_bookworm_snapshot|ternary('present', 'absent')}}"
+    - ansible.builtin.apt:
+        update_cache: true
+
 - name: Ensure cross-compilers packages are installed.
-  apt: "name={{ item }} state=present"
-  with_items: "{{ cross_compilers_packages }}"
+  apt: "name={{ cross_compilers_packages }} state=present"
+
+- name: Install legacy cross compilers
+  when: ansible_distribution == 'Debian' and ansible_architecture == 'x86_64' and compilers_legacy_install
+  block:
+    # This step needs to happen after the cross compiler packages are installed
+    # so the libgcc cross libraries can be copied
+    - name: Copy gcc-cross libs
+      ansible.builtin.command:
+        argv: ['cp', '-r', "/usr/lib/gcc-cross/{{item}}/12/", "/usr/lib/gcc-cross/{{item}}/4.8.5"]
+        creates: "/usr/lib/gcc-cross/{{item}}/4.8.5"
+      with_items:
+        - aarch64-linux-gnu
+        - arm-linux-gnueabihf
+        - i686-linux-gnu
+        - powerpc64le-linux-gnu
+        - powerpc-linux-gnu
+        - riscv64-linux-gnu
+        - s390x-linux-gnu
+    - name: Download legacy compiler binaries
+      # These binaries built from files/Containerfile
+      ansible.builtin.get_url:
+        url: https://obj.internal.efficios.com/jenkins/gcc-4.8-x86_64-linux-gnu-cross.tgz
+        dest: /root/gcc-4.8-x86_64-linux-gnu-cross.tgz
+      register: cross_download
+    - name: Extract legacy compiler binaries
+      when: cross_download.changed
+      ansible.builtin.command:
+        argv: ['tar', '-C', '/', '-xzf', '/root/gcc-4.8-x86_64-linux-gnu-cross.tgz']
This page took 0.024858 seconds and 4 git commands to generate.