all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Willemse <tom@ryuslash.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 15108@debbugs.gnu.org
Subject: bug#15108: [Patch] Updated package dependencies
Date: Thu, 12 Dec 2013 20:23:58 +0100	[thread overview]
Message-ID: <m3sitxub3l.fsf@ryuslash.org> (raw)
In-Reply-To: <jwvlhzp7wmc.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Thu, 12 Dec 2013 13:30:14 -0500")

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

Stefan Monnier <monnier@IRO.UMontreal.CA> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Another patch --]
[-- Type: text/x-diff, Size: 1723 bytes --]

=== 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))))

  reply	other threads:[~2013-12-12 19:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16  0:23 bug#15108: 24.3.50; Package dependency documentation Tom Willemse
2013-08-16  3:46 ` Stefan Monnier
2013-08-16  6:57   ` Drew Adams
2013-08-16  7:35     ` Tom Willemse
2013-08-16  7:46       ` Drew Adams
2013-08-16  8:06         ` Tom Willemse
2013-08-16 20:58 ` bug#15108: More flexible package dependency specification Tom Willemse
2013-12-11 20:29 ` bug#15108: [Patch] Updated package dependencies Tom Willemse
2013-12-11 20:52   ` Drew Adams
2013-12-11 21:24     ` bug#15108: " Tom Willemse
2013-12-11 21:57       ` Drew Adams
2013-12-11 22:52         ` bug#15108: [Patch] Updated package dependencies, again Tom Willemse
2013-12-12 18:30   ` bug#15108: [Patch] Updated package dependencies Stefan Monnier
2013-12-12 19:23     ` Tom Willemse [this message]
2013-12-15  1:08       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3sitxub3l.fsf@ryuslash.org \
    --to=tom@ryuslash.org \
    --cc=15108@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.