debian: make git*.el packaging more robust
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 unpacked. Likewise,
prerm has similar code to clean up if emacsen-support is unpacked.
The "text -x" is not a strong enough check --- elisp packaging policy
indicates that emacs-package-install should not be run unless
emacsen-common is configured. So at least we would need to change the
check to something like
if [ -x /usr/lib/emacsen-common/emacs-package-install ] &&
[ -e /var/lib/emacsen-common/installed-flavors ]; then
/usr/lib/emacsen-common/emacs-package-install git
fi
to avoid erroring out during installation.
Compiling the elisp also means that users uninterested in the emacs
support still had to 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 <christoph@debian.org>
Fixes: http://bugs.debian.org/614578
Analysis-by: Sven Joachim <svenjoac@gmx.de>
Explained-by: Agustin Martin <agmartin@debian.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
diff --git a/debian/changelog b/debian/changelog
index 03831aa..0fbc9bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,10 @@
* 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 <jrnieder@gmail.com> Tue, 22 Feb 2011 16:53:27 -0600
diff --git a/debian/control b/debian/control
index 594d73e..1ef8e76 100644
--- a/debian/control
+++ b/debian/control
@@ -19,9 +19,10 @@
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,42 @@
.
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
+Replaces: git (<< 1:1.7.4.1-1.1)
+Breaks: git (<< 1:1.7.4.1-1.1)
+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 +293,8 @@
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-el.conffiles b/debian/git-el.conffiles
new file mode 100644
index 0000000..8910604
--- /dev/null
+++ b/debian/git-el.conffiles
@@ -0,0 +1 @@
+/etc/emacs/site-start.d/50git-core.el
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.conffiles b/debian/git.conffiles
index 6670cf8..95583c6 100644
--- a/debian/git.conffiles
+++ b/debian/git.conffiles
@@ -1,2 +1 @@
/etc/bash_completion.d/git
-/etc/emacs/site-start.d/50git-core.el
diff --git a/debian/git.postinst b/debian/git.postinst
index ef7f71c..fd53b7fc 100644
--- a/debian/git.postinst
+++ b/debian/git.postinst
@@ -1,8 +1,20 @@
#!/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-1.1'; then
+ /usr/lib/emacsen-common/emacs-package-remove git
+fi
+
+removed_conffile=/etc/emacs/site-start.d/50git-core.el
+dpkg-maintscript-helper rm_conffile \
+ "$removed_conffile" \
+ 1:1.7.4.1-1.1~ -- "$@"
+# HACK: carry over modifications so git-el can use them.
+if dpkg --compare-versions "$2" lt '1:1.7.4.1-1.1' &&
+ ! test -e "$removed_conffile" &&
+ test -r "$removed_conffile".dpkg-bak; then
+ mv "$removed_conffile".dpkg-bak "$removed_conffile"
fi
# Replace the old /usr/share/doc/git/contrib/emacs directory
diff --git a/debian/git.postrm b/debian/git.postrm
new file mode 100644
index 0000000..b2811e3
--- /dev/null
+++ b/debian/git.postrm
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+
+# Now /etc/emacs/site-start.d/50git-core.el belongs to the
+# git-el package.
+#
+# NOTE: this leaves behind a /etc/emacs/site-start.d/50git-core.el
+# file if it was modified while the broken 1.7.4.1-1 package
+# was installed. Installing and purging git-el works around
+# that.
+
+dpkg-maintscript-helper rm_conffile \
+ /etc/emacs/site-start.d/50git-core.el \
+ 1:1.7.4.1-1.1~ -- "$@"
diff --git a/debian/git.preinst b/debian/git.preinst
new file mode 100644
index 0000000..7a8edb3
--- /dev/null
+++ b/debian/git.preinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+# Now /etc/emacs/site-start.d/50git-core.el belongs to the
+# git-el package. If we are upgrading from a pre- 1.7.4.1-1.1
+# version then git-el is at most unpacked (so its version
+# is 50git-core.el.dpkg-new if present), and we can remove
+# an unchanged 50git-core.el file without danger.
+#
+dpkg-maintscript-helper rm_conffile \
+ /etc/emacs/site-start.d/50git-core.el \
+ 1:1.7.4.1-1.1~ -- "$@"
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..711fc8a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -70,9 +70,10 @@
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 @@
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,22 @@
'$(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-el.emacsen-startup \
+ '$(GIT)'-el/etc/emacs/site-start.d/50git-core.el
+ install -m0755 -D debian/git-el.emacsen-install \
+ '$(GIT)'-el/usr/lib/emacsen-common/packages/install/git
+ install -m0755 -D debian/git-el.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
+ install -d -m0755 '$(GIT)'-el/usr/share/doc/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 +268,10 @@
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