From accc9fc76a87e5176c90d98e05c97a911b4c9755 Mon Sep 17 00:00:00 2001
From: Jan-Pascal van Best <janpascal@vanbest.org>
Date: Fri, 25 Jan 2013 14:48:03 +0100
Subject: [PATCH] Cleaning up

---
 .gitignore                                    |   3 +
 debian/changelog                              |   2 +-
 debian/control                                |  46 -----
 debian/control.backup                         |  31 ----
 debian/control.md5sum                         |   6 -
 debian/gbp.conf                               |   2 +
 debian/includes/3.2.0-4-amd64/dvbdev.h        | 172 ------------------
 debian/rules                                  |  42 +----
 debian/rules.defs                             |  13 +-
 debian/sasc-ng-3.2.0-4-amd64-sse2.install     |   3 -
 debian/sasc-ng-3.7-trunk-amd64-sse2.install   |   3 -
 ...asc-ng-3.7-trunk-amd64-sse2.install.backup |   3 -
 12 files changed, 18 insertions(+), 308 deletions(-)
 delete mode 100644 debian/control
 delete mode 100644 debian/control.backup
 delete mode 100644 debian/control.md5sum
 create mode 100644 debian/gbp.conf
 delete mode 100644 debian/includes/3.2.0-4-amd64/dvbdev.h
 delete mode 100644 debian/sasc-ng-3.2.0-4-amd64-sse2.install
 delete mode 100644 debian/sasc-ng-3.7-trunk-amd64-sse2.install
 delete mode 100644 debian/sasc-ng-3.7-trunk-amd64-sse2.install.backup

