debs: Add generic infra-deb package build role
This is a reworking of the openafs package build script to be more generic. This will be used by vhd-util in follow-on changes. Change-Id: I11e2bdcbf2894d86105d75c3d3580aefb6aa18fc
This commit is contained in:
parent
e2c2e85fb0
commit
377b569473
2
roles/infra-deb-package-build/README.rst
Normal file
2
roles/infra-deb-package-build/README.rst
Normal file
@ -0,0 +1,2 @@
|
||||
Build Debian package for upload to infra PPA
|
||||
|
72
roles/infra-deb-package-build/tasks/main.yaml
Normal file
72
roles/infra-deb-package-build/tasks/main.yaml
Normal file
@ -0,0 +1,72 @@
|
||||
- name: Install prereqs
|
||||
package:
|
||||
name:
|
||||
- build-essential
|
||||
- devscripts
|
||||
- dpkg-dev
|
||||
- equivs # for mk-build-deps
|
||||
become: yes
|
||||
|
||||
- name: Make working directory
|
||||
file:
|
||||
path: '{{ ansible_user_dir }}/{{ infra_deb_project }}'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Build source
|
||||
args:
|
||||
executable: '/bin/bash'
|
||||
shell: |
|
||||
set -eux
|
||||
|
||||
# make the orig
|
||||
pushd '{{ zuul.project.src_dir }}'
|
||||
./make-orig.sh
|
||||
|
||||
# this puts a file with the version for us to use
|
||||
VERSION=$(cat ./version)
|
||||
|
||||
# copy the result and the debian/* directory to build area
|
||||
cp {{ infra_deb_project }}_${VERSION}.orig.tar.xz '{{ ansible_user_dir }}/{{ infra_deb_project }}'
|
||||
cp -r debian '{{ ansible_user_dir }}/{{ infra_deb_project }}'
|
||||
popd
|
||||
|
||||
pushd {{ infra_deb_project }}
|
||||
|
||||
# extract source and move into place
|
||||
tar xf {{ infra_deb_project }}_${VERSION}.orig.tar.xz
|
||||
mv debian ./{{ infra_deb_project }}_${VERSION}.orig
|
||||
|
||||
pushd {{ infra_deb_project }}_${VERSION}.orig
|
||||
|
||||
# install build deps
|
||||
mk-build-deps --install --root-cmd sudo --remove -t "apt-get -y"
|
||||
# build source packages
|
||||
debuild -S -sa --no-sign
|
||||
|
||||
popd
|
||||
|
||||
# clean up orig source from build
|
||||
rm -rf {{ infra_deb_project }}_${VERSION}.orig
|
||||
|
||||
popd
|
||||
|
||||
# create omnibus tar file
|
||||
tar czf {{ infra_deb_project }}-debs.tar.gz ./{{ infra_deb_project }}
|
||||
|
||||
- name: Copy built packages
|
||||
synchronize:
|
||||
src: '{{ ansible_user_dir }}/{{ infra_deb_project }}-debs.tar.gz'
|
||||
dest: '{{ zuul.executor.log_root }}'
|
||||
mode: pull
|
||||
|
||||
- name: Return build artifact
|
||||
zuul_return:
|
||||
data:
|
||||
zuul:
|
||||
artifacts:
|
||||
- name: deb-tar
|
||||
url: '{{ infra_deb_project }}-debs.tar.gz'
|
||||
metadata:
|
||||
type: deb.tar.gz
|
||||
|
Loading…
Reference in New Issue
Block a user