debian: remove -dbg packages from the control file

It looks like Debian's upload automation will reject a control file
that has packages that it doesn't recognize, even if they are not
built in the default build profile.  (e.g., the expectation is that
build profiles will *disable* packages, but not *add* new binary
packages not normally built.)

So move the offending lines into debian/control.legacy-dbg which is
tacked onto the debian/control file via "./debian/rules debian-files"
and then removed via "./debian/rules mrproper".  It's a hack, but it's
only needed when building backports for Debian Jessie.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/debian/control b/debian/control
index 2a96a1f..38af67b 100644
--- a/debian/control
+++ b/debian/control
@@ -171,47 +171,3 @@
  ext2/3/4-based file systems.  It also includes the "badblocks" program,
  which can be used to scan for bad blocks on a disk or other storage device.
 
-Package: e2fsprogs-dbg
-Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
-Section: debug
-Priority: extra
-Depends: e2fsprogs (= ${binary:Version}), ${misc:Depends}
-Architecture: any
-Description: debugging information for e2fsprogs
- This package includes the debug information useful for debugging e2fsprogs
- and its libraries, contained in the e2fsprogs and e2fsck-static packages.
- The debug information is used for execution tracing and core
- dump analysis.
-
-Package: e2fslibs-dbg
-Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
-Section: debug
-Priority: extra
-Depends: e2fslibs (= ${binary:Version}), ${misc:Depends}
-Architecture: any
-Description: debugging information for e2fslibs
- This package includes the debug information useful for debugging the
- ext2fs and e2p libraries, contained in the e2fslibs package.  The debug
- information is used for execution tracing and core dump analysis.
-
-Package: libcomerr2-dbg
-Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
-Section: debug
-Priority: extra
-Depends: libcomerr2 (= ${binary:Version}), ${misc:Depends}
-Architecture: any
-Description: debugging information for libcomerr2
- This package includes the debug information useful for debugging the
- com_err library, contained in the libcomerr2 package.  The debugging
- information is used for execution tracing and core dump analysis.
-
-Package: libss2-dbg
-Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
-Section: debug
-Priority: extra
-Depends: libss2 (= ${binary:Version}), ${misc:Depends}
-Architecture: any
-Description: debugging information for libss2
- This package includes the debug information useful for debugging the
- ss library, contained in the libss2 package.  The debug information
- is used for execution tracing and core dump analysis.
diff --git a/debian/control.legacy-dbg b/debian/control.legacy-dbg
new file mode 100644
index 0000000..852fa23
--- /dev/null
+++ b/debian/control.legacy-dbg
@@ -0,0 +1,44 @@
+Package: e2fsprogs-dbg
+Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
+Section: debug
+Priority: extra
+Depends: e2fsprogs (= ${binary:Version}), ${misc:Depends}
+Architecture: any
+Description: debugging information for e2fsprogs
+ This package includes the debug information useful for debugging e2fsprogs
+ and its libraries, contained in the e2fsprogs and e2fsck-static packages.
+ The debug information is used for execution tracing and core
+ dump analysis.
+
+Package: e2fslibs-dbg
+Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
+Section: debug
+Priority: extra
+Depends: e2fslibs (= ${binary:Version}), ${misc:Depends}
+Architecture: any
+Description: debugging information for e2fslibs
+ This package includes the debug information useful for debugging the
+ ext2fs and e2p libraries, contained in the e2fslibs package.  The debug
+ information is used for execution tracing and core dump analysis.
+
+Package: libcomerr2-dbg
+Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
+Section: debug
+Priority: extra
+Depends: libcomerr2 (= ${binary:Version}), ${misc:Depends}
+Architecture: any
+Description: debugging information for libcomerr2
+ This package includes the debug information useful for debugging the
+ com_err library, contained in the libcomerr2 package.  The debugging
+ information is used for execution tracing and core dump analysis.
+
+Package: libss2-dbg
+Build-Profiles: <pkg.e2fsprogs.legacy-dbg>
+Section: debug
+Priority: extra
+Depends: libss2 (= ${binary:Version}), ${misc:Depends}
+Architecture: any
+Description: debugging information for libss2
+ This package includes the debug information useful for debugging the
+ ss library, contained in the libss2 package.  The debug information
+ is used for execution tracing and core dump analysis.
diff --git a/debian/rules b/debian/rules
index e44422c..3d95d98 100755
--- a/debian/rules
+++ b/debian/rules
@@ -182,8 +182,18 @@
 endif
 
 debian-files:
+ifneq ($(USE_DBGSYM),yes)
+	if test ! -f debian/control.save; then \
+		mv debian/control debian/control.save ; \
+		cat debian/control.save debian/control.legacy-dbg \
+			>> debian/control ; \
+	fi
+endif
 
 mrproper: clean
+	if test -f debian/control.save; then \
+		mv debian/control.save debian/control ; \
+	fi
 
 ${CFGSTDSTAMP}:
 	dh_testdir