[pve-devel] [PATCH librados2-perl] Convert to dpkg-buildpackage

René Jochum rene at jochums.at
Wed Apr 18 22:27:00 CEST 2018


Also fixes a minor spelling error in changelog.Debian and extends the
.gitignore to ignore build files.

I've made this so i get a .changes file which i need for my dput usage.
---
 .gitignore                      |  7 +++++++
 Makefile                        | 36 +++++++++++++++++++--------------
 changelog.Debian                |  2 +-
 debian/compat                   |  1 +
 control.in => debian/control.in |  8 +++++---
 debian/rules                    | 10 +++++++++
 6 files changed, 45 insertions(+), 19 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 debian/compat
 rename control.in => debian/control.in (83%)
 create mode 100755 debian/rules

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..70af628
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+RADOS.c
+RADOS.so
+build/
+
+*.buildinfo
+*.changes
+*.deb
diff --git a/Makefile b/Makefile
index 2c1451f..a99627d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,8 @@ DOCDIR=${PREFIX}/share/doc/${PACKAGE}
 MAN1DIR=${MANDIR}/man1/
 PERLDIR=${PREFIX}/share/perl5

+BUILDDIR=build
+
 PERL_ARCHLIB := `perl -MConfig -e 'print $$Config{archlib};'`
 PERL_INSTALLVENDORARCH := `perl -MConfig -e 'print $$Config{installvendorarch};'`
 PERL_APIVER := `perl -MConfig -e 'print $$Config{debian_abi}//$$Config{version};'`
@@ -26,7 +28,7 @@ CFLAGS= -shared -fPIC -O2 -Werror -Wtype-limits -Wall -Wl,-z,relro \
 PERLSODIR=$(PERL_INSTALLVENDORARCH)/auto

 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
-GITVERSION:=$(shell cat .git/refs/heads/master)
+GITVERSION:=$(shell git rev-parse HEAD)

 DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb

@@ -52,23 +54,27 @@ install: PVE/RADOS.pm RADOS.so
 .PHONY: deb ${DEB}
 deb: ${DEB}
 ${DEB}:
-	rm -rf debian
-	mkdir debian
-	make DESTDIR=${CURDIR}/debian install
-	install -d -m 0755 debian/DEBIAN
-	sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ -e "s|@PERLAPI@|perlapi-$(PERL_APIVER)|g" <control.in >debian/DEBIAN/control
-	install -D -m 0644 copyright debian/${DOCDIR}/copyright
-	install -m 0644 changelog.Debian debian/${DOCDIR}/
-	gzip -9 -n debian/${DOCDIR}/changelog.Debian
-	echo "git clone git://git.proxmox.com/git/librados2-perl.git\\ngit checkout ${GITVERSION}" > debian/${DOCDIR}/SOURCE
-	fakeroot dpkg-deb --build debian
-	mv debian.deb ${DEB}
-	rm -rf debian
+	rm -rf ${BUILDDIR}
+	rsync -a * ${BUILDDIR}
+
+	cp -fpr debian ${BUILDDIR}
+	cp changelog.Debian ${BUILDDIR}/debian/changelog
+	cp copyright ${BUILDDIR}/debian/copyright
+	sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/ -e "s|@PERLAPI@|perlapi-$(PERL_APIVER)|g" <debian/control.in >${BUILDDIR}/debian/control
+
+	make DESTDIR=${BUILDDIR} install
+	install -D -m 0644 copyright ${BUILDDIR}/${DOCDIR}/copyright
+	install -m 0644 changelog.Debian ${BUILDDIR}/${DOCDIR}/
+	gzip -9 -n ${BUILDDIR}/${DOCDIR}/changelog.Debian
+	echo "git clone git://git.proxmox.com/git/librados2-perl.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}/${DOCDIR}/SOURCE
+
+	cd ${BUILDDIR}; dpkg-buildpackage -b -uc -us
+	rm -rf build
 	lintian ${DEB}

 .PHONY: clean
-clean:
-	rm -rf debian *.deb ${PACKAGE}-*.tar.gz dist *.1.pod *.1.gz RADOS.so RADOS.c
+clean:
+	rm -rf ${BUILDDIR} *.deb ${PACKAGE}-*.tar.gz dist *.1.pod *.1.gz RADOS.so RADOS.c
 	find . -name '*~' -exec rm {} ';'

 .PHONY: distclean
diff --git a/changelog.Debian b/changelog.Debian
index 7f4b898..38084e2 100644
--- a/changelog.Debian
+++ b/changelog.Debian
@@ -1,6 +1,6 @@
 librados2-perl (1.0-5) unstable; urgency=medium

-  * allow to specify the userid with rados_create
+  * allow one to specify the userid with rados_create

   * split method pve_rados_connect

diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..9a03714
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
\ No newline at end of file
diff --git a/control.in b/debian/control.in
similarity index 83%
rename from control.in
rename to debian/control.in
index c2dc77e..cb29f38 100644
--- a/control.in
+++ b/debian/control.in
@@ -1,9 +1,11 @@
-Package: librados2-perl
-Version: @@VERSION@@-@@PKGRELEASE@@
+Source: librados2-perl
+Maintainer: Proxmox Support Team <support at proxmox.com>
 Section: perl
 Priority: optional
+Standards-Version: @@VERSION@@-@@PKGRELEASE@@
+
+Package: librados2-perl
 Architecture: @@ARCH@@
 Depends: libc6 (>= 2.2.5), perl (>= 5.20.1-5), @PERLAPI@, librados2 (>= 0.67.5), libpve-access-control
-Maintainer: Proxmox Support Team <support at proxmox.com>
 Description: Perl bindings for librados
  This package contains librados perl binding used by Proxmox VE.
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..0983a2d
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,10 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+DH_VERBOSE = 1
+
+
+%:
+	dh $@
+
+override_dh_auto_build:
\ No newline at end of file
--
2.17.0




More information about the pve-devel mailing list