Rob Browning <r...@defaultvalue.org> writes:

> Sébastien Villemot <sebast...@debian.org> writes:

>> Since there seem to be no other new-style package in Wheezy, I think
>> this workaround is sufficient for now. But for Jessie you probably
>> need to refactor the logic of emacsen-package-install so that each
>> install script of a dependency chain is called the right way.
>>
>> I checked that the attached patch fixes the upgrade path from lenny
>> for devscripts-el and emms, hence I merged back these bugs.
>
> Good catch; I'll see if it's easy to fix this right.

If you get a chance, could you take a look at these two patches and see
if they seem reasonable to you?  Mostly just the second one -- the first
one's from your original patch.

I'll be reviewing these again later myself, but wanted others to have a
chance to poke at them too.

>From b5d8610f509dc141c69193f0b5f60b61a211d350 Mon Sep 17 00:00:00 2001
From: Rob Browning <r...@defaultvalue.org>
Date: Sun, 9 Dec 2012 11:50:40 -0600
Subject: [PATCH 1/2] Don't ignore dependency install scripts in
 emacs-package-install.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The previous code didn't actually update the script name properly in
the loop where it was trying to install all of an add-on package's
dependencies.  As a result, none of the dependencies' install scripts
were actually invoked.

Thanks to Sébastien Villemot <sebast...@debian.org> for tracking down
the problem, and providing the patch. (closes: #693472)
---
 emacs-package-install |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/emacs-package-install b/emacs-package-install
index 14b51c2..f97b1db 100755
--- a/emacs-package-install
+++ b/emacs-package-install
@@ -63,12 +63,12 @@ if($context eq 'preinst')
 # Get all the packages $pkg depends on, dependency sorted.
 my @pkgs_to_handle = generate_add_on_install_list([$pkg]);
 my @installed_flavors = get_installed_flavors();
-my $script = $lib_dir . "/packages/install/$pkg";
 
 if(!$invoked_by_old_pkg)
 {
   foreach my $pkg (@pkgs_to_handle)
   {
+    my $script = $lib_dir . "/packages/install/$pkg";
     foreach my $flavor (@installed_flavors)
     {
       print "Install $pkg for $flavor\n";
@@ -84,6 +84,7 @@ else # $invoked_by_old_pkg
 {
   foreach my $pkg (@pkgs_to_handle)
   {
+    my $script = $lib_dir . "/packages/install/$pkg";
     print "Install $pkg for emacs\n";
     ex($script, 'emacs', @installed_flavors) if -e $script;
 
-- 
1.7.10.4

>From 1cc181b3e0fd026b5782e671bd0cc3e5755d870f Mon Sep 17 00:00:00 2001
From: Rob Browning <r...@defaultvalue.org>
Date: Sun, 9 Dec 2012 12:16:11 -0600
Subject: [PATCH 2/2] Invoke each add-on install script correctly as new-style
 or old-style.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Previously, emacs-package-install would invoke all of the add-on
install scripts in a dependency chain as either old-style or
new-style, based solely on whether or not the package that triggered
the install was old-style or new-style.

Now it should invoke each package's install script based on whether or
not the package itself is new-style or old-style, as determined by the
presence or absence of the policy-required
/usr/lib/emacsen-common/packages/compat/PACAKGE file.

Thanks to Sébastien Villemot <sebast...@debian.org> for the report.
(closes: #693472)
---
 emacs-package-install |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/emacs-package-install b/emacs-package-install
index f97b1db..1efdb05 100755
--- a/emacs-package-install
+++ b/emacs-package-install
@@ -26,6 +26,12 @@ sub usage
   }
 }
 
+sub is_new_pkg
+{
+  my($pkg) = @_;
+  return (-e  "$lib_dir/packages/compat/$pkg");
+}
+
 if(scalar(@ARGV) == 1)
 {
   $invoked_by_old_pkg = 1;
@@ -64,11 +70,12 @@ if($context eq 'preinst')
 my @pkgs_to_handle = generate_add_on_install_list([$pkg]);
 my @installed_flavors = get_installed_flavors();
 
-if(!$invoked_by_old_pkg)
+foreach my $pkg (@pkgs_to_handle)
 {
-  foreach my $pkg (@pkgs_to_handle)
+  my $script = $lib_dir . "/packages/install/$pkg";
+
+  if(is_new_pkg($pkg))
   {
-    my $script = $lib_dir . "/packages/install/$pkg";
     foreach my $flavor (@installed_flavors)
     {
       print "Install $pkg for $flavor\n";
@@ -79,12 +86,8 @@ if(!$invoked_by_old_pkg)
       }
     }
   }
-}
-else # $invoked_by_old_pkg
-{
-  foreach my $pkg (@pkgs_to_handle)
+  else # old pkg
   {
-    my $script = $lib_dir . "/packages/install/$pkg";
     print "Install $pkg for emacs\n";
     ex($script, 'emacs', @installed_flavors) if -e $script;
 
-- 
1.7.10.4

Thanks again
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4

Reply via email to