git's postinst contains the following snippet:

  if test -x /usr/lib/emacsen-common/emacs-package-install; then
    /usr/lib/emacsen-common/emacs-package-install git
  fi

which makes git's elisp files usable and compiles them to bytecode
on installation, provided emacsen-support is installed.  Likewise,
prerm has similar code to clean up if emacsen-support is installed.

Of course that is totally broken, since it means:

 - if you install git first, then emacs, then no emacs support
   until the next git upgrade
 - if you install emacs, install git, remove emacs, and then
   remove git, then bytecode is not cleared away as it ought to be.

Plus it means that users uninterested in the emacs support endure
waiting for them to be compiled and reading the resulting warnings
each time git is upgraded.

So:

 - Move the .el files to a separate git-el package.

 - Make git depend on emacsen-support, so it can remove the old .elc
   files in postinst on upgrade.  Luckily the broken preinst was not
   part of squeeze, so this transitional code (and the emacsen-support
   dependency) can be dropped after a while.

Reported-by: Christoph Egger <christ...@debian.org>
Helped-by: Sven Joachim <svenj...@gmx.de>
Fixes: http://bugs.debian.org/614578
Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
Sven Joachim wrote:

> If you want to make a separate package, it should be named git-el and
> depend on emacs | emacsen.  Alternatively, you could make git depend on
> emacsen-common.

How about something like this?

 debian/changelog                                   |    5 ++-
 debian/control                                     |   40 +++++++++++++++++++-
 ...{git.emacsen-install => git-el.emacsen-install} |    0
 .../{git.emacsen-remove => git-el.emacsen-remove}  |    0
 ...{git.emacsen-startup => git-el.emacsen-startup} |    0
 debian/git-el.postinst                             |    4 ++
 debian/git-el.prerm                                |    3 +
 debian/git.README.emacs                            |    4 +-
 debian/git.postinst                                |    4 +-
 debian/git.prerm                                   |    4 --
 debian/rules                                       |   38 ++++++++++--------
 11 files changed, 74 insertions(+), 28 deletions(-)
 rename debian/{git.emacsen-install => git-el.emacsen-install} (100%)
 rename debian/{git.emacsen-remove => git-el.emacsen-remove} (100%)
 rename debian/{git.emacsen-startup => git-el.emacsen-startup} (100%)
 create mode 100644 debian/git-el.postinst
 create mode 100644 debian/git-el.prerm

