Build debs with pbuilder (#18165)

* Build debs with pbuilder
* Update README in packaging/debian
* Add Dockerfile for building debs
* Add local_deb makefile target - Allows users to build debs using locally installed dependencies. This was the `deb` target before moving to pbuilder.
This commit is contained in:
Shane McDonald 2016-10-26 17:24:15 -04:00 committed by Matt Clay
commit 4ae0d5b843
5 changed files with 65 additions and 17 deletions

View file

@ -0,0 +1,16 @@
FROM ubuntu:xenial
RUN apt-get update && apt-get install -y \
asciidoc \
cdbs \
debootstrap \
devscripts \
make \
pbuilder \
python-setuptools
VOLUME /ansible
WORKDIR /ansible
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["make deb"]

View file

@ -3,26 +3,39 @@ Ansible Debian Package
To create an Ansible DEB package:
sudo apt-get install python-paramiko python-yaml python-jinja2 python-httplib2 python-setuptools python-six sshpass
sudo apt-get install cdbs debhelper git-core reprepro fakeroot asciidoc devscripts docbook-xml xsltproc libxml2-utils
sudo apt-get install dh-python build-essential
git clone git://github.com/ansible/ansible.git
cd ansible
make deb
__Note__: You must run this target as root or set `PBUILDER_BIN='sudo pbuilder'`
On older releases that do not have `dh-python` (like Ubuntu 12.04), install `python-support` instead:
```
apt-get install asciidoc cdbs debootstrap devscripts make pbuilder python-setuptools
git clone git://github.com/ansible/ansible.git
cd ansible
git submodule update --init
DEB_DIST='xenial trusty precise' make deb
```
sudo apt-get install python-support
Building in Docker:
The debian package file will be placed in the `../` directory. This can then be added to an APT repository or installed with `dpkg -i <package-file>`.
```
git clone git://github.com/ansible/ansible.git
cd ansible
git submodule update --init
docker build -t ansible-deb-builder -f packaging/debian/Dockerfile .
docker run --privileged -e DEB_DIST='trusty' -v $(pwd):/ansible ansible-deb-builder
```
The debian package file will be placed in the `deb-build` directory. This can then be added to an APT repository or installed with `dpkg -i <package-file>`.
Note that `dpkg -i` does not resolve dependencies.
To install the Ansible DEB package and resolve dependencies:
sudo dpkg -i <package-file>
sudo apt-get -fy install
```
dpkg -i <package-file>
apt-get -fy install
```
Or, if you are running Debian Stretch (or later) or Ubuntu Xenial (or later):
sudo apt install <package-file>
```
apt install /path/to/<package-file>
```

View file

@ -2,9 +2,6 @@
# -- makefile --
DEB_PYTHON2_MODULE_PACKAGES=ansible
ifneq ($(shell dpkg-query -f '$${Version}' -W python-support 2>/dev/null),)
DEB_PYTHON_SYSTEM=pysupport
endif
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk