[sheepdog] [PATCH v3 1/6] import debian directory maintained by debian package team

MORITA Kazutaka morita.kazutaka at gmail.com
Fri Jul 19 06:07:17 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

This copies the debian patches to build a deb package from
  http://patch-tracker.debian.org/package/sheepdog

The changelog files are not imported since they are auto-generated by
the next patch, and the translation files are not imported since it's
difficult for our community to maintain them.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 debian/.gitignore               |    9 +++
 debian/compat                   |    1 +
 debian/control                  |   29 ++++++++
 debian/copyright                |   35 +++++++++
 debian/debian-sheepdog-default  |   20 ++++++
 debian/docs                     |    1 +
 debian/gbp.conf                 |    8 +++
 debian/rules                    |   63 ++++++++++++++++
 debian/sheepdog.bash-completion |    1 +
 debian/sheepdog.config          |   19 +++++
 debian/sheepdog.init            |  151 +++++++++++++++++++++++++++++++++++++++
 debian/sheepdog.install         |    1 +
 debian/sheepdog.postinst        |   28 ++++++++
 debian/sheepdog.postrm          |   11 +++
 debian/sheepdog.templates       |   32 +++++++++
 debian/source/format            |    1 +
 debian/watch                    |    2 +
 17 files changed, 412 insertions(+)
 create mode 100644 debian/.gitignore
 create mode 100644 debian/compat
 create mode 100644 debian/control
 create mode 100644 debian/copyright
 create mode 100644 debian/debian-sheepdog-default
 create mode 100644 debian/docs
 create mode 100644 debian/gbp.conf
 create mode 100755 debian/rules
 create mode 100644 debian/sheepdog.bash-completion
 create mode 100644 debian/sheepdog.config
 create mode 100644 debian/sheepdog.init
 create mode 100644 debian/sheepdog.install
 create mode 100644 debian/sheepdog.postinst
 create mode 100644 debian/sheepdog.postrm
 create mode 100644 debian/sheepdog.templates
 create mode 100644 debian/source/format
 create mode 100644 debian/watch

