Package: dh-make
Version: 0.61
Severity: wishlist
Tags: patch

Hi,

 In my experience, emacs related files are not necessary (it's rare) and
 I should remove those files each time. So, I request you to not install
 those files by default.

 Please check attached patch and apply it.

 summary)
  - move emacs files from lib/debian to lib/emacs
  - add "--with-emacs" option. If users would specify this, then install
    emacs files.
  - Also install emacs files automatically if there's any *.el file.


-- 
Regards,

 Hideki Yamane     henrich @ debian.or.jp/org
 http://wiki.debian.org/HidekiYamane
diff -Nru dh-make-0.61/debian/changelog dh-make-0.61+nmu1/debian/changelog
--- dh-make-0.61/debian/changelog	2012-07-13 20:27:59.000000000 +0900
+++ dh-make-0.61+nmu1/debian/changelog	2012-12-27 16:43:43.000000000 +0900
@@ -1,3 +1,10 @@
+dh-make (0.61+nmu1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Don't install emacsen files by defalult. Add --with-emacs file for it.
+
+ -- Hideki Yamane <henr...@debian.org>  Thu, 27 Dec 2012 16:42:36 +0900
+
 dh-make (0.61) unstable; urgency=low
 
   * Update to standards version 3.9.3
diff -Nru dh-make-0.61/dh_make dh-make-0.61+nmu1/dh_make
--- dh-make-0.61/dh_make	2012-06-25 20:43:31.000000000 +0900
+++ dh-make-0.61+nmu1/dh_make	2012-12-27 16:45:41.000000000 +0900
@@ -48,6 +48,7 @@
 our $filename;
 our $SOURCE_EXTRADOCS="";
 our ($email, $date);
+our $with_emacs = 0;
 
 sub process_file(@)
 {
@@ -159,6 +160,7 @@
   -l, --library             set package class to library
   -k, --kmod                set package class to kernel module
       --kpatch              set package class to kernel patch
+      --with-emacs          add files for emacsen
   -a, --addmissing          reprocess package and add missing files
   -t, --templates <dir>     apply customizing templates in <dir>
   -d  --defaultless         skip the default debian and package class templates
@@ -194,6 +196,7 @@
 			'library|l' => \$library,
 			'kmod|k' => \$kmod,
 			'kpatch' => \$kpatch,
+			'with-emacs' => \$main::with_emacs,
 			'addmissing|a' => \$main::add_missing,
 			'rulesformat|r=s' => \$main::rules_format,
 			'templates|t=s' => \$main::custom,
@@ -562,6 +565,12 @@
 $CHANGELOG = $changelogs[0] if ($#changelogs != -1);
 shift @changelogs;
 @DOCS = (@DOCS,@changelogs);
+# check whether emacs files exist or not
+our @EMACS= split / |\n/, qx(find . -regex '.*\\.el');
+if (! @EMACS eq '')
+{
+	$with_emacs = 1;
+}
 # Are there any .orig files in the upstream sources
 my @ORIG= split /[ \n]/, qx(find . -name '\*.orig');
 
@@ -749,6 +758,16 @@
 		}
 		process_file("$DHLIB/debian$package_class/$filename", $filename);
 	}
+
+	# emacs files
+	if ($with_emacs) 
+	{
+		@filenames= split / |\n/, qx{(cd $DHLIB/emacs && ls)};
+		foreach $filename (@filenames)
+		{
+			process_file("$DHLIB/emacs/$filename", $filename);
+		}
+	}
 }
 
 # Custom template