diff --git a/debian/changelog b/debian/changelog
index 03831aa..0fbc9bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,10 @@ git (1:1.7.4.1-1.1) unstable; urgency=low
 
   * README.emacs: git-blame.el does not print a summary in the
     echo area (documents: #611935).
-  * git.emacsen-install: overwrite .el symlinks if they already
+  * Move emacs support files to a separate git-el package.
+  * Make git depend on emacsen-support, so it can reliably clean
+    up the old emacs support files on upgrade (closes: #614578)
+  * git-el.emacsen-install: Overwrite .el symlinks if they already
     exist (closes: #614659).
 
  -- Jonathan Nieder <jrnie...@gmail.com>  Tue, 22 Feb 2011 16:53:27 -0600
diff --git a/debian/control b/debian/control
index 594d73e..15679fb 100644
--- a/debian/control
+++ b/debian/control
@@ -19,9 +19,10 @@ Package: git
 Architecture: any
 Depends: ${shlibs:Depends}, perl-modules, liberror-perl,
  git-man (>> ${source:Upstream-Version}), git-man (<< 
${source:Upstream-Version}-.),
+ emacsen-common,
  libc6.1 (>= 2.10.2-6) [ia64]
 Recommends: patch, less, rsync, ssh-client
-Suggests: git-doc, git-arch, git-cvs, git-svn, git-email, git-daemon-run, 
git-gui, gitk, gitweb
+Suggests: git-doc, git-el, git-arch, git-cvs, git-svn, git-email, 
git-daemon-run, git-gui, gitk, gitweb
 Replaces: gitweb (<< 1:1.7.4~rc1),
  cogito (<< 0.16rc2-0), git-core (<= 1:1.7.0.4-1)
 Breaks: gitweb (<< 1:1.7.4~rc1),
@@ -230,6 +231,40 @@ Description: fast, scalable, distributed revision control 
system (revision tree
  .
  This package provides the gitk program, a tcl/tk revision tree visualizer.
 
+Package: git-el
+Architecture: all
+Depends: git (>= 1:1.7.4.1-1.1), emacs | emacsen
+Description: fast, scalable, distributed revision control system (emacs 
support)
+ Git is popular version control system designed to handle very large
+ projects with speed and efficiency; it is used for many high profile
+ open source projects, most notably the Linux kernel.
+ .
+ Git falls in the category of distributed source code management tools.
+ Every Git working directory is a full-fledged repository with full
+ revision tracking capabilities, not dependent on network access or a
+ central server.
+ .
+ This package provides two modules for integration with Emacs:
+ .
+  * git.el:
+ .
+    Status manager that displays the state of all the files of the
+    project and provides easy access to the most frequently used git
+    commands. The user interface is intended to be similar to the
+    pcl-cvs mode. It can be started with `M-x git-status'.
+ .
+  * git-blame.el:
+ .
+    Emacs implementation of incremental "git blame".  When you turn it
+    on while viewing a file, the editor buffer will be updated by
+    setting the background of individual lines to a color that reflects
+    which commit it comes from.
+ .
+ This package does not contain the VC-mode backend for git. That is
+ part of standard Emacs distributions, starting with version 22.2.
+ .
+ For a more polished Emacs interface for Git, see the magit package.
+
 Package: gitweb
 Architecture: all
 Depends: git (>> ${source:Upstream-Version}), git (<< 
${source:Upstream-Version}-.),
@@ -256,7 +291,8 @@ Description: fast, scalable, distributed revision control 
system (web interface)
 
 Package: git-all
 Architecture: all
-Depends: git (>> ${source:Upstream-Version}), git (<< 
${source:Upstream-Version}-.), git-doc, git-arch, git-cvs, git-svn, git-email, 
git-gui, gitk, gitweb
+Depends: git (>> ${source:Upstream-Version}), git (<< 
${source:Upstream-Version}-.),
+ git-doc, git-el, git-arch, git-cvs, git-svn, git-email, git-gui, gitk, gitweb
 Recommends: git-daemon-run
 Description: fast, scalable, distributed revision control system (all 
subpackages)
  Git is popular version control system designed to handle very large
diff --git a/debian/git.emacsen-install b/debian/git-el.emacsen-install
similarity index 100%
rename from debian/git.emacsen-install
rename to debian/git-el.emacsen-install
diff --git a/debian/git.emacsen-remove b/debian/git-el.emacsen-remove
similarity index 100%
rename from debian/git.emacsen-remove
rename to debian/git-el.emacsen-remove
diff --git a/debian/git.emacsen-startup b/debian/git-el.emacsen-startup
similarity index 100%
rename from debian/git.emacsen-startup
rename to debian/git-el.emacsen-startup
diff --git a/debian/git-el.postinst b/debian/git-el.postinst
new file mode 100644
index 0000000..3037997
--- /dev/null
+++ b/debian/git-el.postinst
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+test "$1" = configure || exit 0
+/usr/lib/emacsen-common/emacs-package-install git
diff --git a/debian/git-el.prerm b/debian/git-el.prerm
new file mode 100644
index 0000000..f97d72d
--- /dev/null
+++ b/debian/git-el.prerm
@@ -0,0 +1,3 @@
+#!/bin/sh
+set -e
+/usr/lib/emacsen-common/emacs-package-remove git
diff --git a/debian/git.README.emacs b/debian/git.README.emacs
index 59aa383..704b661 100644
--- a/debian/git.README.emacs
+++ b/debian/git.README.emacs
@@ -1,6 +1,6 @@
-The git package provides various modules for Emacs support.
+The git-el package provides various modules for Emacs support.
 
-When the git package is installed, the modules will be automatically
+When the git-el package is installed, the modules will be automatically
 made available to installed Emacs versions.  The configuration
 can be overridden in /etc/emacs/site-start.d/50git-core.el.
 
diff --git a/debian/git.postinst b/debian/git.postinst
index ef7f71c..b989883 100644
--- a/debian/git.postinst
+++ b/debian/git.postinst
@@ -1,8 +1,8 @@
 #!/bin/sh
 set -e
 test "$1" = configure || exit 0
-if test -x /usr/lib/emacsen-common/emacs-package-install; then
-  /usr/lib/emacsen-common/emacs-package-install git
+if dpkg --compare-versions "$2" lt '1:1.7.4.1-2'; then
+  /usr/lib/emacsen-common/emacs-package-remove git
 fi
 
 # Replace the old /usr/share/doc/git/contrib/emacs directory
diff --git a/debian/git.prerm b/debian/git.prerm
index 6c6178a..aa3940a 100644
--- a/debian/git.prerm
+++ b/debian/git.prerm
@@ -1,9 +1,5 @@
 #!/bin/sh
 set -e
-if test -x /usr/lib/emacsen-common/emacs-package-remove; then
-  /usr/lib/emacsen-common/emacs-package-remove git
-fi
-
 # The /usr/share/doc/git/contrib/emacs directory was replaced
 # with a symlink in 1:1.7.4~rc1-0.1.
 # If downgrading, put the directory back.
diff --git a/debian/rules b/debian/rules
index de02c3a..f2226f3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -70,9 +70,10 @@ clean: deb-checkdir
          done
        rm -rf '$(TMP)'
        rm -f patch-stamp build-arch-stamp build-indep-stamp
-       rm -rf '$(GIT)' '$(GIT)'-doc '$(GIT)'-arch '$(GIT)'-cvs \
-         '$(GIT)'-svn '$(GIT)'-email '$(GIT)'-daemon-run '$(GIT)'-gui \
-         '$(GIT)'k '$(GIT)'web '$(GIT)'-all '$(GIT)'-man '$(GIT)'-core
+       rm -rf '$(GIT)' '$(GIT)'-doc '$(GIT)'-arch '$(GIT)'-cvs
+       rm -rf '$(GIT)'-svn '$(GIT)'-email '$(GIT)'-daemon-run '$(GIT)'-gui
+       rm -rf '$(GIT)'k '$(GIT)'web '$(GIT)'-all '$(GIT)'-man '$(GIT)'-core
+       rm -rf '$(GIT)'-el
        rm -f debian/files debian/substvars changelog
 
 install: install-arch install-indep
@@ -102,18 +103,6 @@ install-arch: deb-checkdir deb-checkuid build-arch-stamp
        rm -rf '$(GIT)'/usr/share/git-gui/
        # don't include gitk's lib
        rm -rf '$(GIT)'/usr/share/gitk/
-       # emacs
-       install -m0644 -D debian/git.emacsen-startup \
-         '$(GIT)'/etc/emacs/site-start.d/50git-core.el
-       install -m0755 -D debian/git.emacsen-install \
-         '$(GIT)'/usr/lib/emacsen-common/packages/install/git
-       install -m0755 -D debian/git.emacsen-remove \
-         '$(GIT)'/usr/lib/emacsen-common/packages/remove/git
-       install -d -m0755 '$(GIT)'/usr/share/git-core/emacs
-       install -m0644 contrib/emacs/git-blame.el \
-         '$(GIT)'/usr/share/git-core/emacs/git-blame.el
-       install -m0644 contrib/emacs/git.el \
-         '$(GIT)'/usr/share/git-core/emacs/git.el
        # bash completion
        install -d -m0755 '$(GIT)'/etc/bash_completion.d
        install -m0644 contrib/completion/git-completion.bash \
@@ -207,6 +196,21 @@ install-indep-real: build-arch-stamp build-indep-stamp
          '$(GIT)'-daemon-run/etc/sv/git-daemon/run
        install -m0755 debian/git-daemon/log/run \
          '$(GIT)'-daemon-run/etc/sv/git-daemon/log/run
+       # git-el
+       rm -rf '$(GIT)'-el
+       install -m0644 -D debian/git.emacsen-startup \
+         '$(GIT)'-el/etc/emacs/site-start.d/50git-core.el
+       install -m0755 -D debian/git.emacsen-install \
+         '$(GIT)'-el/usr/lib/emacsen-common/packages/install/git
+       install -m0755 -D debian/git.emacsen-remove \
+         '$(GIT)'-el/usr/lib/emacsen-common/packages/remove/git
+       install -d -m0755 '$(GIT)'-el/usr/share/git-core/emacs
+       install -m0644 contrib/emacs/git-blame.el \
+         '$(GIT)'-el/usr/share/git-core/emacs/git-blame.el
+       install -m0644 contrib/emacs/git.el \
+         '$(GIT)'-el/usr/share/git-core/emacs/git.el
+       ln -s ../git/README.emacs \
+         '$(GIT)'-el/usr/share/doc/git-el/README.Debian
        # git-gui
        rm -rf '$(GIT)'-gui
        install -d -m0755 '$(GIT)'-gui/usr/lib/git-core
@@ -263,10 +267,10 @@ binary-arch: install-arch git.deb
        dpkg -b '$(GIT)' ..
 binary-indep: install-indep git-doc.deb git-arch.deb git-cvs.deb git-svn.deb \
          git-daemon-run.deb git-email.deb git-gui.deb gitk.deb gitweb.deb \
-         git-all.deb git-man.deb git-core.deb-DEBIAN
+         git-all.deb git-el.deb git-man.deb git-core.deb-DEBIAN
        rm -f debian/substvars
        for i in -doc -arch -cvs -svn -daemon-run -email -gui k web -all \
-        -core -man; do \
+        -core -el -man; do \
          dpkg-gencontrol -isp -pgit$$i -P'$(GIT)'$$i && \
          dpkg -b '$(GIT)'$$i .. || exit 1; \
        done
-- 
1.7.4.1




-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to