all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yann Hodique <yann.hodique@gmail.com>
To: 14118@debbugs.gnu.org
Subject: bug#14118: [PATCH] Add pinning support for packages
Date: Mon, 01 Apr 2013 19:39:33 +0100	[thread overview]
Message-ID: <m2fvza2ize.fsf@jarvis.hodique.info> (raw)

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





             reply	other threads:[~2013-04-01 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 18:39 Yann Hodique [this message]
2013-04-04  1:52 ` bug#14118: [PATCH] Add pinning support for packages Stefan Monnier
2013-04-04  6:41   ` Yann Hodique

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=m2fvza2ize.fsf@jarvis.hodique.info \
    --to=yann.hodique@gmail.com \
    --cc=14118@debbugs.gnu.org \
    /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.