From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Davis Newsgroups: gmane.emacs.bugs Subject: bug#15201: 24.2; extensions/enhancements to package.el Date: Tue, 27 Aug 2013 16:37:49 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1377650301 5993 80.91.229.3 (28 Aug 2013 00:38:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Aug 2013 00:38:21 +0000 (UTC) To: 15201@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 28 02:38:23 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VETmB-0000C0-A6 for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Aug 2013 02:38:23 +0200 Original-Received: from localhost ([::1]:59738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VETmA-0001Y0-V5 for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Aug 2013 20:38:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VETm3-0001X0-7t for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 20:38:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VETlx-0005t8-QM for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 20:38:15 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VETlx-0005sX-N1 for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 20:38:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VETlw-0006Y2-U6 for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 20:38:09 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ryan Davis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Aug 2013 00:38:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15201 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137765023025084 (code B ref -1); Wed, 28 Aug 2013 00:38:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Aug 2013 00:37:10 +0000 Original-Received: from localhost ([127.0.0.1]:60182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VETkz-0006WT-Bw for submit@debbugs.gnu.org; Tue, 27 Aug 2013 20:37:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35115) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VESpu-00051s-Gv for submit@debbugs.gnu.org; Tue, 27 Aug 2013 19:38:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VESpo-0006sX-OI for submit@debbugs.gnu.org; Tue, 27 Aug 2013 19:38:10 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:43701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VESpo-0006s4-Kh for submit@debbugs.gnu.org; Tue, 27 Aug 2013 19:38:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VESpj-0004de-5y for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 19:38:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VESpd-0006hR-LD for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 19:37:59 -0400 Original-Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:47396) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VESpd-0006hI-9z for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2013 19:37:53 -0400 Original-Received: by mail-pa0-f43.google.com with SMTP id hz10so5456544pad.16 for ; Tue, 27 Aug 2013 16:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=eU7crF/wdLgyFvGI5YIY4+xYX7b+WMWBa/vdnX9aqCc=; b=kM7QIu7j6xznWqWTJaWF6xWVbxHHJYLlfJAaOed4htLACBB8k+cgnwAXWXCXSqHGYR +4FAZ8KDMYg2YNJM+gBEBDM5gjzQa1qCAeo22gxJ7zphuiWZxjGVIJyRpbKsaFF0txrS 1TGtW0Sx4U+oCvjRYYKVLLbRvfXJ+2zgCUeKDd7D3l5o6tjGTEIBEquBDokkwa6HWVOe NqOeUbDMy+qjrAnIWztkIFp9CTb1t+ajQ92HGfORpyGtnBACEbjybW34kjPICEfBTZun 6bQUoHN8d1K1zxr7nHvXZ8ChdXe5C3g2f+dL8NkUhCzYoXp0rlAZ0heP1MQGaEqwaoLi S1Gw== X-Received: by 10.66.193.98 with SMTP id hn2mr11493616pac.173.1377646672110; Tue, 27 Aug 2013 16:37:52 -0700 (PDT) Original-Received: from [172.16.31.51] (ip-216-36-77-101.sjc.megapath.net. [216.36.77.101]) by mx.google.com with ESMTPSA id ot4sm29543496pac.17.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Aug 2013 16:37:51 -0700 (PDT) X-Mailer: Apple Mail (2.1508) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Tue, 27 Aug 2013 20:37:07 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:77777 Archived-At: I know that using cl is frowned upon... but I'm writing this code to be compatible with 24.2 so I can't rely on cl-lib (since this is an extension to the system used to install cl-lib). I'm only using it for set-difference and am open to modifications to make it more portable/acceptable. You can see this code in: https://github.com/zenspider/package/blob/master/package%2B.el#L70-L104 (require 'cl) (defun package-version-for (name) "Returns the installed version for a package with a given NAME." (package-desc-vers (cdr (assoc name package-alist)))) (defun package-delete-by-name (name) "Deletes a package by NAME" (message "Removing %s" name) (package-delete (symbol-name name) (package-version-join (package-version-for name)))) (defun package-maybe-install (name) "Installs a package by NAME, but only if it isn't already = installed." (unless (package-installed-p name) (message "Installing %s" name) (package-install name))) (defun package-deps-for (pkg) "Returns the dependency list for PKG or nil if none or the PKG = doesn't exist." (let ((v (cdr (assoc pkg package-alist)))) (and v (package-desc-reqs v)))) (defun package-transitive-closure (pkgs) (let ((deps '())) (dolist (pkg pkgs deps) (add-to-list 'deps pkg) (dolist (new-pkg (mapcar 'car (package-deps-for pkg))) (add-to-list 'deps new-pkg))))) (defun package-cleanup (packages) "Delete installed packages not explicitly declared in PACKAGES." (let ((removes (set-difference (mapcar 'car package-alist) (package-transitive-closure = packages)))) (mapc 'package-delete-by-name removes))) ;;; finis In GNU Emacs 24.2.1 (x86_64-apple-darwin12.2.0, NS apple-appkit-1187.34) of 2012-09-20 on greed.local Windowing system distributor `Apple', version 10.3.1187 Configured using: `configure '--prefix=3D/usr/local/Cellar/emacs/24.2' '--without-dbus' '--enable-locallisppath=3D/usr/local/share/emacs/site-lisp' '--infodir=3D/usr/local/Cellar/emacs/24.2/share/info/emacs' '--with-ns' '--disable-ns-self-contained'' 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: Fundamental Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: s-x x r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. kill-region: The mark is not set now, so there is no region Quit Making completion list... [2 times] Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail regexp-opt rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-mode easymenu view 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)