Whamcloud - gitweb
debian: create dbgsym packages if debhelper supports them
authorTheodore Ts'o <tytso@mit.edu>
Fri, 20 May 2016 17:37:58 +0000 (13:37 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 20 May 2016 19:38:31 +0000 (15:38 -0400)
Starting with Debian Stretch, we now have support for dbgsym packages
which are uploaded to a separate package archive.  Since some people
might want to try to backport e2fsprogs 1.43 for Jessie set things up
so that the package can be built on older Debiain systems (where the
legacy dbg packages will be created) as well as newer (as of this
writing, Debian Sid or Stretch).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debian/compat
debian/control.in
debian/rules

index 7f8f011..ec63514 100644 (file)
@@ -1 +1 @@
-7
+9
index a5efafd..1801fd1 100644 (file)
@@ -7,7 +7,7 @@ Source: e2fsprogs
 Section: admin
 Priority: required
 Maintainer: Theodore Y. Ts'o <tytso@mit.edu>
-Build-Depends: gettext, texinfo, pkg-config, gcc-multilib [mips mipsel], libfuse-dev, libattr1-dev, debhelper (>= 7.0), UTIL_LINUX_NG_DEFINES m4
+Build-Depends: gettext, texinfo, pkg-config, gcc-multilib [mips mipsel], libfuse-dev, libattr1-dev, debhelper (>= 9.0), UTIL_LINUX_NG_DEFINES m4
 Standards-Version: 3.9.8
 Homepage: http://e2fsprogs.sourceforge.net
 
@@ -259,7 +259,7 @@ Description: ext2/ext3/ext4 file system utilities
  This package contains programs for creating, checking, and maintaining
  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.
-
+ifdef(`USE_DBGSYM',,``
 Package: e2fsprogs-dbg
 Section: debug
 Priority: extra
@@ -269,8 +269,9 @@ 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. 
-ifdef(`UTIL_LINUX_NG',,``
+ dump analysis.
+'')
+ifdef(`USE_DBGSYM',,ifdef(`UTIL_LINUX_NG',,``
 Package: uuid-runtime-dbg
 Section: debug
 Priority: extra
@@ -281,8 +282,8 @@ Description: debugging information for uuid-runtime
  uuid runtime programs, contained in the uuid-runtime package.
  The debugging information is used for execution tracing and core
  dump analysis.
-'')dnl
-
+''))dnl
+ifdef(`USE_DBGSYM',,``
 Package: e2fslibs-dbg
 Section: debug
 Priority: extra
@@ -312,7 +313,8 @@ 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.
-ifdef(`UTIL_LINUX_NG',,``
+'')dnl
+ifdef(`USE_DBGSYM',,ifdef(`UTIL_LINUX_NG',,``
 Package: libblkid1-dbg
 Section: debug
 Priority: extra
@@ -332,4 +334,4 @@ Description: debugging information for libuuid1
  This package includes the debug information useful for debugging the
  UUID library, contained in the libuuid1 package.  The debug
  information is used for execution tracing and core dump analysis.
-'')dnl
+''))dnl
index 88f2b03..c6a3952 100755 (executable)
@@ -25,6 +25,18 @@ DEB_HOST_MULTIARCH   ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null
 DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian)
 UTIL_LINUX_NG ?= yes
 
+DH_VERSION := $(shell dpkg-query -W -f '$${Version}' debhelper)
+
+# USE_DBGSYM :=
+USE_DBGSYM ?= $(shell if dpkg --compare-versions $(DH_VERSION) ">=" 9.20160114 ; then echo yes ; fi)
+
+ifeq ($(USE_DBGSYM),yes)
+dh_strip_args = -p$(1) --dbgsym-migration='$(1)-dbg (<= 1.43-1)'
+dh_strip_args2 = -p$(1) --dbgsym-migration='$(2)-dbg (<= 1.43-1)'
+else
+dh_strip_args = -p$(1) --dbg-package=$(1)-dbg
+dh_strip_args2 = -p$(1) --dbg-package=$(2)-dbg
+endif
 # find the version for the main package, from changelog file
 MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
 # find versions for libraries going into their own packages, from their Makefile.in's,
@@ -211,9 +223,19 @@ endif
 endif
 
 M4_ARGS=
+DBG_PACKAGES=
+
+ifeq ($(USE_DBGSYM),yes)
+M4_ARGS+=-DUSE_DBGSYM
+else
+DBG_PACKAGES += -pe2fsprogs-dbg -pe2fslibs-dbg -plibcomerr2-dbg -plibss2-dbg
+M4_ARGS+=-UUSE_DBGSYM
+endif
+
 ifeq ($(UTIL_LINUX_NG),yes)
 M4_ARGS+=-DUTIL_LINUX_NG
 else