diff -Nru dh-make-0.61/lib/debian/emacsen-install.ex dh-make-0.61+nmu1/lib/debian/emacsen-install.ex
--- dh-make-0.61/lib/debian/emacsen-install.ex	2012-06-24 09:46:59.000000000 +0900
+++ dh-make-0.61+nmu1/lib/debian/emacsen-install.ex	1970-01-01 09:00:00.000000000 +0900
@@ -1,47 +0,0 @@
-#! /bin/sh -e
-# /usr/lib/emacsen-common/packages/install/#PACKAGE#
-
-# Written by Jim Van Zandt <j...@debian.org>, borrowing heavily
-# from the install scripts for gettext by Santiago Vila
-# <sanv...@ctv.es> and octave by Dirk Eddelbuettel <e...@debian.org>.
-
-FLAVOR=$1
-PACKAGE=#PACKAGE#
-
-if [ ${FLAVOR} = emacs ]; then exit 0; fi
-
-echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
-
-#FLAVORTEST=`echo $FLAVOR | cut -c-6`
-#if [ ${FLAVORTEST} = xemacs ] ; then
-#    SITEFLAG="-no-site-file"
-#else
-#    SITEFLAG="--no-site-file"
-#fi
-FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
-
-ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
-ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
-ELRELDIR=../../../emacs/site-lisp/${PACKAGE}
-
-# Install-info-altdir does not actually exist.
-# Maybe somebody will write it.
-if test -x /usr/sbin/install-info-altdir; then
-    echo install/${PACKAGE}: install Info links for ${FLAVOR}
-    install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz
-fi
-
-install -m 755 -d ${ELCDIR}
-cd ${ELDIR}
-FILES=`echo *.el`
-cd ${ELCDIR}
-ln -sf ${ELRELDIR}/*.el .
-
-cat << EOF > path.el
-(debian-pkg-add-load-path-item ".")
-(setq byte-compile-warnings nil)
-EOF
-${FLAVOR} ${FLAGS} ${FILES}
-rm -f path.el
-
-exit 0
diff -Nru dh-make-0.61/lib/debian/emacsen-remove.ex dh-make-0.61+nmu1/lib/debian/emacsen-remove.ex
--- dh-make-0.61/lib/debian/emacsen-remove.ex	2011-01-04 20:19:11.000000000 +0900
+++ dh-make-0.61+nmu1/lib/debian/emacsen-remove.ex	1970-01-01 09:00:00.000000000 +0900
@@ -1,15 +0,0 @@
-#!/bin/sh -e
-# /usr/lib/emacsen-common/packages/remove/#PACKAGE#
-
-FLAVOR=$1
-PACKAGE=#PACKAGE#
-
-if [ ${FLAVOR} != emacs ]; then
-    if test -x /usr/sbin/install-info-altdir; then
-        echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
-        install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/#PACKAGE#.info.gz
-    fi
-
-    echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
-    rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
-fi
diff -Nru dh-make-0.61/lib/debian/emacsen-startup.ex dh-make-0.61+nmu1/lib/debian/emacsen-startup.ex
--- dh-make-0.61/lib/debian/emacsen-startup.ex	2012-06-24 08:56:19.000000000 +0900
+++ dh-make-0.61+nmu1/lib/debian/emacsen-startup.ex	1970-01-01 09:00:00.000000000 +0900
@@ -1,27 +0,0 @@
-;; -*-emacs-lisp-*-
-;;
-;; Emacs startup file, e.g.  /etc/emacs/site-start.d/50#PACKAGE#.el
-;; for the Debian #PACKAGE# package
-;;
-;; Originally contributed by Nils Naumann <naum...@unileoben.ac.at>
-;; Modified by Dirk Eddelbuettel <e...@debian.org>
-;; Adapted for dh-make by Jim Van Zandt <j...@debian.org>
-
-;; The #PACKAGE# package follows the Debian/GNU Linux 'emacsen' policy and
-;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
-;; xemacs19, emacs20, xemacs20...).  The compiled code is then
-;; installed in a subdirectory of the respective site-lisp directory.
-;; We have to add this to the load-path:
-(let ((package-dir (concat "/usr/share/"
-                           (symbol-name debian-emacs-flavor)
-                           "/site-lisp/#PACKAGE#")))
-;; If package-dir does not exist, the #PACKAGE# package must have
-;; removed but not purged, and we should skip the setup.
-  (when (file-directory-p package-dir)
-    (if (fboundp 'debian-pkg-add-load-path-item)
-        (debian-pkg-add-load-path-item package-dir)
-      (setq load-path (cons package-dir load-path)))
-    (autoload '#PACKAGE#-mode "#PACKAGE#-mode"
-      "Major mode for editing #PACKAGE# files." t)
-    (add-to-list 'auto-mode-alist '("\\.#PACKAGE#$" . #PACKAGE#-mode))))
-
diff -Nru dh-make-0.61/lib/emacs/emacsen-install.ex dh-make-0.61+nmu1/lib/emacs/emacsen-install.ex
--- dh-make-0.61/lib/emacs/emacsen-install.ex	1970-01-01 09:00:00.000000000 +0900
+++ dh-make-0.61+nmu1/lib/emacs/emacsen-install.ex	2012-12-27 08:13:09.000000000 +0900
@@ -0,0 +1,47 @@
+#! /bin/sh -e
+# /usr/lib/emacsen-common/packages/install/#PACKAGE#
+
+# Written by Jim Van Zandt <j...@debian.org>, borrowing heavily
+# from the install scripts for gettext by Santiago Vila
+# <sanv...@ctv.es> and octave by Dirk Eddelbuettel <e...@debian.org>.
+
+FLAVOR=$1
+PACKAGE=#PACKAGE#
+
+if [ ${FLAVOR} = emacs ]; then exit 0; fi
+
+echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
+
+#FLAVORTEST=`echo $FLAVOR | cut -c-6`
+#if [ ${FLAVORTEST} = xemacs ] ; then
+#    SITEFLAG="-no-site-file"
+#else
+#    SITEFLAG="--no-site-file"
+#fi
+FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
+
+ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
+ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+ELRELDIR=../../../emacs/site-lisp/${PACKAGE}
+
+# Install-info-altdir does not actually exist.
+# Maybe somebody will write it.
+if test -x /usr/sbin/install-info-altdir; then
+    echo install/${PACKAGE}: install Info links for ${FLAVOR}
+    install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz
+fi
+
+install -m 755 -d ${ELCDIR}
+cd ${ELDIR}
+FILES=`echo *.el`
+cd ${ELCDIR}
+ln -sf ${ELRELDIR}/*.el .
+
+cat << EOF > path.el
+(debian-pkg-add-load-path-item ".")
+(setq byte-compile-warnings nil)
+EOF
+${FLAVOR} ${FLAGS} ${FILES}
+rm -f path.el
+
+exit 0
diff -Nru dh-make-0.61/lib/emacs/emacsen-remove.ex dh-make-0.61+nmu1/lib/emacs/emacsen-remove.ex
--- dh-make-0.61/lib/emacs/emacsen-remove.ex	1970-01-01 09:00:00.000000000 +0900
+++ dh-make-0.61+nmu1/lib/emacs/emacsen-remove.ex	2012-12-27 08:13:09.000000000 +0900
@@ -0,0 +1,15 @@
+#!/bin/sh -e
+# /usr/lib/emacsen-common/packages/remove/#PACKAGE#
+
+FLAVOR=$1
+PACKAGE=#PACKAGE#
+
+if [ ${FLAVOR} != emacs ]; then
+    if test -x /usr/sbin/install-info-altdir; then
+        echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
+        install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/#PACKAGE#.info.gz
+    fi
+
+    echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
+    rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
+fi
diff -Nru dh-make-0.61/lib/emacs/emacsen-startup.ex dh-make-0.61+nmu1/lib/emacs/emacsen-startup.ex
--- dh-make-0.61/lib/emacs/emacsen-startup.ex	1970-01-01 09:00:00.000000000 +0900
+++ dh-make-0.61+nmu1/lib/emacs/emacsen-startup.ex	2012-12-27 08:13:09.000000000 +0900
@@ -0,0 +1,27 @@
+;; -*-emacs-lisp-*-
+;;
+;; Emacs startup file, e.g.  /etc/emacs/site-start.d/50#PACKAGE#.el
+;; for the Debian #PACKAGE# package
+;;
+;; Originally contributed by Nils Naumann <naum...@unileoben.ac.at>
+;; Modified by Dirk Eddelbuettel <e...@debian.org>
+;; Adapted for dh-make by Jim Van Zandt <j...@debian.org>
+
+;; The #PACKAGE# package follows the Debian/GNU Linux 'emacsen' policy and
+;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
+;; xemacs19, emacs20, xemacs20...).  The compiled code is then
+;; installed in a subdirectory of the respective site-lisp directory.
+;; We have to add this to the load-path:
+(let ((package-dir (concat "/usr/share/"
+                           (symbol-name debian-emacs-flavor)
+                           "/site-lisp/#PACKAGE#")))
+;; If package-dir does not exist, the #PACKAGE# package must have
+;; removed but not purged, and we should skip the setup.
+  (when (file-directory-p package-dir)
+    (if (fboundp 'debian-pkg-add-load-path-item)
+        (debian-pkg-add-load-path-item package-dir)
+      (setq load-path (cons package-dir load-path)))
+    (autoload '#PACKAGE#-mode "#PACKAGE#-mode"
+      "Major mode for editing #PACKAGE# files." t)
+    (add-to-list 'auto-mode-alist '("\\.#PACKAGE#$" . #PACKAGE#-mode))))
+

Reply via email to