bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14118: [PATCH] Add pinning support for packages


From: Yann Hodique
Subject: bug#14118: [PATCH] Add pinning support for packages
Date: Mon, 01 Apr 2013 19:39:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin)

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  <address@hidden>

        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 <address@hidden>
  ;; Created: 10 Mar 2007
! ;; Version: 1.0
  ;; Keywords: tools
  
  ;; This file is part of GNU Emacs.
--- 4,10 ----
  
  ;; Author: Tom Tromey <address@hidden>
  ;; 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 via email to

[Prev in Thread] Current Thread [Next in Thread]