Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
3b8b549f
Commit
3b8b549f
authored
Feb 13, 2015
by
Artur Malabarba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
emacs-lisp/package.el (package--incompatible-p): Check dependencies.
parent
69e38a5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
10 deletions
+57
-10
lisp/ChangeLog
lisp/ChangeLog
+7
-0
lisp/emacs-lisp/package.el
lisp/emacs-lisp/package.el
+50
-10
No files found.
lisp/ChangeLog
View file @
3b8b549f
2015-02-13 Artur Malabarba <bruce.connor.am@gmail.com>
* emacs-lisp/package.el (package--compatibility-table): New var.
(package--add-to-compatibility-table): New function.
(package-read-all-archive-contents): Populate compatibility table.
(package--incompatible-p): Also look in dependencies.
2015-02-13 Lars Ingebrigtsen <larsi@gnus.org>
* net/rfc2104.el: Moved here from lisp/gnus.
...
...
lisp/emacs-lisp/package.el
View file @
3b8b549f
...
...
@@ -468,6 +468,19 @@ called via `package-initialize'. To change which packages are
loaded and/or activated, customize `package-load-list'."
)
(
put
'package-alist
'risky-local-variable
t
)
(
defvar
package--compatibility-table
nil
"Hash table connecting package names to their compatibility.
Each key is a symbol, the name of a package.
The value is either nil, representing an incompatible package, or
a version list, representing the highest compatible version of
that package which is available.
A package is considered incompatible if it requires an Emacs
version higher than the one being used. To check for package
\(in)compatibility, don't read this table directly, use
`package--incompatible-p' which also checks dependencies."
)
(
defvar
package-activated-list
nil
;; FIXME: This should implicitly include all builtin packages.
"List of the names of currently activated packages."
)
...
...
@@ -1131,7 +1144,10 @@ Will throw an error if the archive version is too new."
If
successful,
set
`
package-archive-contents
'.
"
(setq package-archive-contents nil)
(dolist (archive package-archives)
(package-read-archive-contents (car archive))))
(package-read-archive-contents (car archive)))
;; Build compat table.
(setq package--compatibility-table (make-hash-table :test 'eq))
(package--mapc #'package--add-to-compatibility-table))
(defun package-read-archive-contents (archive)
"
Re-read
archive
contents
for
ARCHIVE.
...
...
@@ -1728,6 +1744,19 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
(
package-activate
(
car
elt
))))
(
setq
package--initialized
t
))
(
defun
package--add-to-compatibility-table
(
pkg
)
"If PKG is compatible (without dependencies), add to the compatibility table.
PKG is a package-desc object.
Only adds if its version is higher than what's already stored in
the table."
(
unless
(
package--incompatible-p
pkg
'shallow
)
(
let*
((
name
(
package-desc-name
pkg
))
(
version
(
or
(
package-desc-version
pkg
)
'
(
0
)))
(
table-version
(
gethash
name
package--compatibility-table
)))
(
when
(
or
(
not
table-version
)
(
version-list-<
table-version
version
))
(
puthash
name
version
package--compatibility-table
)))))
;;;; Package description buffer.
...
...
@@ -2059,21 +2088,32 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC."
(
defvar
package--emacs-version-list
(
version-to-list
emacs-version
)
"`emacs-version', as a list."
)
(
defun
package--incompatible-p
(
pkg
)
(
defun
package--incompatible-p
(
pkg
&optional
shallow
)
"Return non-nil if PKG has no chance of being installable.
PKG is a package-desc object.
Return value is a string describing the reason why the package is
incompatible.
Currently, this only checks if PKG depends on a higher
`emacs-version' than the one being used."
If SHALLOW is non-nil, this only checks if PKG depends on a
higher `emacs-version' than the one being used. Otherwise, also
checks the viability of dependencies, according to
`package--compatibility-table'.
If PKG requires an incompatible Emacs version, the return value
is this version (as a string).
If PKG requires incompatible packages, the return value is a list
of these dependencies, similar to the list returned by
`package-desc-reqs'."
(
let*
((
reqs
(
package-desc-reqs
pkg
))
(
version
(
cadr
(
assq
'emacs
reqs
))))
(
if
(
and
version
(
version-list-<
package--emacs-version-list
version
))
(
format
"`%s' requires Emacs %s, but current version is %s"
(
package-desc-full-name
pkg
)
(
package-version-join
version
)
emacs-version
))))
(
package-version-join
version
)
(
unless
shallow
(
let
(
out
)
(
dolist
(
dep
(
package-desc-reqs
pkg
)
out
)
(
let
((
dep-name
(
car
dep
)))
(
unless
(
eq
'emacs
dep-name
)
(
let
((
cv
(
gethash
dep-name
package--compatibility-table
)))
(
when
(
version-list-<
(
or
cv
'
(
0
))
(
or
(
cadr
dep
)
'
(
0
)))
(
push
dep
out
)))))))))))
(
defun
package-desc-status
(
pkg-desc
)
(
let*
((
name
(
package-desc-name
pkg-desc
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment