summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2013-10-26 13:25:24 -0700
committerAndy Grover <agrover@redhat.com>2013-10-26 13:25:24 -0700
commit0d7d8ce80710f1e4e1088c4cb6d4a858b4396c89 (patch)
tree243baf41172f2ffe2304585265e87e44fa420f26
parent0dd35213b94affd1ad16d72d3d251ebcd6954dd1 (diff)
parent0ca43d5d8c6a74f9074282639ffc08984ebf799c (diff)
downloadtargetcli-0d7d8ce80710f1e4e1088c4cb6d4a858b4396c89.tar.gz
Merge pull request #30 from JonnyJD/make_deb
update debian packaging
-rw-r--r--Makefile43
-rw-r--r--debian/control20
-rw-r--r--debian/copyright4
-rwxr-xr-xdebian/rules77
-rw-r--r--debian/target.init54
-rw-r--r--debian/targetcli-doc.docs6
-rw-r--r--debian/targetcli-fb.prerm4
-rw-r--r--debian/targetcli.dirs1
-rw-r--r--debian/targetcli.docs2
-rw-r--r--debian/targetcli.install2
-rwxr-xr-xdebian/targetcli.postinst17
-rwxr-xr-xdebian/targetcli.preinst3
-rwxr-xr-xdebian/targetcli.prerm8
-rw-r--r--source/format1
14 files changed, 118 insertions, 124 deletions
diff --git a/Makefile b/Makefile
index 7055bf1..e12f279 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
+PKGNAME = targetcli-fb
NAME = targetcli
GIT_BRANCH = $$(git branch | grep \* | tr -d \*)
-VERSION = $$(basename $$(git describe --tags | tr - .))
+VERSION = $$(basename $$(git describe --tags | tr - . | sed 's/^v//'))
all:
@echo "Usage:"
@@ -21,8 +22,8 @@ clean:
@rm -fv dpkg-buildpackage.log dpkg-buildpackage.version
@rm -frv *.rpm
@rm -fv debian/files debian/*.log debian/*.substvars
- @rm -frv debian/${NAME}-doc/ debian/python2.5-${NAME}/
- @rm -frv debian/python2.6-${NAME}/ debian/python-${NAME}/
+ @rm -frv debian/${PKGNAME}-doc/ debian/python2.5-${PKGNAME}/
+ @rm -frv debian/python2.6-${PKGNAME}/ debian/python-${PKGNAME}/
@rm -frv results
@rm -fv rpm/*.spec *.spec rpm/sed* sed*
@rm -frv ${NAME}-*
@@ -40,17 +41,17 @@ release: build/release-stamp
build/release-stamp:
@mkdir -p build
@echo "Exporting the repository files..."
- @git archive ${GIT_BRANCH} --prefix ${NAME}-${VERSION}/ \
+ @git archive ${GIT_BRANCH} --prefix ${PKGNAME}-${VERSION}/ \
| (cd build; tar xfp -)
@echo "Cleaning up the target tree..."
- @rm -f build/${NAME}-${VERSION}/Makefile
- @rm -f build/${NAME}-${VERSION}/.gitignore
- @rm -rf build/${NAME}-${VERSION}/bin
+ @rm -f build/${PKGNAME}-${VERSION}/Makefile
+ @rm -f build/${PKGNAME}-${VERSION}/.gitignore
+ @rm -rf build/${PKGNAME}-${VERSION}/bin
@echo "Fixing version string..."
@sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" \
- build/${NAME}-${VERSION}/${NAME}/__init__.py
+ build/${PKGNAME}-${VERSION}/${NAME}/__init__.py
@echo "Generating rpm specfile from template..."
- @cd build/${NAME}-${VERSION}; \
+ @cd build/${PKGNAME}-${VERSION}; \
for spectmpl in rpm/*.spec.tmpl; do \
sed -i "s/Version:\( *\).*/Version:\1${VERSION}/g" $${spectmpl}; \
mv $${spectmpl} $$(basename $${spectmpl} .tmpl); \
@@ -58,17 +59,17 @@ build/release-stamp:
rmdir rpm
@echo "Generating rpm changelog..."
@( \
- version=$$(basename $$(git describe HEAD --tags | tr - .)); \
+ version=${VERSION}; \
author=$$(git show HEAD --format="format:%an <%ae>" -s); \
date=$$(git show HEAD --format="format:%ad" -s \
| awk '{print $$1,$$2,$$3,$$5}'); \
hash=$$(git show HEAD --format="format:%H" -s); \
echo '* '"$${date} $${author} $${version}-1"; \
echo " - Generated from git commit $${hash}."; \
- ) >> $$(ls build/${NAME}-${VERSION}/*.spec)
+ ) >> $$(ls build/${PKGNAME}-${VERSION}/*.spec)
@echo "Generating debian changelog..."
@( \
- version=$$(basename $$(git describe HEAD --tags | tr - .)); \
+ 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 \
@@ -77,30 +78,30 @@ build/release-stamp:
date=$$(echo $${date} \
| awk '{print $$1, "'"$${day}"'", $$3, $$4, $$5, $$6}'); \
hash=$$(git show HEAD --format="format:%H" -s); \
- echo "${NAME} ($${version}) unstable; urgency=low"; \
+ echo "${PKGNAME} ($${version}) unstable; urgency=low"; \
echo; \
echo " * Generated from git commit $${hash}."; \
echo; \
echo " -- $${author} $${date}"; \
echo; \
- ) > build/${NAME}-${VERSION}/debian/changelog
- @find build/${NAME}-${VERSION}/ -exec \
+ ) > 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") {} \;
@mkdir -p dist
@cd build; tar -c --owner=0 --group=0 --numeric-owner \
--format=gnu -b20 --quoting-style=escape \
- -f ../dist/${NAME}-${VERSION}.tar \
- $$(find ${NAME}-${VERSION} -type f | sort)
- @gzip -6 -n dist/${NAME}-${VERSION}.tar
+ -f ../dist/${PKGNAME}-${VERSION}.tar \
+ $$(find ${PKGNAME}-${VERSION} -type f | sort)
+ @gzip -6 -n dist/${PKGNAME}-${VERSION}.tar
@echo "Generated release tarball:"
- @echo " $$(ls dist/${NAME}-${VERSION}.tar.gz)"
+ @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/${NAME}-${VERSION}; \
+ @cd build/${PKGNAME}-${VERSION}; \
dpkg-buildpackage -rfakeroot -us -uc
@mv build/*_${VERSION}_*.deb dist/
@echo "Generated debian packages:"
@@ -114,7 +115,7 @@ build/rpm-stamp:
@build=$$(pwd)/build/rpm; dist=$$(pwd)/dist/; rpmbuild \
--define "_topdir $${build}" --define "_sourcedir $${dist}" \
--define "_rpmdir $${build}" --define "_buildir $${build}" \
- --define "_srcrpmdir $${build}" -ba build/${NAME}-${VERSION}/*.spec
+ --define "_srcrpmdir $${build}" -ba build/${PKGNAME}-${VERSION}/*.spec
@mv build/rpm/*-${VERSION}*.src.rpm dist/
@mv build/rpm/*/*-${VERSION}*.rpm dist/
@echo "Generated rpm packages:"
diff --git a/debian/control b/debian/control
index af078bc..42226ae 100644
--- a/debian/control
+++ b/debian/control
@@ -1,15 +1,15 @@
-Source: targetcli
+Source: targetcli-fb
Section: python
Priority: optional
-Maintainer: Jerome Martin <jxm@risingtidesystems.com>
-Build-Depends: debhelper(>= 5.0.1), python2.6, build-essential, python-dev, python2.6-dev, python-epydoc, zlib1g-dev, python-configshell, python-rtslib
-Standards-Version: 3.8.1
+Maintainer: Andy Grover <andy@groveronline.com>
+Build-Depends: debhelper(>= 8), python3 , python3-setuptools, python3-configshell-fb, python3-rtslib-fb
+Standards-Version: 3.9.4
+X-Python3-Version: >= 3.1
-Package: targetcli
+Package: targetcli-fb
Architecture: all
-Depends: python (>= 2.6)|python2.6, python-configshell, python-rtslib, lio-utils
-Suggests: targetcli-doc
-Conflicts: targetcli-frozen
-Description: CLI shell for the RisingTide Systems target.
+Depends: python3:any (>= 3.1), ${misc:Depends}, python3-configshell-fb, python3-rtslib-fb
+Conflicts: targetcli, targetcli-frozen, lio-utils
+Description: CLI shell for the RisingTide Systems target (free branch).
.
- This package contains the targetcli CLI.
+ This package contains the targetcli CLI.
diff --git a/debian/copyright b/debian/copyright
index 253cf82..7b0b96c 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,6 +1,6 @@
This package was originally debianized by Jerome Martin <jxm@risingtidesystems.com>
-on Thu Nov 19 12:00:01 UTC 2009. It is currently maintained by Jerome Martin
-<jxm@risingtidesystems.com>.
+on Thu Nov 19 12:00:01 UTC 2009. It is currently maintained by Andy Grover
+<andy@groveronline.com>.
Upstream Author: Jerome Martin <jxm@risingtidesystems.com>
diff --git a/debian/rules b/debian/rules
index 664cd72..9347d18 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,56 +1,29 @@
#!/usr/bin/make -f
build_dir = build
-install_dir = debian/tmp
-python = $(shell \
- python=$$(which python2.6 2>/dev/null); \
- if [ -z $$python ]; then python=$$(which python 2>/dev/null); fi; \
- if [ -z $$python ]; then python="/usr/bin/python"; fi; \
- echo $$python)
-setup = $(python) ./setup.py --quiet
-
-binary: binary-indep
-
-binary-arch:
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installman
- dh_install --list-missing --sourcedir $(install_dir)
- dh_fixperms
- dh_compress -X.py
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-install: build
- dh_testdir
- dh_testroot
- dh_installdirs
-
-build: build-stamp
-build-stamp:
- dh_testdir
- # Build the source package
- $(setup) build --build-base $(build_dir) install --no-compile --install-purelib $(install_dir)/lib/targetcli --install-scripts $(install_dir)/bin
- echo "2.6" > $(install_dir)/lib/targetcli/.version
- # Cleanup
- rm -f $(install_dir)/lib/targetcli/targetcli/*.pyc
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
- $(setup) clean
- find . -name "*.pyc" | xargs rm -f
- find . -name "*.pyo" | xargs rm -f
- rm -rf $(build_dir) $(install_dir)
- dh_clean
-
-.PHONY: binary binary-indep install build clean
+install_dir = $(CURDIR)/debian/targetcli-fb
+#export DH_VERBOSE=1
+
+PYTHON3=$(shell py3versions -vr)
+
+# prevent internet access / don't use PyPi
+export http_proxy = http://127.0.0.1:9
+
+
+%:
+ dh $@ --with python3
+
+override_dh_auto_build:
+ python$(PYTHON3) setup.py build
+
+override_dh_auto_install:
+ python$(PYTHON3) setup.py install --root=$(install_dir) --install-layout=deb
+
+override_dh_installinit:
+ dh_installinit --name target
+
+override_dh_auto_clean:
+ dh_auto_clean
+ rm -rf build
+ rm -rf *.egg-info
diff --git a/debian/target.init b/debian/target.init
new file mode 100644
index 0000000..6d9fe3b
--- /dev/null
+++ b/debian/target.init
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+### BEGIN INIT INFO
+# Provides: target
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Short-Description: Start LIO targets
+# Description: Loads configfs and restores LIO config with targetcli
+### END INIT INFO
+
+
+case "$1" in
+ start)
+ if [ ! -d /sys/kernel/config ]; then
+ echo "Mounting configfs"
+ modprobe configfs
+ mount -t configfs configfs /sys/kernel/config
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+ fi
+ echo "Starting lio targets"
+ /usr/bin/targetcli restoreconfig clear_existing=true
+ if [[ $? -gt 0 ]]; then
+ exit 1
+ fi
+ ;;
+
+ stop)
+ echo "Stopping lio targets"
+ /usr/bin/targetcli clearconfig confirm=true
+ if [[ $? -gt 0 ]]; then
+ exit 1
+ fi
+ ;;
+
+ restart|force-reload)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ echo "Checking status of lio targets";
+ /usr/bin/targetcli sessions
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|force-reload|status}"
+esac
+
+exit 0
diff --git a/debian/targetcli-doc.docs b/debian/targetcli-doc.docs
deleted file mode 100644
index 7363993..0000000
--- a/debian/targetcli-doc.docs
+++ /dev/null
@@ -1,6 +0,0 @@
-doc/README.md
-doc/COPYING
-doc/targetcli_reference.html
-doc/targetcli_reference.pdf
-doc/targetcli_reference_for_print.pdf
-doc/rtslogo.png
diff --git a/debian/targetcli-fb.prerm b/debian/targetcli-fb.prerm
new file mode 100644
index 0000000..8fe902f
--- /dev/null
+++ b/debian/targetcli-fb.prerm
@@ -0,0 +1,4 @@
+# manual cleanup
+# debhelpers uses targetcli again to stop the service after cleanup
+# so we have to clean again
+rm -rf /usr/lib/python*/dist-packages/targetcli/*.pyc
diff --git a/debian/targetcli.dirs b/debian/targetcli.dirs
deleted file mode 100644
index f430183..0000000
--- a/debian/targetcli.dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/share/python-support/
diff --git a/debian/targetcli.docs b/debian/targetcli.docs
deleted file mode 100644
index 7758d58..0000000
--- a/debian/targetcli.docs
+++ /dev/null
@@ -1,2 +0,0 @@
-README.md
-COPYING
diff --git a/debian/targetcli.install b/debian/targetcli.install
deleted file mode 100644
index 5a1dd4b..0000000
--- a/debian/targetcli.install
+++ /dev/null
@@ -1,2 +0,0 @@
-lib/targetcli usr/share/python-support
-bin /usr
diff --git a/debian/targetcli.postinst b/debian/targetcli.postinst
deleted file mode 100755
index 8412fc6..0000000
--- a/debian/targetcli.postinst
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-for lib in lib lib64; do
- for python in python2.6; do
- if [ -e /usr/${lib}/${python} ]; then
- if [ ! -e /usr/${lib}/${python}/targetcli ]; then
- mkdir /usr/${lib}/${python}/targetcli
- for source in /usr/share/python-support/targetcli/targetcli/*.py; do
- ln -sf ${source} /usr/${lib}/${python}/targetcli/
- done
- python_path=$(which ${python} 2>/dev/null)
- if [ ! -z $python_path ]; then
- ${python} -c "import compileall; compileall.compile_dir('/usr/${lib}/${python}/targetcli', force=1)"
- fi
- fi
- fi
- done
-done
diff --git a/debian/targetcli.preinst b/debian/targetcli.preinst
deleted file mode 100755
index 58f5f2a..0000000
--- a/debian/targetcli.preinst
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-rm -f /usr/share/python-support/targetcli/targetcli/*.pyc
-rm -f /usr/share/python-support/targetcli/targetcli/*.pyo
diff --git a/debian/targetcli.prerm b/debian/targetcli.prerm
deleted file mode 100755
index 7603750..0000000
--- a/debian/targetcli.prerm
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-for lib in lib lib64; do
- for python in python2.6; do
- if [ -e /usr/${lib}/${python}/targetcli ]; then
- rm -rf /usr/${lib}/${python}/targetcli
- fi
- done
-done
diff --git a/source/format b/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/source/format
@@ -0,0 +1 @@
+3.0 (native)