Debian Codegraph @

test/integration/targets/apt/tasks/apt-multiarch.yml

raw
1 - name: get the default arch
2 command: dpkg --print-architecture
3 register: default_arch
4
5 - name: select a foreign arch for {{ default_arch.stdout }}
6 # When adding a new arch, pick a foreign arch hosted on the same repository mirror as the default arch. For example:
7 # - archive.ubuntu.com hosts both amd64 and i386
8 # - ports.ubuntu.com hosts both arm64 and armhf
9 include_vars: "{{ item }}"
10 with_first_found:
11 - "arch/{{ default_arch.stdout }}.yml"
12
13 - name: show the arch selected for multi-arch testing
14 debug:
15 msg: Using {{ apt_foreign_arch }} as the foreign arch for {{ default_arch.stdout }}
16
17 # verify that apt is handling multi-arch systems properly
18
19 - name: load version specific vars
20 include_vars: '{{ item }}'
21 with_first_found:
22 - files:
23 - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
24 - 'default.yml'
25 paths: '../vars'
26
27 - name: add architecture {{ apt_foreign_arch }}
28 command: dpkg --add-architecture {{ apt_foreign_arch }}
29
30 - name: install {{ multiarch_test_pkg }}:{{ apt_foreign_arch }} with apt
31 apt: pkg={{ multiarch_test_pkg }}:{{ apt_foreign_arch }} state=present update_cache=yes
32 register: apt_result
33 until: apt_result is success
34
35 - name: check {{ multiarch_test_pkg }} version
36 shell: dpkg -s {{ multiarch_test_pkg }} | grep Version | awk '{print $2}'
37 register: pkg_version
38
39 - name: uninstall {{ multiarch_test_pkg }}:{{ apt_foreign_arch }} with apt
40 apt: pkg={{ multiarch_test_pkg }}:{{ apt_foreign_arch }} state=absent purge=yes
41
42 - name: install deb file
43 apt: deb="/var/cache/apt/archives/{{ multiarch_test_pkg }}_{{ pkg_version.stdout }}_{{ apt_foreign_arch }}.deb"
44 register: apt_multi_initial
45
46 - name: install deb file again
47 apt: deb="/var/cache/apt/archives/{{ multiarch_test_pkg }}_{{ pkg_version.stdout }}_{{ apt_foreign_arch }}.deb"
48 register: apt_multi_secondary
49
50 - name: verify installation of {{ multiarch_test_pkg }}:{{ apt_foreign_arch }}
51 assert:
52 that:
53 - "apt_multi_initial.changed"
54 - "not apt_multi_secondary.changed"
55
56 - name: remove all {{ apt_foreign_arch }} packages
57 shell: "apt-get remove -y --allow-remove-essential '*:{{ apt_foreign_arch }}'"
58
59 - name: remove {{ apt_foreign_arch }} architecture
60 command: dpkg --remove-architecture {{ apt_foreign_arch }}