Skip to content

Commit

Permalink
Build DEB package for Debian, Ubuntu, etc.
Browse files Browse the repository at this point in the history
Change-Id: Ia932c81dfae54cc5f2761660f35bdd2aebe48ffd
Reviewed-on: http://review.couchbase.org/11362
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
avsej authored and trondn committed Dec 7, 2011
1 parent 752482a commit 99a24f9
Show file tree
Hide file tree
Showing 12 changed files with 131 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -10,6 +10,7 @@
*~
.deps/
.libs/
.pc
/INSTALL
/Makefile
/Makefile.in
Expand All @@ -33,6 +34,10 @@
/configure
/docs/doxy
/libtool
/libvbucket*.changes
/libvbucket*.deb
/libvbucket*.dsc
/libvbucket*.tar.gz
/libvbucket.dll
/libvbucket.exp
/libvbucket.lib
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Expand Up @@ -126,3 +126,4 @@ vbucketkeygen_LDADD= libvbucket.la

test: check-TESTS

sinclude packaging/*/package.mk
5 changes: 5 additions & 0 deletions packaging/debian/changelog
@@ -0,0 +1,5 @@
libvbucket (1.7.2) unstable; urgency=low

* Initial release

-- Sergey Avseyev <sergey@couchbase.com> Thu, 01 Dec 2011 23:56:12 +0300
1 change: 1 addition & 0 deletions packaging/debian/compat
@@ -0,0 +1 @@
8
39 changes: 39 additions & 0 deletions packaging/debian/control
@@ -0,0 +1,39 @@
Source: libvbucket
Priority: optional
Maintainer: Couchbase SDK Team <support@couchbase.com>
Build-Depends: debhelper (>= 7.0.50~), autotools-dev
Standards-Version: 3.9.2
Section: libs
Homepage: http://www.couchbase.org
Vcs-Browser: https://github.com/membase/libvbucket
Vcs-Git: git://github.com/membase/libvbucket.git

Package: libvbucket-dev
Section: libdevel
Architecture: any
Depends: libvbucket1 (= ${binary:Version}), ${misc:Depends}
Description: vbucket library for memcached, development files
libvbucket is a library providing vbucket distribution layer for memcached
clients.
.
This package provides the files needed for development.

Package: libvbucket1-dbg
Section: debug
Architecture: any
Priority: extra
Depends: libvbucket1 (= ${binary:Version}), ${misc:Depends}
Description: vbucket library for memcached, debug symbols
libvbucket is a library providing vbucket distribution layer for memcached
clients.
.
This package provides debugging symbols.

Package: libvbucket1
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: vbucket library for memcached
libvbucket is a library providing vbucket distribution layer for memcached
clients.
.
This package provides the vbucket support for memcached.
10 changes: 10 additions & 0 deletions packaging/debian/copyright
@@ -0,0 +1,10 @@
Format-Specification: http://dep.debian.net/deps/dep5/
Name: libvbucket
Maintainer: Couchbase SDK Team <support@couchbase.com>
Source: https://github.com/couchbase/libvbucket
Debianized-Date: Fri, 02 Dec 2011 00:04:38 +0300

Files: *
Copyright: 2011, Couchbase <support@couchbase.com>
License: Apache-2.0
/usr/share/common-licenses/Apache-2.0
2 changes: 2 additions & 0 deletions packaging/debian/libvbucket-dev.docs
@@ -0,0 +1,2 @@
README.markdown
LICENSE
3 changes: 3 additions & 0 deletions packaging/debian/libvbucket-dev.install
@@ -0,0 +1,3 @@
usr/include/libvbucket/*
usr/lib/libvbucket.so
usr/lib/pkgconfig/*.pc
2 changes: 2 additions & 0 deletions packaging/debian/libvbucket1.install
@@ -0,0 +1,2 @@
usr/bin/vbucket*
usr/lib/libvbucket.so.*
55 changes: 55 additions & 0 deletions packaging/debian/package.mk
@@ -0,0 +1,55 @@
# The following code will transform VERSION variable to more debian like
# representation. Given we have two cases for versioning:
#
# 1. Current HEAD is pointing to tagged revision (let it be '1.7.2')
#
# $ git describe
# 1.7.2
#
# The perl script config/version.pl helps us to initialize VERSION
# variable to value '1.7.2'. The 'deb' task will set its variables to
# values below:
#
# DEB_VERSION="1.7.2"
# DEB_VERSION="1.7.2"
#
# It lead to package files named '{package_name}_1.7.2_{arch}.deb'
#
# 2. Current HEAD is pointing to third commit after latest tagged version
#
# $ git describe
# 1.7.2-3-ge62b67f
#
# config/version.pl yields '1.7.2_3_ge62b67f' and sed script below will
# match combination '_3_ge62b67f' and replace with '+3~ge62b67f' which
# fits .deb versioning needs. The user is able to determine what
# HEAD was used to build this package and use 'dpkg' utility to compare
# versions:
#
# $ dpkg --compare-versions 1.7.2+3~e62b67f-1 gt 1.7.2
# $ echo $?
# 0
# $ dpkg --compare-versions 1.7.2+3~e62b67f-1 gt 1.7.2+1~f84dad7-1
# $ echo $?
# 0
#
# This schema is safe because it will use plain tag if sed expression
# doesn't match.
#
.PHONY: dist-deb

DEB_WORKSPACE=$(shell pwd)/build
DEB_DIR=$(DEB_WORKSPACE)/$(PACKAGE)-$(VERSION)
DEB_VERSION=$(shell echo $(VERSION) | sed "s/_\([0-9]\+\)_g\([0-9a-z]\+\)/+\1~\2/")

dist-deb: dist
rm -rf $(DEB_WORKSPACE)
mkdir -p $(DEB_DIR)
cp -r packaging/debian $(DEB_DIR)
cp $(PACKAGE)-$(VERSION).tar.gz $(DEB_WORKSPACE)/$(PACKAGE)_$(DEB_VERSION).orig.tar.gz
(cd $(DEB_WORKSPACE); tar zxvf $(PACKAGE)_$(DEB_VERSION).orig.tar.gz)
(cd $(DEB_DIR); \
dch --no-auto-nmu --newversion "$(DEB_VERSION)-1" "Released debian package for version $(DEB_VERSION)" && \
dpkg-buildpackage -rfakeroot)
mv $(DEB_WORKSPACE)/*.{changes,deb,dsc,tar.gz} `pwd`
rm -rf $(DEB_WORKSPACE)
7 changes: 7 additions & 0 deletions packaging/debian/rules
@@ -0,0 +1,7 @@
#!/usr/bin/make -f

%:
dh $@

override_dh_strip:
dh_strip --dbg-package=libvbucket1-dbg
1 change: 1 addition & 0 deletions packaging/debian/source/format
@@ -0,0 +1 @@
3.0 (quilt)

0 comments on commit 99a24f9

Please sign in to comment.