From e8a6f56dfd56224fc183ff7ac251714237894b7c Mon Sep 17 00:00:00 2001
From: Thibault Cohen <thibault.cohen@savoirfairelinux.com>
Date: Wed, 8 Apr 2015 13:02:56 -0400
Subject: [PATCH] Add get-orig-source directive

Change-Id: Idccb105f54ad5835db645dd27375dd05f49868d4
---
 debian/rules     | 16 ++++++++++++++++
 ring-daemon.spec |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/debian/rules b/debian/rules
index cfd5752dbc..f8ebc5ce1b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,12 @@
 #!/usr/bin/make -f
 
+
+PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
+#PKG  = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source))
+PKG  = $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)
+VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
+DISTRIB_RELEASE = $(shell grep -hPo "DISTRIB_RELEASE=\K.*" /etc/*ease)
+
 # Uncomment this to turn on verbose mode.
 export DH_VERBOSE=1
 
@@ -34,3 +41,12 @@ override_dh_auto_install:
 	mv $(CURDIR)/debian/ring-daemon/usr/include/dring/* $(CURDIR)/debian/ring-daemon-dev/usr/include/dring
 	rm -rf  $(CURDIR)/debian/ring-daemon/usr/include/
 	dh_auto_install
+
+get-orig-source:
+	# Daemon
+	git fetch --all
+	git merge origin master --no-edit
+	# Packing
+	@echo "# Packing ... "
+	find . | sort \
+	| XZ_OPT="-6v" tar -caf "../$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX
diff --git a/ring-daemon.spec b/ring-daemon.spec
index c0cddde2ce..1958aa26ff 100644
--- a/ring-daemon.spec
+++ b/ring-daemon.spec
@@ -32,6 +32,8 @@ This is the daemon headers.
 
 %prep
 %setup -q
+git fetch --all
+git merge origin master --no-edit
 # Apply all patches
 for patch_file in $(cat debian/patches/series | grep -v "^#")
 do
-- 
GitLab