From: Christoph Hellwig <hch@lst.de>
Date: Wed, 1 Jun 2016 17:09:38 +0000 (+0200)
Subject: add Debian packaging
X-Git-Tag: v0.2~5
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=20d6ca58dc351f9500dac9bf809d77239c95bde6;p=users%2Fhch%2Fnvmetcli.git

add Debian packaging

Signed-off-by: Christoph Hellwig <hch@lst.de>
---

diff --git a/Makefile b/Makefile
index 83d599c..e13005c 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,24 @@ build/release-stamp:
 	@echo "Fixing version string..."
 	@sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" \
 		build/${PKGNAME}-${VERSION}/${NAME}/__init__.py
+	@echo "Generating debian changelog..."
+	@( \
+		version=${VERSION}; \
+		author=$$(git show HEAD --format="format:%an <%ae>" -s); \
+		date=$$(git show HEAD --format="format:%aD" -s); \
+		day=$$(git show HEAD --format='format:%ai' -s \
+			| awk '{print $$1}' \
+			| awk -F '-' '{print $$3}' | sed 's/^0/ /g'); \
+		date=$$(echo $${date} \
+			| awk '{print $$1, "'"$${day}"'", $$3, $$4, $$5, $$6}'); \
+		hash=$$(git show HEAD --format="format:%H" -s); \
+		echo "${PKGNAME} ($${version}) unstable; urgency=low"; \
+		echo; \
+		echo "  * Generated from git commit $${hash}."; \
+		echo; \
+		echo " -- $${author}  $${date}"; \
+		echo; \
+	) > build/${PKGNAME}-${VERSION}/debian/changelog
 	@find build/${PKGNAME}-${VERSION}/ -exec \
 		touch -t $$(date -d @$$(git show -s --format="format:%at") \
 			+"%Y%m%d%H%M.%S") {} \;
@@ -50,3 +68,13 @@ build/release-stamp:
 	@echo "Generated release tarball:"
 	@echo "    $$(ls dist/${PKGNAME}-${VERSION}.tar.gz)"
 	@touch build/release-stamp
+
+deb: release build/deb-stamp
+build/deb-stamp:
+	@echo "Building debian packages..."
+	@cd build/${PKGNAME}-${VERSION}; \
+		dpkg-buildpackage -rfakeroot -us -uc
+	@mv build/*_${VERSION}_*.deb dist/
+	@echo "Generated debian packages:"
+	@for pkg in $$(ls dist/*_${VERSION}_*.deb); do echo "  $${pkg}"; done
+	@touch build/deb-stamp
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..d8eaa3b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,14 @@
+Source: nvmetcli
+Section: python
+Priority: optional
+Maintainer: Christoph Hellwig <hch@lst.de>
+Build-Depends: debhelper(>= 8), python, python-setuptools, dh-python
+Standards-Version: 3.9.4
+
+Package: nvmetcli
+Architecture: all
+Depends: ${misc:Depends}, ${python:Depends}, python-configshell-fb, python-kmodpy
+Description: Command line interface for the kernel NVMe target
+ This package contains the command line interface to the NVMe over Fabrics
+ target in the Linux kernel.  It allows configuring the target interactively
+ as well as saving / restoring the configuration to / from a json file.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..037d343
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,22 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: nvmetcli
+
+Files: *
+ Copyright (c) 2011-2013 by Datera, Inc.
+ Copyright (c) 2011-2014 by Red Hat, Inc.
+ Copyright (c) 2016 by HGST, a Western Digital Company.
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License"); you may
+ not use this file except in compliance with the License. You may obtain
+ a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ License for the specific language governing permissions and limitations
+ under the License.
+
+ The full text of the license can be found in
+ '/usr/share/common-licenses/Apache-2.0'.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..f2800fb
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+/etc/nvmet
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..e845566
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..33bc693
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+nvmetcli		/usr/sbin
diff --git a/debian/nvmetcli.examples b/debian/nvmetcli.examples
new file mode 100644
index 0000000..966124f
--- /dev/null
+++ b/debian/nvmetcli.examples
@@ -0,0 +1,2 @@
+loop.json
+rdma.json
diff --git a/debian/pyversions b/debian/pyversions
new file mode 100644
index 0000000..3ad2293
--- /dev/null
+++ b/debian/pyversions
@@ -0,0 +1 @@
+2.7-
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..c21e5a2
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,22 @@
+#!/usr/bin/make -f
+
+build_dir   = build
+install_dir = $(CURDIR)/debian/nvmetcli
+
+# prevent internet access / don't use PyPi
+export http_proxy = http://127.0.0.1:9
+
+
+%:
+	dh $@ --with python2
+
+override_dh_auto_build:
+	python setup.py build
+
+override_dh_auto_install:
+	python setup.py install --root=$(install_dir) --install-layout=deb
+
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -rf build
+	rm -rf *.egg-info