blob: 4312a7571735e6b583d51807c78d55443dbe2364 [file] [log] [blame]
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +02001{%- from "jenkins/map.jinja" import slave with context %}
2{%- if slave.pbuilder is defined %}
3
4{%- if slave.pbuilder.mirrorsite is defined %}
5MIRRORSITE="{{ slave.pbuilder.mirrorsite }}"
6{%- endif %}
7
Filip Pytlounc561e902016-02-24 18:23:42 +01008{%- if slave.pbuilder.othermirror is defined %}
Filip Pytlounc23be272016-02-24 18:27:57 +01009OTHERMIRROR="deb{% if slave.pbuilder.othermirror.get('trusted', True) %} [trusted=yes]{% endif %} {{ slave.pbuilder.othermirrror.url }} {{ slave.pbuilder.othermirror.dist }} {{ slave.pbuilder.othermirror.components|join(' ') }}"
Filip Pytlounc561e902016-02-24 18:23:42 +010010{%- endif %}
11
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020012{%- if slave.pbuilder.components is defined %}
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010013COMPONENTS="{{ slave.pbuilder.components|join(' ') }}"
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020014{%- endif %}
15
16{%- set keyring = slave.pbuilder.get('keyring', '/etc/apt/trusted.gpg') %}
17DEBOOTSTRAPOPTS=(${DEBOOTSTRAPOPTS[@]} "--keyring={{ keyring }}")
18APTKEYRINGS=(${APTKEYRINGS[@]} "{{ keyring }}")
19
20{%- if slave.pbuilder.aptcache is defined %}
21APTCACHE="{{ slave.pbuilder.aptcache }}"
22{%- endif %}
23
24{%- if slave.pbuilder.aptcachehardlink is defined %}
25APTCACHEHARDLINK="{{ 'yes' if slave.pbuilder.aptcachehardlink else 'no' }}"
26{%- endif %}
27
28{%- if slave.pbuilder.buildplace is defined %}
29BUILDPLACE="{{ slave.pbuilder.buildplace }}"
30{%- endif %}
31
32{%- if slave.pbuilder.buildresult is defined %}
33BUILDRESULT="{{ slave.pbuilder.buildresult }}"
34{%- endif %}
35
36{%- if slave.pbuilder.ccachedir is defined %}
37CCACHEDIR="{{ slave.pbuilder.ccachedir }}"
38{%- endif %}
39
40{%- if slave.pbuilder.usenetwork is defined %}
41USENETWORK="{{ 'yes' if slave.pbuilder.usenetwork else 'no' }}"
42{%- endif %}
43
Filip Pytloune240bfa2016-02-23 12:52:12 +010044BINDMOUNTS="/var/cache/pbuilder/build"
45
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020046{%- if slave.pbuilder.parallel is defined %}
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020047{%- if slave.pbuilder.parallel %}
48{# Automatically set jobs to no. of cpus #}
49JOBS=$(grep -c processor /proc/cpuinfo)
50{%- else %}
51JOBS={{ slave.pbuilder.parallel }}
52{%- endif %}
53
54DEB_BUILD_OPTIONS="parallel=${JOBS} $DEB_BUILD_OPTIONS"
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020055{%- endif %}
56
Filip Pytloun07793d52016-06-14 15:09:40 +020057{%- if slave.pbuilder.get('eatmydata', False) %}
58EXTRAPACKAGES="$EXTRAPACKAGES eatmydata"
59export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+"$LD_LIBRARY_PATH:"}/usr/lib/libeatmydata
60export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}libeatmydata.so"
61{%- endif %}
62
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010063{%- for os, distribution in slave.pbuilder.get('os', {}).iteritems() %}
64if [ "$OS" == "{{ os }}" ]; then
65 {%- for dist_name, dist in distribution.iteritems() %}
66 if [ "$DIST" == "{{ dist_name }}" ]; then
67 DISTRIBUTION="$DIST"
68 MIRRORSITE="{{ dist.mirrorsite }}"
Filip Pytloun07793d52016-06-14 15:09:40 +020069
Filip Pytlounc561e902016-02-24 18:23:42 +010070 {%- if dist.othermirror is defined %}
Filip Pytlounc23be272016-02-24 18:27:57 +010071 OTHERMIRROR="deb{% if dist.othermirror.get('trusted', True) %} [trusted=yes]{% endif %} {{ dist.othermirror.url }} {{ dist.othermirror.get('dist', dist_name) }} {{ dist.othermirror.components|join(' ') }}"
Filip Pytlounc561e902016-02-24 18:23:42 +010072 {%- endif %}
Filip Pytloun07793d52016-06-14 15:09:40 +020073
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010074 COMPONENTS="{{ dist.components|join(' ') }}"
Filip Pytloun07793d52016-06-14 15:09:40 +020075
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010076 {%- if dist.keyring is defined %}
77 DEBOOTSTRAPOPTS=(${DEBOOTSTRAPOPTS[@]} "--keyring={{ dist.keyring }}")
78 APTKEYRINGS=(${APTKEYRINGS[@]} "{{ dist.keyring }}")
79 {%- endif %}
80 ARCH="${ARCH:-{{ dist.get('arch', '$(dpkg --print-architecture)') }}}"
Filip Pytloun07793d52016-06-14 15:09:40 +020081
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010082 {%- if dist.extrapackages is defined %}
83 EXTRAPACKAGES="$EXTRAPACKAGES {{ dist.extrapackages|join(' ') }}"
84 {%- endif %}
85
Filip Pytloun07793d52016-06-14 15:09:40 +020086 {%- if dist.get('eatmydata', False) %}
87 EXTRAPACKAGES="$EXTRAPACKAGES eatmydata"
88 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+"$LD_LIBRARY_PATH:"}/usr/lib/libeatmydata
89 export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}libeatmydata.so"
90 {%- endif %}
91
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010092 NAME="${OS}-${DIST}-${ARCH}"
93 BASETGZ="/var/cache/pbuilder/${NAME}-base.tgz"
94 BUILDRESULT="/var/cache/pbuilder/${NAME}/result/"
95 APTCACHE="/var/cache/pbuilder/${NAME}/aptcache/"
Filip Pytloun1b385032016-03-04 16:43:18 +010096 BASEPATH="/var/cache/pbuilder/${NAME}-base.cow"
Filip Pytloun4ed2b9b2016-02-23 13:29:35 +010097 fi
98 {%- endfor %}
99fi
100{%- endfor %}
101
Filip Pytloune240bfa2016-02-23 12:52:12 +0100102ARCH="${ARCH:-{{ slave.pbuilder.get('arch', '$(dpkg --print-architecture)') }}}"
103
104if [ "$ARCH" == "armel" ] && [ "$(dpkg --print-architecture)" != "armel" ]; then
105 DEBOOTSTRAP="qemu-debootstrap"
106fi
107if [ "$ARCH" == "armhf" ] && [ "$(dpkg --print-architecture)" != "armhf" ]; then
108 DEBOOTSTRAP="qemu-debootstrap"
109fi
Filip Pytloun9d149bf2016-03-14 17:04:45 +0100110if [ "$ARCH" == "arm64" ] && [ "$(dpkg --print-architecture)" != "arm64" ]; then
111 DEBOOTSTRAP="qemu-debootstrap"
112fi
Filip Pytloune240bfa2016-02-23 12:52:12 +0100113
114DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--arch=$ARCH")
115
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200116{%- endif %}
Filip Pytloun9d149bf2016-03-14 17:04:45 +0100117
118{#-
119vim: syntax=jinja
120-#}