Debian Codegraph @

test/integration/targets/apt/tasks/hello-traditional.yml

raw
1 - name: create hello-traditional from hello, cleanup not needed, OUTPUT_DIR gets cleared
2 vars:
3 outdir: '{{lookup("env", "OUTPUT_DIR")}}'
4 workdir: '{{outdir}}/hello-traditional'
5 control: '{{workdir}}/DEBIAN/control'
6 block:
7 - name: ensure we have our dirs
8 file:
9 path: '{{item}}'
10 state: directory
11 loop:
12 - '{{outdir}}'
13 - '{{workdir}}'
14 - '{{workdir}}/DEBIAN'
15
16 - name: download deb
17 shell:
18 cmd: apt download hello
19 chdir: '{{outdir}}'
20
21 - name: extract files and metafiles
22 shell: '{{" ".join(["dpkg-deb", "-" + item.flag, outdir + "/hello_*.deb", workdir + item.dest])}}'
23 loop:
24 - flag: e
25 dest: /DEBIAN/
26 - flag: x
27 dest: /
28
29 - name: in case conflict didn't exist
30 lineinfile:
31 path: '{{control}}'
32 regexp: '^Conflicts: hello'
33 line: 'Conflicts: hello'
34
35 - name: modify into hello-traditional, conflicting!!!
36 replace:
37 path: '{{control}}'
38 regexp: '{{item.old}}'
39 replace: '{{item.new}}'
40 loop:
41 - old: '^Package: hello$'
42 new: 'Package: hello-traditional'
43 - old: '^Conflicts: hello-traditional$'
44 new: 'Conflicts: hello'
45
46 - name: build hello
47 shell: dpkg-deb -b {{workdir}} {{outdir}}/hello-traditional.deb
48
49 - name: Try again, now try installing hello-traditional, that conflicts with hello
50 apt:
51 deb: '{{outdir}}/hello-traditional.deb'
52 state: present
53 fail_on_autoremove: yes
54 ignore_errors: yes
55 register: apt_result