diff --git a/.gitignore b/.gitignore
index a01ee28..7121580 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 .*.swp
+debian/control
+debian/control.md5sum
+debian/sasc-ng-*.install
diff --git a/debian/changelog b/debian/changelog
index e872930..c87bdf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-sasc-ng (620-3.7.1+1~experimental.sasc1) experimental; urgency=low
+sasc-ng (620-1) experimental; urgency=low
 
   * Initial release. (Closes: #XXXXXX)
 
diff --git a/debian/control b/debian/control
deleted file mode 100644
index 8c281f5..0000000
--- a/debian/control
+++ /dev/null
@@ -1,46 +0,0 @@
-Source: sasc-ng
-Section: devel
-Priority: extra
-Maintainer: Jan-Pascal van Best <janpascal@vanbest.org>
-Standards-Version: 3.9.4
-Build-Depends: debhelper (>= 8), linux-headers-3.7-trunk-amd64 (=3.7.1-1~experimental.2.sasc1), linux-headers-3.2.0-4-amd64 (=3.2.35-2),
-
-Package: sasc-ng-common
-Architecture: all
-Depends: ${misc:Depends}, sasc-ng-daemon
-Description: softcam to help decode DVB streams
- sasc-ng is a versatile SoftCAM which creates virtual DVB devices 
- and outputs through them.
- . 
- This package contains common files for the sasc-ng daemon
-
-Package: sasc-ng-3.7-trunk-amd64-sse2
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends},
- sasc-ng-common (=${binary:Version}),
- linux-image-3.7-trunk-amd64 (=3.7.1-1~experimental.2.sasc1)
-Conflicts: sasc-ng-daemon
-Replaces: sasc-ng-daemon
-Provides: sasc-ng-daemon
-Description: softcam to help decode DVB streams
- sasc-ng is a versatile SoftCAM which creates virtual DVB devices 
- and outputs through them.
- .
- This package contains the sasc-ng daemon and the dvbloopback
- kernel module for kernel 3.7-trunk-amd64.
-
-Package: sasc-ng-3.2.0-4-amd64-sse2
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends},
- sasc-ng-common (=${binary:Version}),
- linux-image-3.2.0-4-amd64 (=3.2.35-2)
-Conflicts: sasc-ng-daemon
-Replaces: sasc-ng-daemon
-Provides: sasc-ng-daemon
-Description: softcam to help decode DVB streams
- sasc-ng is a versatile SoftCAM which creates virtual DVB devices 
- and outputs through them.
- .
- This package contains the sasc-ng daemon and the dvbloopback
- kernel module for kernel 3.2.0-4-amd64.
-
diff --git a/debian/control.backup b/debian/control.backup
deleted file mode 100644
index fb48e71..0000000
--- a/debian/control.backup
+++ /dev/null
@@ -1,31 +0,0 @@
-Source: sasc-ng
-Section: devel
-Priority: extra
-Maintainer: Jan-Pascal van Best <janpascal@vanbest.org>
-Standards-Version: 3.9.4
-#Build-Depends: debhelper (>= 5), ${kver:BuildDepends}
-Build-Depends: debhelper (>= 8)
-
-Package: sasc-ng-common
-Architecture: all
-Depends: ${misc:Depends}, sasc-ng-daemon
-Description: softcam to help decode DVB streams
- sasc-ng is a versatile SoftCAM which creates virtual DVB devices 
- and outputs through them.
- . 
- This package contains common files for the sasc-ng daemon
-
-Package: sasc-ng-3.7-trunk-amd64-sse2
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${kver:Depends},
- sasc-ng-common (=${binary:Version})
-Conflicts: sasc-ng-daemon
-Replaces: sasc-ng-daemon
-Provides: sasc-ng-daemon
-Description: softcam to help decode DVB streams
- sasc-ng is a versatile SoftCAM which creates virtual DVB devices 
- and outputs through them.
- .
- This package contains the sasc-ng daemon and the dvbloopback
- kernel module
-
diff --git a/debian/control.md5sum b/debian/control.md5sum
deleted file mode 100644
index 480d99e..0000000
--- a/debian/control.md5sum
+++ /dev/null
@@ -1,6 +0,0 @@
-98e40a12c40e8d3088ca0f4457b4a198  debian/control
-4004570ed61be152549b6ddc265948aa  debian/control.source
-ef99cebba74aa8d065cd6af017ddb205  debian/control.flavor
-2caf747fbe7d4c0c4fae1b80213bddd9  debian/rules
-4e1c124c6a321523be4eadb07c358f4a  debian/rules.defs
-086aaa0862d6ebe62bd0b5547c8810af  debian/sasc-ng.install.in
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..680bb40
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,2 @@
+[git-buildpackage]
+prebuild=make -f debian/rules debian/control || true
diff --git a/debian/includes/3.2.0-4-amd64/dvbdev.h b/debian/includes/3.2.0-4-amd64/dvbdev.h
deleted file mode 100644
index fcc6ae9..0000000
--- a/debian/includes/3.2.0-4-amd64/dvbdev.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * dvbdev.h
- *
- * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
- *                    for convergence integrated media GmbH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Lesser Public License
- * as published by the Free Software Foundation; either version 2.1
- * 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 Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- */
-
-#ifndef _DVBDEV_H_
-#define _DVBDEV_H_
-
-#include <linux/types.h>
-#include <linux/poll.h>
-#include <linux/fs.h>
-#include <linux/list.h>
-
-#define DVB_MAJOR 212
-
-#if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
-  #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS
-#else
-  #define DVB_MAX_ADAPTERS 8
-#endif
-
-#define DVB_UNSET (-1)
-
-#define DVB_DEVICE_VIDEO      0
-#define DVB_DEVICE_AUDIO      1
-#define DVB_DEVICE_SEC        2
-#define DVB_DEVICE_FRONTEND   3
-#define DVB_DEVICE_DEMUX      4
-#define DVB_DEVICE_DVR        5
-#define DVB_DEVICE_CA         6
-#define DVB_DEVICE_NET        7
-#define DVB_DEVICE_OSD        8
-
-#define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
-	static short adapter_nr[] = \
-		{[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
-	module_param_array(adapter_nr, short, NULL, 0444); \
-	MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
-
-struct dvb_frontend;
-
-struct dvb_adapter {
-	int num;
-	struct list_head list_head;
-	struct list_head device_list;
-	const char *name;
-	u8 proposed_mac [6];
-	void* priv;
-
-	struct device *device;
-
-	struct module *module;
-
-	int mfe_shared;			/* indicates mutually exclusive frontends */
-	struct dvb_device *mfe_dvbdev;	/* frontend device in use */
-	struct mutex mfe_lock;		/* access lock for thread creation */
-
-	/* Allow the adapter/bridge driver to perform an action before and/or
-	 * after the core handles an ioctl:
-	 *
-	 * DVB_FE_IOCTL_PRE indicates that the ioctl has not yet been handled.
-	 * DVB_FE_IOCTL_POST indicates that the ioctl has been handled.
-	 *
-	 * When DVB_FE_IOCTL_PRE is passed to the callback as the stage arg:
-	 *
-	 * return 0 to allow dvb-core to handle the ioctl.
-	 * return a positive int to prevent dvb-core from handling the ioctl,
-	 * 	and exit without error.
-	 * return a negative int to prevent dvb-core from handling the ioctl,
-	 * 	and return that value as an error.
-	 *
-	 * When DVB_FE_IOCTL_POST is passed to the callback as the stage arg:
-	 *
-	 * return 0 to allow the dvb_frontend ioctl handler to exit normally.
-	 * return a negative int to cause the dvb_frontend ioctl handler to
-	 * 	return that value as an error.
-	 */
-#define DVB_FE_IOCTL_PRE 0
-#define DVB_FE_IOCTL_POST 1
-	int (*fe_ioctl_override)(struct dvb_frontend *fe,
-				 unsigned int cmd, void *parg,
-				 unsigned int stage);
-};
-
-
-struct dvb_device {
-	struct list_head list_head;
-	const struct file_operations *fops;
-	struct dvb_adapter *adapter;
-	int type;
-	int minor;
-	u32 id;
-
-	/* in theory, 'users' can vanish now,
-	   but I don't want to change too much now... */
-	int readers;
-	int writers;
-	int users;
-
-	wait_queue_head_t	  wait_queue;
-	/* don't really need those !? -- FIXME: use video_usercopy  */
-	int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
-
-	void *priv;
-};
-
-
-extern int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
-				struct module *module, struct device *device,
-				short *adapter_nums);
-extern int dvb_unregister_adapter (struct dvb_adapter *adap);
-
-extern int dvb_register_device (struct dvb_adapter *adap,
-				struct dvb_device **pdvbdev,
-				const struct dvb_device *template,
-				void *priv,
-				int type);
-
-extern void dvb_unregister_device (struct dvb_device *dvbdev);
-
-extern int dvb_generic_open (struct inode *inode, struct file *file);
-extern int dvb_generic_release (struct inode *inode, struct file *file);
-extern long dvb_generic_ioctl (struct file *file,
-			      unsigned int cmd, unsigned long arg);
-
-/* we don't mess with video_usercopy() any more,
-we simply define out own dvb_usercopy(), which will hopefully become
-generic_usercopy()  someday... */
-
-extern int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
-			    int (*func)(struct file *file, unsigned int cmd, void *arg));
-
-/** generic DVB attach function. */
-#ifdef CONFIG_MEDIA_ATTACH
-#define dvb_attach(FUNCTION, ARGS...) ({ \
-	void *__r = NULL; \
-	typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
-	if (__a) { \
-		__r = (void *) __a(ARGS); \
-		if (__r == NULL) \
-			symbol_put(FUNCTION); \
-	} else { \
-		printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
-	} \
-	__r; \
-})
-
-#else
-#define dvb_attach(FUNCTION, ARGS...) ({ \
-	FUNCTION(ARGS); \
-})
-
-#endif
-
-#endif /* #ifndef _DVBDEV_H_ */
diff --git a/debian/rules b/debian/rules
index b72e4d1..184d897 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,34 +4,18 @@ include debian/rules.defs
 
 SHELL := /bin/bash
 
