unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14118: [PATCH] Add pinning support for packages
@ 2013-04-01 18:39 Yann Hodique
  2013-04-04  1:52 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Yann Hodique @ 2013-04-01 18:39 UTC (permalink / raw)
  To: 14118

Add pinning support for packages

With the current code, the greatest available version of a package wins,
even across repositories.
This can be a problem with repositories such as melpa
(http://melpa.milkbox.net/) that generate packages directly from source
control, thus taking always precedence over released version
of packages. It would be nice to give users the ability to live on the
bleeding edge only for some packages, and stick to more controlled
versions for others. This change provides a way to do that, by allowing
"pinning" a package to a given repository. In particular, this allows
users to store well-known versions of packages in a private repository,
while relying on public ones to provide others.


2013-04-01  Yann Hodique  <yann.hodique@gmail.com>

	Add pinning feature to package.el
	* lisp/emacs-lisp/package.el: bump version to 1.0.1
	(package-pinned-packages): new custom variable to hold pinning data
	(package--add-to-archive-contents): don't add the package if it doesn't
	fit the pinning requirements


*** /var/folders/5v/p46z8rl56452tz_1c_fm_zmr0000gn/T//ECKODq_package.el	2013-04-01 19:35:32.000000000 +0100
--- lisp/emacs-lisp/package.el	2013-04-01 19:20:21.000000000 +0100
***************
*** 4,10 ****
  
  ;; Author: Tom Tromey <tromey@redhat.com>
  ;; Created: 10 Mar 2007
! ;; Version: 1.0
  ;; Keywords: tools
  
  ;; This file is part of GNU Emacs.
--- 4,10 ----
  
  ;; Author: Tom Tromey <tromey@redhat.com>
  ;; Created: 10 Mar 2007
! ;; Version: 1.0.1
  ;; Keywords: tools
  
  ;; This file is part of GNU Emacs.
*************** a package can run arbitrary code."
*** 234,244 ****
    :group 'package
    :version "24.1")
  
  (defconst package-archive-version 1
    "Version number of the package archive understood by this file.
  Lower version numbers than this will probably be understood as well.")
  
! (defconst package-el-version "1.0"
    "Version of package.el.")
  
  ;; We don't prime the cache since it tends to get out of date.
--- 234,261 ----
    :group 'package
    :version "24.1")
  
+ (defcustom package-pinned-packages nil
+   "An alist of packages that are pinned to a specific archive
+ 
+ Each element has the form (SYM . ID).
+  SYM is a package, as a symbol.
+  ID is an archive name, as a string. This should correspond to an
+  entry in `package-archives'.
+ 
+ If the archive of name ID does not contain the package SYM, no
+ other location will be considered, which will make the
+ package unavailable."
+   :type '(alist :key-type (symbol :tag "Package")
+                 :value-type (string :tag "Archive name"))
+   :risky t
+   :group 'package
+   :version "24.4")
+ 
  (defconst package-archive-version 1
    "Version number of the package archive understood by this file.
  Lower version numbers than this will probably be understood as well.")
  
! (defconst package-el-version "1.0.1"
    "Version of package.el.")
  
  ;; We don't prime the cache since it tends to get out of date.
*************** Also, add the originating archive to the
*** 857,864 ****
           (version (package-desc-vers (cdr package)))
           (entry   (cons name
  			(vconcat (cdr package) (vector archive))))
!          (existing-package (assq name package-archive-contents)))
!     (cond ((not existing-package)
  	   (add-to-list 'package-archive-contents entry))
  	  ((version-list-< (package-desc-vers (cdr existing-package))
  			   version)
--- 874,886 ----
           (version (package-desc-vers (cdr package)))
           (entry   (cons name
  			(vconcat (cdr package) (vector archive))))
!          (existing-package (assq name package-archive-contents))
!          (pinned-to-archive (assoc name package-pinned-packages)))
!     (cond ((and pinned-to-archive
!                 ;; if pinned to another archive, skip entirely
!                 (not (equal (cdr pinned-to-archive) archive)))
!            nil)
!           ((not existing-package)
  	   (add-to-list 'package-archive-contents entry))
  	  ((version-list-< (package-desc-vers (cdr existing-package))
  			   version)

-- 
One uses power by grasping it lightly.  To grasp with too much force is to be 
taken over by power, thus becoming its victim.

  -- Bene Gesserit Axiom





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#14118: [PATCH] Add pinning support for packages
  2013-04-01 18:39 bug#14118: [PATCH] Add pinning support for packages Yann Hodique
@ 2013-04-04  1:52 ` Stefan Monnier
  2013-04-04  6:41   ` Yann Hodique
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2013-04-04  1:52 UTC (permalink / raw)
  To: Yann Hodique; +Cc: 14118-done

> Add pinning support for packages

Installed (with tiny comment style fix), thank you.
You might like to sign a copyright assignment for Emacs if you intend to
contribute further patches,


        Stefan





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#14118: [PATCH] Add pinning support for packages
  2013-04-04  1:52 ` Stefan Monnier
@ 2013-04-04  6:41   ` Yann Hodique
  0 siblings, 0 replies; 3+ messages in thread
From: Yann Hodique @ 2013-04-04  6:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 14118-done

>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Installed (with tiny comment style fix), thank you.
> You might like to sign a copyright assignment for Emacs if you intend to
> contribute further patches,

Thanks,

actually the paperwork should already in order (due to contributions to
org-mode).

Yann.

-- 
Truth is a chameleon.

  -- Zensunni Aphorism





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-04  6:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01 18:39 bug#14118: [PATCH] Add pinning support for packages Yann Hodique
2013-04-04  1:52 ` Stefan Monnier
2013-04-04  6:41   ` Yann Hodique

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).