summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile24
-rw-r--r--packaging/debian/Dockerfile16
-rw-r--r--packaging/debian/README.md37
-rwxr-xr-xpackaging/debian/rules3
5 files changed, 65 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index 3dbd0190ef..4ebacf429a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,7 +43,7 @@ docsite/htmlout
docs-api/rst/
docs-api/_build/
# deb building stuff...
-debian/
+/debian/
deb-build
# Vim swap files
*.swp
diff --git a/Makefile b/Makefile
index 8628ea3537..4dbede4722 100644
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,12 @@ DEB_PPA ?= ppa
# Choose the desired Ubuntu release: lucid precise saucy trusty
DEB_DIST ?= unstable
+# pbuilder parameters
+PBUILDER_ARCH ?= amd64
+PBUILDER_CACHE_DIR = /var/cache/pbuilder
+PBUILDER_BIN ?= pbuilder
+PBUILDER_OPTS ?= --debootstrapopts --variant=buildd --architecture $(PBUILDER_ARCH) --debbuildopts -b
+
# RPM build parameters
RPMSPECDIR= packaging/rpm
RPMSPEC = $(RPMSPECDIR)/ansible.spec
@@ -230,7 +236,23 @@ debian: sdist
sed -ie "s|%VERSION%|$(VERSION)|g;s|%RELEASE%|$(DEB_RELEASE)|;s|%DIST%|$${DIST}|g;s|%DATE%|$(DEB_DATE)|g" deb-build/$${DIST}/$(NAME)-$(VERSION)/debian/changelog ; \
done
-deb: debian
+deb: deb-src
+ @for DIST in $(DEB_DIST) ; do \
+ PBUILDER_OPTS="$(PBUILDER_OPTS) --distribution $${DIST} --basetgz $(PBUILDER_CACHE_DIR)/$${DIST}-$(PBUILDER_ARCH)-base.tgz --buildresult $(CURDIR)/deb-build/$${DIST}" ; \
+ $(PBUILDER_BIN) create $${PBUILDER_OPTS} --othermirror "deb http://archive.ubuntu.com/ubuntu $${DIST} universe" ; \
+ $(PBUILDER_BIN) update $${PBUILDER_OPTS} ; \
+ $(PBUILDER_BIN) build $${PBUILDER_OPTS} deb-build/$${DIST}/$(NAME)_$(VERSION)-$(DEB_RELEASE)~$${DIST}.dsc ; \
+ done
+ @echo "#############################################"
+ @echo "Ansible DEB artifacts:"
+ @for DIST in $(DEB_DIST) ; do \
+ echo deb-build/$${DIST}/$(NAME)_$(VERSION)-$(DEB_RELEASE)~$${DIST}_amd64.changes ; \
+ done
+ @echo "#############################################"
+
+# Build package outside of pbuilder, with locally installed dependencies.
+# Install BuildRequires as noted in packaging/debian/control.
+local_deb: debian
@for DIST in $(DEB_DIST) ; do \
(cd deb-build/$${DIST}/$(NAME)-$(VERSION)/ && $(DEBUILD) -b) ; \
done
diff --git a/packaging/debian/Dockerfile b/packaging/debian/Dockerfile
new file mode 100644
index 0000000000..6ff10f6585
--- /dev/null
+++ b/packaging/debian/Dockerfile
@@ -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"]
diff --git a/packaging/debian/README.md b/packaging/debian/README.md
index d894fd1c0c..cf2a689fc7 100644
--- a/packaging/debian/README.md
+++ b/packaging/debian/README.md
@@ -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>
+```
diff --git a/packaging/debian/rules b/packaging/debian/rules
index 3ebffe5c83..f5894b7a43 100755
--- a/packaging/debian/rules
+++ b/packaging/debian/rules
@@ -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