-#kernel_name = "3.7-trunk-amd64"
-#kernel_version = "3.7.1-1~experimental.2.sasc1"
-
-#DVB_DIR=/home/janpascal/src/tmp/linux/linux-3.7.1
-
-PACKAGE = $(firstword $(shell dh_listpackages))
-TMP     = $(CURDIR)/debian/$(PACKAGE)
-
-#SUBSTVARS = \
-# -Vkver:Depends="linux-image-$(kernel_name) (=$(kernel_version))" \
-# -Vkver:BuildDepends="linux-headers-$(kernel_name) (=$(kernel_version))"
-
-#SUBSTVARS = -Vkver:BuildDepends="foo (>= 2)"
-
 %:
-	dh $@
-
-#override_dh_gencontrol:
-#	dh_gencontrol -- $(SUBSTVARS)
+	if [ -e debian/control ]; then \
+		dh $@; \
+	else \
+		$(MAKE) -f debian/rules debian/control; \
+	fi
 
 override_dh_auto_configure:
-	#cd contrib/sasc-ng; ./configure --dvb-dir=$(DVB_DIR)
-	#cp debian/config.mak-sse2 contrib/sasc-ng/config.mak
-	#sed -e "s|#DVB_DIR#|$(CURDIR)/debian/includes/3.7.1/|" < debian/config.mak-sse2 > contrib/sasc-ng/config.mak
+	# done per binary package in build-% rule
 	
 override_dh_auto_clean:
 	cd contrib/sasc-ng; if [ -r config.mak ]; then make clean module_clean; fi
