From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Willemse Newsgroups: gmane.emacs.bugs Subject: bug#15108: [Patch] Updated package dependencies Date: Thu, 12 Dec 2013 20:23:58 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1386876314 735 80.91.229.3 (12 Dec 2013 19:25:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Dec 2013 19:25:14 +0000 (UTC) Cc: 15108@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 12 20:25:18 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 1VrBsr-0007u7-MZ for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Dec 2013 20:25:17 +0100 Original-Received: from localhost ([::1]:38322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrBsr-0001UI-9J for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Dec 2013 14:25:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrBsj-0001Tn-K4 for bug-gnu-emacs@gnu.org; Thu, 12 Dec 2013 14:25:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrBsd-0005DN-7s for bug-gnu-emacs@gnu.org; Thu, 12 Dec 2013 14:25:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrBsc-0005BK-SN for bug-gnu-emacs@gnu.org; Thu, 12 Dec 2013 14:25:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VrBsb-0004fl-My for bug-gnu-emacs@gnu.org; Thu, 12 Dec 2013 14:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tom Willemse Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Dec 2013 19:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15108 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 15108-submit@debbugs.gnu.org id=B15108.138687624917892 (code B ref 15108); Thu, 12 Dec 2013 19:25:01 +0000 Original-Received: (at 15108) by debbugs.gnu.org; 12 Dec 2013 19:24:09 +0000 Original-Received: from localhost ([127.0.0.1]:46091 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrBrk-0004eV-Uf for submit@debbugs.gnu.org; Thu, 12 Dec 2013 14:24:09 -0500 Original-Received: from r0.smtpout1.alwaysdata.com ([176.31.58.0]:54127) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VrBrh-0004eM-KO for 15108@debbugs.gnu.org; Thu, 12 Dec 2013 14:24:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alwaysdata.net; s=ryuslash; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=0BJ1e8bcCU58B1n8HsStuT5OmoEFKVMZTT96ppl/d0M=; b=ND9H2TEl/UQVzdlKK4a0kKCVNtJaZENhZ/4t0Nxe5G5UpkRuhN6UXHI9GCxuLXjJnR7n+g7wtZmb1CjpBn+e/LitVkPEUqa20P8693qgUyFxAI5hvzle1KecmgRI2J+O8rVZAHiYme3y2yHixrJQXAHsdTNDkPKNwx6+fmQlSYU=; Original-Received: from 78-21-108-183.access.telenet.be ([78.21.108.183] helo=localhost) by smtpout1.alwaysdata.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.77) (envelope-from ) id 1VrBrb-0000uY-7C; Thu, 12 Dec 2013 20:23:59 +0100 In-Reply-To: (Stefan Monnier's message of "Thu, 12 Dec 2013 13:30:14 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-alwaysdata-ID: 96435447 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:81835 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: >> I've tested it most recently bzr trunk revision 115470. All the ways to >> specify dependencies work as described before: > > Looks good, just one nitpick: > >> ;; Package-Requires: foo >> ;; Package-Requires: (foo bar) >> ;; Package-Requires: (foo (baz "1.1.0") bar) >> ;; Package-Requires: (baz "1.1.0") > > Please don't support the first form nor the last form, since it > otherwise gives the impression that > > ;; Package-Requires: foo bar baz > or > ;; Package-Requires: (foo "0.1") (bar "2.0") > > will also work and we don't want to go that way. Taken care of in attached patch. I was unsure of how to deal with these situations, so I explicitly signal a (hopefully) clear error. Just letting it crash on trying to get the cdr of a symbol seemed messy. Please let me know what you think. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=pkgdep.patch Content-Description: Another patch === modified file 'lisp/emacs-lisp/package.el' *** lisp/emacs-lisp/package.el 2013-12-11 21:15:12 +0000 --- lisp/emacs-lisp/package.el 2013-12-12 19:13:00 +0000 *************** *** 1104,1109 **** --- 1104,1128 ---- (declare-function lm-homepage "lisp-mnt" (&optional file)) + (defun package--prepare-dependencies (deps) + "Turn DEPS into an acceptable list of dependencies. + + Any parts missing a version string get a default version string + of \"0\" (meaning any version) and an appropriate level of lists + is wrapped around any parts requiring it." + (cond + ((null deps) nil) + ((or (symbolp deps) + (and (listp deps) + (symbolp (car deps)) + (stringp (cadr deps)))) + (error "Invalid requirement specifier: %s" deps)) + ((stringp (cadr deps)) `(,deps)) + ((and (listp deps) (listp (car deps)) + (null (cdar deps))) + `((,(caar deps) "0"))) + (t (mapcar (lambda (dep) (if (symbolp dep) `(,dep "0") dep)) deps)))) + (defun package-buffer-info () "Return a `package-desc' describing the package in the current buffer. *************** *** 1135,1141 **** "Package lacks a \"Version\" or \"Package-Version\" header")) (package-desc-from-define file-name pkg-version desc ! (if requires-str (package-read-from-string requires-str)) :kind 'single :url homepage)))) --- 1154,1162 ---- "Package lacks a \"Version\" or \"Package-Version\" header")) (package-desc-from-define file-name pkg-version desc ! (if requires-str ! (package--prepare-dependencies ! (package-read-from-string requires-str))) :kind 'single :url homepage)))) --=-=-=--