Subject: bug#14082: 24.3; Package dependences calculated in reverse

From: Donald Curtis <[email-masked]>
Date: Thu, 28 Mar 2013 15:38:48 -0500

When `package.el' calculates package dependencies, they are installed in
the incorrect order.

Consider the rinari third-party package,

* rinari requires: ruby-mode, inf-ruby, ruby-compilation, jump
* jump requires: findr, inflections
* ruby-compilation requires: inf-ruby

Yet, the order of compilation appears to be:

1. inflections
2. findr
3. jump
4. ruby-compilation *fails missing inf-ruby*
5. inf-ruby
6. rinary *fails missing ruby-compilation*

It seems to be that the `jump' dependency of `rinari' is being installed
first, and even it's dependencies are being installed in a reverse
order.

The way that I have personally fixed this problem was to add advice to
the `package-compute-transaction' function:

(defadvice package-compute-transaction
  (before
   package-compute-transaction-reverse (package-list requirements)
   activate compile)
  "reverse the requirements"
  (setq requirements (reverse requirements))
  (print requirements))

It seems like there must be something in the way the requirements is
being built that means that when they are read they are done in reverse
order.

In GNU Emacs 24.3.1 (x86_64-apple-darwin12.3.0, NS apple-appkit-1187.37)
of 2013-03-28 on hendrix.local
Windowing system distributor `Apple', version 10.3.1187
Configured using:
`configure '--prefix=/usr/local/Cellar/emacs/24.3' '--without-dbus'
'--enable-locallisppath=/usr/local/share/emacs/site-lisp'
'--infodir=/usr/local/Cellar/emacs/24.3/share/info/emacs' '--with-ns'
'--disable-ns-self-contained' 'CC=cc''

Important settings:
  locale-coding-system: utf-8
  default enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  which-function-mode: t
  ido-everywhere: t
  delete-selection-mode: t
  global-subword-mode: t
  subword-mode: t
  winner-mode: t
  show-paren-mode: t
  savehist-mode: t
  shell-dirtrack-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x RET p a c k <tab> l i <tab> <return> C-s r i n 
a r C-a i x y C-x b C-g C-x RET b u g <tab> <tab> C-w 
C-w C-w c r e s u b C-g C-s s m e x C-a i x y C-x RET 
b u g C-n C-n C-n C-n C-n C-n C-n C-n <return> C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n <tab> <S-tab> <return> 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n <left> C-b 
<S-tab> <S-tab> <S-tab> <tab> <tab> C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p <tab> C-p C-n C-n C-n C-n C-p 
C-p C-p C-p C-p M-f M-f M-f M-f M-f M-[ ESC ESC ESC 
ESC C-g C-g C-x b b u g <backspace> <backspace> <backspace> 
C-g C-x RET e m a c s b u g C-n <return> P a c k a 
g e SPC D e p e n d e n c e s SPC C a l c u l a t e 
d SPC i n SPC R e v e r s e <return> C-p C-n C-w h 
e <backspace> <backspace> W h e n C-w C-w C-/ C-/ C-/ 
C-/ C-/ C-/ C-/ C-/ C-? C-? C-? C-c k C-x RET <ret
urn>

Recent messages:
Checking 70 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/erc...
Checking 48 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/emulation...
Checking 147 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/emacs-lisp...
Checking 24 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/cedet...
Checking 57 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/calendar...
Checking 87 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/calc...
Checking 77 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/obsolete...
Checking 1 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/leim...
Checking for load-path shadows...done
Undo! [8 times]

Load-path shadows:
~/.emacs.d/custom hides /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/custom

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail info smex
smex-autoloads rinari-autoloads easy-mmode inf-ruby ruby-mode
inf-ruby-autoloads ruby-compilation-autoloads inflections findr
jump-autoloads findr-autoloads compile inflections-autoloads autoload
misearch multi-isearch mule-util time-stamp vc-git mail-utils
network-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045
ietf-drums url-gw url-cache url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse url-vars mailcap finder-inf whitespace base16-ocean-theme
which-func imenu cus-start cus-load rx ido delsel subword winner paren
savehist tramp-cache tramp-sh tramp tramp-compat auth-source eieio
gnus-util mm-util mail-prsvr password-cache tramp-loaddefs shell
pcomplete comint ansi-color ring format-spec autorevert byte-opt
warnings bytecomp byte-compile cconv edmacro kmacro windmove server
defun uniquify advice help-fns advice-preload saveplace recentf
tree-widget wid-edit misc midnight checkdoc thingatpt help-mode easymenu
package cl-macs gv cl cl-lib time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process ns multi-tty emacs)