-	#rm -rf debian/tmp
 	
 override_dh_auto_build:
 	#cd contrib/sasc-ng; make module; make
@@ -51,16 +35,12 @@ build_%:
 	mkdir -p $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/lib; \
 	install -m0755 sasc-ng $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/bin/; \
 	install -m0644 dvbloopback.ko $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/modules; \
-	install -m0644 sc/PLUGINS/lib/* $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/lib/
+	install -m0644 sc/PLUGINS/lib/* $(CURDIR)/debian/tmp/$$KERNEL-$$FLAVOR/lib/; \
+	make module_clean; \
+	make clean
 
 override_dh_auto_install: $(foreach kernel,$(KERNELS),$(foreach flav,$(FFDECSA_FLAVORS),build_$(kernel)_$(flav)))
-	# use package.install instead
-	#mkdir -p $(TMP)/usr/bin
-	#mkdir -p $(TMP)/lib/modules/$(kernel_name)/misc
-	#mkdir -p $(TMP)/usr/lib/
-	#install -m0755 contrib/sasc-ng/sasc-ng $(TMP)/usr/bin/
-	#install -m0644 contrib/sasc-ng/dvbloopback.ko $(TMP)/lib/modules/$(kernel_name)/misc
-	#install -m0644 contrib/sasc-ng/sc/PLUGINS/lib/* $(TMP)/usr/lib/
+	# use (package).install instead
 
 CONTROL_FILES    = debian/control.source debian/control.flavor debian/rules debian/rules.defs debian/sasc-ng.install.in
 comma            = ,
@@ -98,8 +78,6 @@ debian/control-real: $(CONTROL_FILES)
 		-e 's/#LINUX_HEADERS#/$(LINUX_HEADERS)/g' \
 		debian/control.source > debian/control.tmp
 	$(foreach f,$(KERNELS),$(call append-flavor-entries,$(f),$(KERNEL_VERSION_$(f)),sse2))
-	#$(foreach f,$(KERNEL_FLAVORS_only_i386),$(call append-flavor-entries,$(KERNEL_VERSION),$(f),i386))
-	#$(foreach f,$(KERNEL_FLAVORS_only_amd64),$(call append-flavor-entries,$(KERNEL_VERSION),$(f),amd64))
 	mv debian/control.tmp debian/control
 	$(foreach kernel,$(KERNELS),$(foreach flav,$(FFDECSA_FLAVORS),$(call create-flavor-install,$(kernel),$(flav))))
 	md5sum debian/control $^ > debian/control.md5sum
diff --git a/debian/rules.defs b/debian/rules.defs
index 5dbe76f..5557168 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -1,16 +1,7 @@
-KERNELS = 3.7-trunk-amd64 3.2.0-4-amd64
+KERNELS = 3.7-trunk-amd64
 KERNEL_VERSION_3.7-trunk-amd64 = 3.7.1-1~experimental.2.sasc1
-KERNEL_VERSION_3.2.0-4-amd64 = 3.2.35-2
 
+# Even Atoms do sse2
 FFDECSA_FLAVORS = sse2 #sse 
 
 # For the moment we just support amd64
-#KERNEL_FLAVORS_i386_$(DEFAULT)	+= 486
-#KERNEL_FLAVORS_i386_$(DEFAULT)	+= 686 686-bigmem amd64
-#KERNEL_FLAVORS_i386_$(OPENVZ)	+= openvz-686
-#KERNEL_FLAVORS_i386_$(VSERVER)	+= vserver-686 vserver-686-bigmem
-#KERNEL_FLAVORS_i386_$(XEN)	+= xen-686
-#KERNEL_FLAVORS_amd64_$(DEFAULT)	+= amd64
-#KERNEL_FLAVORS_amd64_$(OPENVZ)	+= openvz-amd64
-#KERNEL_FLAVORS_amd64_$(VSERVER)	+= vserver-amd64
-#KERNEL_FLAVORS_amd64_$(XEN)	+= xen-amd64
diff --git a/debian/sasc-ng-3.2.0-4-amd64-sse2.install b/debian/sasc-ng-3.2.0-4-amd64-sse2.install
deleted file mode 100644
index 59bb3d2..0000000
--- a/debian/sasc-ng-3.2.0-4-amd64-sse2.install
+++ /dev/null
@@ -1,3 +0,0 @@
-debian/tmp/3.2.0-4-amd64-sse2/bin/* /usr/bin/
-debian/tmp/3.2.0-4-amd64-sse2/modules/* /lib/modules/3.2.0-4-amd64/misc
-debian/tmp/3.2.0-4-amd64-sse2/lib/* /usr/lib/
diff --git a/debian/sasc-ng-3.7-trunk-amd64-sse2.install b/debian/sasc-ng-3.7-trunk-amd64-sse2.install
deleted file mode 100644
index c7fc012..0000000
--- a/debian/sasc-ng-3.7-trunk-amd64-sse2.install
+++ /dev/null
@@ -1,3 +0,0 @@
-debian/tmp/3.7-trunk-amd64-sse2/bin/* /usr/bin/
-debian/tmp/3.7-trunk-amd64-sse2/modules/* /lib/modules/3.7-trunk-amd64/misc
-debian/tmp/3.7-trunk-amd64-sse2/lib/* /usr/lib/
diff --git a/debian/sasc-ng-3.7-trunk-amd64-sse2.install.backup b/debian/sasc-ng-3.7-trunk-amd64-sse2.install.backup
deleted file mode 100644
index b2a3a61..0000000
--- a/debian/sasc-ng-3.7-trunk-amd64-sse2.install.backup
+++ /dev/null
@@ -1,3 +0,0 @@
-contrib/sasc-ng/sasc-ng /usr/bin/
-contrib/sasc-ng/dvbloopback.ko /lib/modules/3.7-trunk-amd64/misc
-contrib/sasc-ng/sc/PLUGINS/lib/* /usr/lib/
-- 
2.39.5