+DBG_PACKAGES += -puuid-runtime-dbg -plibuuid1-dbg -plibblkid1-dbg
 M4_ARGS+=-UUTIL_LINUX_NG
 endif
 
@@ -547,35 +569,30 @@ endif
        DH_OPTIONS= dh_installchangelogs -pe2fsprogs \
                -plibcomerr${COMERR_SOVERSION} \
                -plibss${SS_SOVERSION} \
-               -pe2fslibs \
-               -pe2fsprogs-dbg -pe2fslibs-dbg \
-               -plibcomerr2-dbg -plibss2-dbg
+               -pe2fslibs $(DBG_PACKAGES)
 ifneq ($(BUILD_E2FSCK_STATIC),no)
        DH_OPTIONS= dh_installchangelogs -pe2fsck-static
 endif
 ifneq ($(UTIL_LINUX_NG),yes)
        DH_OPTIONS= dh_installchangelogs -plibuuid${UUID_SOVERSION} \
-               -puuid-dev -puuid-runtime -puuid-runtime-dbg -plibuuid1-dbg \
-               -plibblkid${BLKID_SOVERSION} -plibblkid1-dbg
+               -puuid-dev -puuid-runtime -plibblkid${BLKID_SOVERSION}
 endif
 
        dh_fixperms
-       dh_strip -pe2fsprogs --dbg-package=e2fsprogs-dbg
+       dh_strip $(call dh_strip_args,e2fsprogs)
 ifneq ($(BUILD_E2FSCK_STATIC),no)
-       dh_strip -pe2fsck-static --dbg-package=e2fsprogs-dbg
+       dh_strip $(call dh_strip_args2,e2fsck-static,e2fsprogs)
 endif
 ifneq ($(ismips),)
-       dh_strip -pe2fslibs --dbg-package=e2fslibs-dbg -Xlib64ext2fs-nopic.a
+       dh_strip $(call dh_strip_args,e2fslibs) -Xlib64ext2fs-nopic.a
 else
-       dh_strip -pe2fslibs --dbg-package=e2fslibs-dbg
+       dh_strip $(call dh_strip_args,e2fslibs)
 endif
-       dh_strip -plibss${SS_SOVERSION} --dbg-package=libss${SS_SOVERSION}-dbg
-       dh_strip -plibcomerr${COMERR_SOVERSION} \
-               --dbg-package=libcomerr${COMERR_SOVERSION}-dbg
+       dh_strip $(call dh_strip_args,libss${SS_SOVERSION})
+       dh_strip $(call dh_strip_args,libcomerr${COMERR_SOVERSION})
 ifneq ($(UTIL_LINUX_NG),yes)
-       dh_strip -plibblkid${BLKID_SOVERSION} \
-               --dbg-package=libblkid${BLKID_SOVERSION}-dbg
-       dh_strip -plibuuid${UUID_SOVERSION} --dbg-package=libuuid${UUID_SOVERSION}-dbg
+       dh_strip $(call dh_strip_args,libblkid${BLKID_SOVERSION})
+       dh_strip $(call dh_strip_args,libuuid${UUID_SOVERSION})
 endif
        dh_strip
 
@@ -589,11 +606,14 @@ endif
                /bin/rm debian/$$i.tmp-patch; \
        done
 
-       for i in e2fsprogs e2fsprogs-dbg e2fslibs e2fslibs-dbg; do \
+       for i in e2fsprogs e2fslibs \
+           $(if $(filter $(USE_DBGSYM),yes),,e2fsprogs-dbg e2fslibs-dbg) ; \
+       do \
           $(INSTALL) -p -m 0644 debian/copyright \
                ${debdir}/$$i/usr/share/doc/$$i/copyright; \
        done
 
+ifneq ($(USE_DBGSYM),yes)
 ifneq ($(UTIL_LINUX_NG),yes)
        $(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \
                ${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright
@@ -612,7 +632,7 @@ ifneq ($(UTIL_LINUX_NG),yes)
        $(INSTALL) -p -m 0644 debian/libuuid1.copyright \
                ${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright
 endif
-
+endif
        dh_compress
 
        dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
@@ -680,3 +700,11 @@ debug_flags:
        @echo CFLAGS is $(CFLAGS)
        @echo LDFLAGS is $(LDFLAGS)
        @echo CPPFLAGS is $(CPPFLAGS)
+
+debug:
+       echo $(DH_VERSION)
+       echo $(USE_DBGSYM)
+       echo $(call dh_strip_args,e2fsprogs)
+       echo $(call dh_strip_args2,e2fsck-static,e2fsprogs)
+       echo $(DBG_PACKAGES)
+       echo $(if $(filter $(USE_DBGSYM),yes),,e2fsprogs-dbg e2fslibs-dbg)