2013-05-14 06:28:59 -04:00
|
|
|
# Debian package Makefile
|
|
|
|
#
|
|
|
|
# Dependencies: git debhelper build-essential autotools-dev devscripts golang
|
|
|
|
# Notes:
|
|
|
|
# Use 'make debian' to create the debian package
|
|
|
|
# To create a specific version, use 'VERSION_TAG=v0.2.0 make debian'
|
|
|
|
# GPG_KEY environment variable needs to contain a GPG private key for package
|
|
|
|
# to be signed and uploaded to debian.
|
|
|
|
# If GPG_KEY is not defined, make debian will create docker package and exit
|
|
|
|
# with status code 2
|
|
|
|
|
2013-04-11 00:00:39 -04:00
|
|
|
PKG_NAME=lxc-docker
|
2013-05-14 06:28:59 -04:00
|
|
|
ROOT_PATH=$(shell git rev-parse --show-toplevel)
|
2013-04-11 00:00:39 -04:00
|
|
|
GITHUB_PATH=github.com/dotcloud/docker
|
2013-05-14 06:28:59 -04:00
|
|
|
BUILD_SRC=build_src
|
|
|
|
VERSION_TAG?=v$(shell sed -E 's/.+\((.+)-.+\).+/\1/;q' changelog)
|
|
|
|
VERSION=$(shell echo ${VERSION_TAG} | cut -c2-)
|
|
|
|
DOCKER_VERSION=${PKG_NAME}_${VERSION}
|
2013-04-11 00:00:39 -04:00
|
|
|
|
|
|
|
all:
|
2013-05-14 06:28:59 -04:00
|
|
|
# Compile docker. Used by debian dpkg-buildpackage.
|
2013-04-11 00:00:39 -04:00
|
|
|
cd src/${GITHUB_PATH}/docker; GOPATH=${CURDIR} go build
|
|
|
|
|
|
|
|
install:
|
2013-05-14 06:28:59 -04:00
|
|
|
# Used by debian dpkg-buildpackage
|
2013-04-11 00:00:39 -04:00
|
|
|
mkdir -p $(DESTDIR)/usr/bin
|
2013-05-14 06:28:59 -04:00
|
|
|
mkdir -p $(DESTDIR)/usr/share/man/man1
|
|
|
|
mkdir -p $(DESTDIR)/usr/share/doc/lxc-docker
|
|
|
|
install -m 0755 src/${GITHUB_PATH}/docker/docker $(DESTDIR)/usr/bin/lxc-docker
|
|
|
|
cp debian/lxc-docker.1 $(DESTDIR)/usr/share/man/man1
|
|
|
|
cp debian/CHANGELOG.md $(DESTDIR)/usr/share/doc/lxc-docker/changelog
|
2013-04-11 00:00:39 -04:00
|
|
|
|
|
|
|
debian:
|
2013-05-14 06:28:59 -04:00
|
|
|
# Prepare docker source from revision ${VERSION_TAG}
|
|
|
|
rm -rf ${BUILD_SRC} ${PKG_NAME}_[0-9]*
|
|
|
|
git clone file://$(ROOT_PATH) ${BUILD_SRC}/src/${GITHUB_PATH} --branch ${VERSION_TAG} --depth 1
|
|
|
|
GOPATH=${CURDIR}/${BUILD_SRC} go get -d ${GITHUB_PATH}
|
2013-04-11 00:00:39 -04:00
|
|
|
# Add debianization
|
|
|
|
mkdir ${BUILD_SRC}/debian
|
|
|
|
cp Makefile ${BUILD_SRC}
|
2013-05-14 06:28:59 -04:00
|
|
|
cp -r `ls | grep -v ${BUILD_SRC}` ${BUILD_SRC}/debian
|
|
|
|
cp ${ROOT_PATH}/README.md ${BUILD_SRC}
|
|
|
|
cp ${ROOT_PATH}/CHANGELOG.md ${BUILD_SRC}/debian
|
2013-04-11 00:00:39 -04:00
|
|
|
# Cleanup
|
2013-05-14 06:28:59 -04:00
|
|
|
rm -rf `find . -name '.git*'`
|
|
|
|
rm -f ${DOCKER_VERSION}*
|
2013-04-11 00:00:39 -04:00
|
|
|
# Create docker debian files
|
2013-05-14 06:28:59 -04:00
|
|
|
cd ${BUILD_SRC}; tar czf ../${DOCKER_VERSION}.orig.tar.gz .
|
|
|
|
cd ${BUILD_SRC}; dpkg-buildpackage -us -uc
|
2013-04-11 00:00:39 -04:00
|
|
|
rm -rf ${BUILD_SRC}
|
2013-05-14 06:28:59 -04:00
|
|
|
# Sign package and upload it to PPA if GPG_KEY environment variable
|
|
|
|
# holds a private GPG KEY
|
|
|
|
if /usr/bin/test "$${GPG_KEY}" == ""; then exit 2; fi
|
|
|
|
mkdir ${BUILD_SRC}
|
|
|
|
# Import gpg signing key
|
|
|
|
echo "$${GPG_KEY}" | gpg --allow-secret-key-import --import
|
|
|
|
# Sign the package
|
|
|
|
cd ${BUILD_SRC}; dpkg-source -x ${CURDIR}/${DOCKER_VERSION}-1.dsc
|
|
|
|
cd ${BUILD_SRC}/${PKG_NAME}-${VERSION}; debuild -S -sa
|