diff --git a/debian/.gitignore b/debian/.gitignore
new file mode 100644
index 0000000..9d54077
--- /dev/null
+++ b/debian/.gitignore
@@ -0,0 +1,9 @@
+*.substvars
+*.debhelper
+*.debhelper.log
+autoreconf.after
+autoreconf.before
+files
+sheepdog
+CHANGELOG
+changelog
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..4aedd3e
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,29 @@
+Source: sheepdog
+Section: admin
+Priority: optional
+Maintainer: PKG OpenStack <openstack-devel at lists.alioth.debian.org>
+Uploaders: YunQiang Su <wzssyqa at gmail.com>
+Build-Depends: debhelper (>= 9),
+ dh-autoreconf,
+ bash-completion,
+ pkg-config,
+ libcorosync-dev,
+ liburcu-dev,
+ libzookeeper-mt-dev [linux-any],
+ libfuse-dev,
+ po-debconf
+Standards-Version: 3.9.4
+Homepage: http://www.osrg.net/sheepdog/
+Vcs-Browser: http://git.debian.org/?p=openstack/sheepdog.git
+Vcs-Git: git://git.debian.org/openstack/sheepdog.git
+
+Package: sheepdog
+Architecture: any
+Pre-Depends: dpkg (>= 1.15.6~)
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: corosync
+Description: distributed storage system for KVM/QEMU
+ Sheepdog provides highly available block level storage volumes that can be
+ attached to KVM/QEMU virtual machines. Sheepdog scales to several hundred
+ nodes, and supports advanced volume management features such as snapshots,
+ cloning, and thin provisioning.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..a9af173
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,35 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Contact: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>, FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>, MORIAI Satoshi <moriai.satoshi at lab.ntt.co.jp>
+Upstream-Name: sheepdog
+Source: git://sheepdog.git.sf.net/gitroot/sheepdog/sheepdog
+
+Files: debian/*
+Copyright: 2010, Guido Günther <agx at sigxcpu.org>
+	2012, YunQiang Su <wzssyqa at gmail.com>
+	2012, Thomas Goirand <zigo at debian.org>
+License: GPL-2
+
+Files: *
+Copyright: 2009-2011 Nippon Telegraph and Telephone Corporation
+	With upstream authors as folow:
+	2009-2011, MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
+	2009-2011, FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
+	2009-2011, MORIAI Satoshi <moriai.satoshi at lab.ntt.co.jp>
+License: GPL-2
+
+License: GPL-2
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+ .
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+ St, Fifth Floor, Boston, MA 02110-1301 USA
+ .
+ On Debian systems, the complete text of the GNU General Public License v2
+ (GPL) can be found in /usr/share/common-licenses/GPL-2.
diff --git a/debian/debian-sheepdog-default b/debian/debian-sheepdog-default
new file mode 100644
index 0000000..f31ae1a
--- /dev/null
+++ b/debian/debian-sheepdog-default
@@ -0,0 +1,20 @@
+# start sheepdog at boot [yes|no]
+START="yes"
+
+# Arguments to run the daemon with
+# Options:
+#  -p, --port              specify the TCP port on which to listen
+#  -l, --loglevel          specify the level of logging detail
+#  -d, --debug             include debug messages in the log
+#  -D, --directio          use direct IO when accessing the object store
+#  -z, --zone              specify the zone id
+#  -c, --cluster           specify the cluster driver
+DAEMON_ARGS=""
+
+# SHEEPDOG_PATH
+#       Proper LSB systems will store sheepdog files in /var/lib/sheepdog.  The init script uses this directory by default.
+#       The directory must be on a filesystem with xattr support.  In the case of ext3, user_xattr should be added  to  the
+#       mount options.
+#
+#       mount -o remount,user_xattr /var/lib/shepdog
+SHEEPDOG_PATH="/var/lib/sheepdog"
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/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..a80d315
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,8 @@
+[DEFAULT]
+upstream-branch = master
+debian-branch = debian/unstable
+upstream-tag = v%(version)s
+compression = xz
+
+[git-buildpackage]
+export-dir = ../build-area/
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..d6731c7
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,63 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+DEBVERS         ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
+VERSION         ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//')
+DEBFLAVOR       ?= $(shell dpkg-parsechangelog | grep -E ^Distribution: | cut -d" " -f2)
+DEBPKGNAME      ?= $(shell dpkg-parsechangelog | grep -E ^Source: | cut -d" " -f2)
+UPSTREAM_GIT    ?= git://github.com/collie/sheepdog.git
+GIT_TAG         ?= $(shell echo v'$(VERSION)' | sed -e 's/~/_/')
+
+%:
+	dh $@ --with autoreconf
+
+override_dh_builddeb:
+	dh_builddeb -- -Zxz -z9
+
+UNAME := $(shell uname)
+ifeq ($(UNAME),Linux)
+	ZOOKEEPER=--enable-zookeeper
+endif
+
+override_dh_auto_configure:
+	dh_auto_configure -- ${ZOOKEEPER}
+
+override_dh_install:
+	dh_install
+	rm -rf debian/sheepdog/etc/init.d/
+	dh_bash-completion
+
+get-vcs-source:
+	git remote add upstream $(UPSTREAM_GIT) || true  
+	git fetch upstream
+	if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \
+		git archive --prefix=$(DEBPKGNAME)-$(GIT_TAG)/ $(GIT_TAG) | xz >../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ; \
+	fi
+	if [ ! -e ../build-area ] ; then mkdir ../build-area ; fi
+	if [ ! -e ../build-area ] ; then cp ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ../build-area ; fi
+	if ! git checkout master ; then \
+		echo "No upstream branch: checking out" ; \
+		git checkout -b master upstream/master ; \
+	fi
+	git checkout debian/$(DEBFLAVOR)
+
+display-po-stats:
+	cd $(CURDIR)/debian/po; for i in *.po ;do \
+		echo -n $$i": ";\
+		msgfmt -o /dev/null --statistic $$i ; \
+	done
+
+call-for-po-trans:
+	podebconf-report-po --call --withtranslators --languageteam
+
+gen-upstream-changelog:
+	git checkout master
+	git reset --hard $(GIT_TAG)
+	git log >$(CURDIR)/../CHANGELOG 
+	git checkout debian/$(DEBFLAVOR)
+	mv $(CURDIR)/../CHANGELOG $(CURDIR)/debian/CHANGELOG
+	git add $(CURDIR)/debian/CHANGELOG
+	git commit -a -m "Updated upstream changelog"
+
+override_dh_installchangelogs:
+	dh_installchangelogs $(CURDIR)/debian/CHANGELOG
diff --git a/debian/sheepdog.bash-completion b/debian/sheepdog.bash-completion
new file mode 100644
index 0000000..3406bc5
--- /dev/null
+++ b/debian/sheepdog.bash-completion
@@ -0,0 +1 @@
+script/bash_completion_collie collie
diff --git a/debian/sheepdog.config b/debian/sheepdog.config
new file mode 100644
index 0000000..18e79a1
--- /dev/null
+++ b/debian/sheepdog.config
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+if [ -r /etc/default/sheepdog ] ; then
+	. /etc/default/sheepdog
+	if [ x"yes" = x"$START" ] ; then
+		db_set sheepdog/start true
+	else
+		db_set sheepdog/start false
+	fi
+	db_set sheepdog/daemon_args "$DAEMON_ARGS"
+fi
+db_input low sheepdog/start || true
+db_input medium sheepdog/daemon_args || true
+db_go || true
+
+exit 0
diff --git a/debian/sheepdog.init b/debian/sheepdog.init
new file mode 100644
index 0000000..72ac8e2
--- /dev/null
+++ b/debian/sheepdog.init
@@ -0,0 +1,151 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          sheepdog
+# Required-Start:    hostname $network $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Sheepdog is a distributed storage system for KVM/QEMU.
+# Description:       Sheepdog is a distributed storage system for KVM/QEMU. It provides
+#                    highly available block level storage volumes to virtual machines.
+#                    Sheepdog supports advanced volume management features such  as  snapshot,
+#                    cloning, and thin provisioning. The architecture of Sheepdog is fully
+#                    symmetric; there is no central node such as a meta-data server.
+### END INIT INFO
+
+# Author: YunQiang Su <wzssyqa at gmail.com>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC=sheepdog             # Introduce a short description here
+NAME=sheepdog             # Introduce the short server's name here
+DAEMON=/usr/sbin/sheep    # Introduce the server's location here
+DAEMON_ARGS=""            # Arguments to run the daemon with
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x $DAEMON ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+#FIXME: user cannot give pidfile in /etc/default/sheepdog
+DAEMON_ARGS="$DAEMON_ARGS --pidfile $PIDFILE"
+
+if [ "$START" != "yes" ]; then
+	exit 0
+fi
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+	# Return
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+		$DAEMON_ARGS $SHEEPDOG_PATH \
+		|| return 2
+	# Add code here, if necessary, that waits for the process to be ready
+	# to handle requests from services started subsequently which depend
+	# on this one.  As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+	# Return
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+	#   other if a failure occurred
+	start-stop-daemon --stop --quiet --pidfile $PIDFILE
+	RETVAL="$?"
+	return "$RETVAL"
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service
+#
+do_reload() {
+	#
+	# If the daemon can reload its configuration without
+	# restarting (for example, when it is sent a SIGHUP),
+	# then implement that here.
+	#
+	start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+	return 0
+}
+
+case "$1" in
+  start)
+    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
+    do_start
+    case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+  ;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  #reload|force-reload)
+	#
+	# If do_reload() is not implemented then leave this commented out
+	# and leave 'force-reload' as an alias for 'restart'.
+	#
+	#log_daemon_msg "Reloading $DESC" "$NAME"
+	#do_reload
+	#log_end_msg $?
+	#;;
+  restart|force-reload)
+	#
+	# If the "reload" option is implemented then remove the
+	# 'force-reload' alias
+	#
+	log_daemon_msg "Restarting $DESC" "$NAME"
+	do_stop
+	case "$?" in
+	  0|1)
+		do_start
+		case "$?" in
+			0) log_end_msg 0 ;;
+			1) log_end_msg 1 ;; # Old process is still running
+			*) log_end_msg 1 ;; # Failed to start
+		esac
+		;;
+	  *)
+	  	# Failed to stop
+		log_end_msg 1
+		;;
+	esac
+	;;
+  *)
+	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+exit 0
diff --git a/debian/sheepdog.install b/debian/sheepdog.install
new file mode 100644
index 0000000..4a4697b
--- /dev/null
+++ b/debian/sheepdog.install
@@ -0,0 +1 @@
+debian/debian-sheepdog-default	/usr/share/sheepdog
diff --git a/debian/sheepdog.postinst b/debian/sheepdog.postinst
new file mode 100644
index 0000000..f4c48a1
--- /dev/null
+++ b/debian/sheepdog.postinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+	. /usr/share/debconf/confmodule
+	mkdir -p /var/lib/sheepdog/
+	mkdir -p /etc/default
+	if [ ! -e /etc/default/sheepdog ] ; then
+		cp /usr/share/sheepdog/debian-sheepdog-default /etc/default/sheepdog
+	fi
+	if [ -r /etc/default/sheepdog ] ; then
+		db_get sheepdog/start
+		if [ "${RET}" = "true" ] ; then
+			SERVICE_START="yes"
+		else
+			SERVICE_START="no"
+		fi
+		sed -i -e "s/^[ \t]*START=.*/START=\"$SERVICE_START\"/g" /etc/default/sheepdog
+
+		db_get sheepdog/daemon_args
+		sed -i -e "s/^[ \t]*DAEMON_ARGS=.*/DAEMON_ARGS=\"$RET\"/g" /etc/default/sheepdog
+	fi
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/sheepdog.postrm b/debian/sheepdog.postrm
new file mode 100644
index 0000000..1611169
--- /dev/null
+++ b/debian/sheepdog.postrm
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "${1}" = "purge" ] ; then
+	rm -f /etc/default/sheepdog
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/sheepdog.templates b/debian/sheepdog.templates
new file mode 100644
index 0000000..ae62db5
--- /dev/null
+++ b/debian/sheepdog.templates
@@ -0,0 +1,32 @@
+# These templates have been reviewed by the debian-l10n-english
+# team
+#
+# If modifications/additions/rewording are needed, please ask
+# debian-l10n-english at lists.debian.org for advice.
+#
+# Even minor modifications require translation updates and such
+# changes should be coordinated with translators and reviewers.
+
+Template: sheepdog/start
+Type: boolean
+Default: true
+_Description: Automatically start the sheepdog service?
+ Please choose whether the sheepdog service should start automatically
+ when the system is booted.
+
+Template: sheepdog/daemon_args
+Type: string
+Default: 
+_Description: Arguments for the sheepdog daemon:
+ Please choose the command line arguments that should be passed to the
+ sheepdog daemon. If no argument is given, the default behavior is to
+ start on port 7000, using the corosync driver.
+ .
+ Available options include:
+   -p, --port              specify the TCP port to listen to
+   -l, --loglevel          specify the level of logging detail
+   -d, --debug             include debug messages in the log
+   -D, --directio          use direct I/O when accessing the object store
+   -z, --zone              specify the zone ID
+   -c, --cluster           specify the cluster driver
+ More information can be found in the sheep(8) manual page.
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..16e52f0
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,2 @@
+version=3
+https://github.com/collie/sheepdog/tags .*/v(.*).tar.gz
-- 
1.7.9.5




More information about the sheepdog mailing list