Subject: bug#10593: 24.0.92; package.el doesn't initialize dependencies when installing

From: Donald Ephraim Curtis <[email-masked]>
Date: Tue, 24 Jan 2012 01:36:08 -0600

I am attempting to install the package "clojurescript-mode" which
depends on "clojure-mode" using package.el.  clojurescript-mode properly
cites clojure-mode as a dependency and in the source does a (require
'clojure-mode).  However, inside `package-download-transaction' there is
never a call to `package-initialize' or any other function to actually
add the newly installed `clojure-mode' to the load-path.  It ends up in
this case that everything turns out fine, but there are other cases
where multiple levels of dependencies exist and a simple (require '...)
causes breakage.  I am able to reproduce this with the `rinari' package
that installs from packages in Marmalade and Tromey's repository.

Compiling no file at Tue Jan 24 01:34:58 2012
Leaving directory `/Users/dcurtis/.emacs.d/elpa/rinari-2.3'
Compiling file /Users/dcurtis/.emacs.d/elpa/rinari-2.3/rinari-pkg.el at Tue Jan 24 01:34:58 2012
Entering directory `/Users/dcurtis/.emacs.d/elpa/rinari-2.3/'
Compiling file /Users/dcurtis/.emacs.d/elpa/rinari-2.3/rinari.el at Tue Jan 24 01:34:58 2012
rinari.el:80:1:Error: Cannot open load file: inf-ruby

The packages continue to install, that's not a problem, but they don't get compiled,

total 104
-rw-r--r--  1 dcurtis  staff   1077 Jan 24 01:34 rinari-autoloads.el
-rw-r--r--  1 dcurtis  staff    259 Jan 24 01:34 rinari-autoloads.el~
-rw-r--r--  1 dcurtis  staff    145 Jan 24 01:34 rinari-pkg.el
-rw-r--r--  1 dcurtis  staff    665 Jan 24 01:34 rinari-pkg.elc
-rw-r--r--  1 dcurtis  staff  35503 Jan 24 01:34 rinari.el

If this is a bug in the packages, I'd be happy to trace it down, but
changing `package-download-transaction' as follows fixed my problem;
note the (package-initialize) at the bottom...

(defun package-download-transaction (package-list)
  "Download and install all the packages in PACKAGE-LIST.
PACKAGE-LIST should be a list of package names (symbols).
This function assumes that all package requirements in
PACKAGE-LIST are satisfied, i.e. that PACKAGE-LIST is computed
using `package-compute-transaction'."
  (dolist (elt package-list)
    (let* ((desc (cdr (assq elt package-archive-contents)))
	   ;; As an exception, if package is "held" in
	   ;; `package-load-list', download the held version.
	   (hold (cadr (assq elt package-load-list)))
	   (v-string (or (and (stringp hold) hold)
			 (package-version-join (package-desc-vers desc))))
	   (kind (package-desc-kind desc)))
      (cond
       ((eq kind 'tar)
	(package-download-tar elt v-string))
       ((eq kind 'single)
	(package-download-single elt v-string
				 (package-desc-doc desc)
				 (package-desc-reqs desc)))
       (t
	(error "Unknown package kind: %s" (symbol-name kind)))))
    (package-initialize)))

In GNU Emacs 24.0.92.1 (i386-apple-darwin11.2.0, NS apple-appkit-1138.23)
of 2012-01-23 on bird.local
Windowing system distributor `Apple', version 10.3.1138
configured using `configure  '--prefix=/usr/local/Cellar/emacs/HEAD' '--without-dbus' '--enable-locallisppath=/usr/local/share/emacs/site-lisp' '--infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs' '--with-ns' '--disable-ns-self-contained' 'CC=/usr/bin/llvm-gcc' 'CFLAGS=-O3 -w -pipe -march=core2 -msse4''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  paredit-mode: t
  hl-line-mode: t
  idle-highlight-mode: t
  whitespace-mode: t
  savehist-mode: t
  recentf-mode: t
  ido-ubiquitous: t
  ido-everywhere: t
  show-paren-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-: ( p a c k a g e - i n s t a l l SPC ' c l o j u 
r e s c r i p t - m o d e ) <return> C-n C-x RET r 
e p o r t <return>

Recent messages:
(No changes need to be saved)
(No files need saving)
Checking /Users/dcurtis/.emacs.d/elpa/clojurescript-mode-20120123... [2 times]
Compiling /Users/dcurtis/.emacs.d/elpa/clojurescript-mode-20120123/clojurescript-mode-pkg.el...done
Wrote /Users/dcurtis/.emacs.d/elpa/clojurescript-mode-20120123/clojurescript-mode-pkg.elc
Checking /Users/dcurtis/.emacs.d/elpa/clojurescript-mode-20120123...
Compiling /Users/dcurtis/.emacs.d/elpa/clojurescript-mode-20120123/clojurescript-mode.el...
Checking /Users/dcurtis/.emacs.d/elpa/clojurescript-mode-20120123...
Done (Total of 1 file compiled, 1 failed, 1 skipped)
t
byte-code: End of buffer

Load-path shadows:
~/.emacs.d/custom hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.0.92/lisp/custom
/Users/dcurtis/.emacs.d/elpa/magit-20120122/.dir-locals hides /usr/local/Cellar/emacs/HEAD/share/emacs/24.0.92/lisp/gnus/.dir-locals

Features:
(shadow sort flyspell ispell mail-extr message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
emacsbug clojurescript-mode-autoloads clojure-mode-autoloads rx compile
comint ring time-stamp vc-git regexp-opt autoload mail-utils url-cache
network-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045
ietf-drums url-gw url-auth url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-util url-parse auth-source eieio
assoc gnus-util password-cache url-vars mm-util mail-prsvr mailcap
finder-inf paredit hl-line saveplace idle-highlight-mode thingatpt
whitespace molokai-theme savehist recentf tree-widget wid-edit easymenu
autorevert cua-base cus-start cus-load byte-opt warnings bytecomp
byte-compile cconv macroexp server misc midnight
starter-kit-bindings-autoloads windmove starter-kit-autoloads edmacro
kmacro smex starter-kit-misc ffap ido-ubiquitous ido paren
starter-kit-defuns uniquify advice help-fns advice-preload
magit-autoloads ido-ubiquitous-autoloads smex-autoloads
find-file-in-project-autoloads idle-highlight-mode-autoloads
paredit-autoloads package tabulated-list defun cl time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd fontset
image fringe 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 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)