-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from mugijiru/add-el-get-lock-update-cherker-…
…script el-get-lock で管理しているパッケージの更新チェックスクリプトを作った
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(progn | ||
(load (expand-file-name "~/.emacs.d/init-el-get.el")) | ||
(let ((obsolute-packages '()) | ||
(cannot-get-url-packages '()) | ||
(cannot-get-hash-packages '()) | ||
(not-installed-packages '()) | ||
(el-get-default-process-sync t) | ||
(versions (cdr el-get-lock-package-versions))) | ||
(dolist (version versions) | ||
(let ((package (replace-regexp-in-string "\\\\\\\." "\\\." (symbol-name (car version)))) | ||
(checksum (plist-get (cdr version) :checksum))) | ||
(progn | ||
(if (el-get-package-installed-p package) | ||
(progn | ||
(let* ((recipe (ignore-errors (el-get-package-def package))) | ||
(type (plist-get recipe :type)) | ||
(branch (plist-get recipe :branch)) | ||
(tag (plist-get recipe :checkout)) | ||
(pkgname (plist-get recipe :pkgname)) | ||
(url (if (eq type 'github) | ||
(concat "git://github.com/" pkgname ".git") | ||
(plist-get recipe :url)))) | ||
(if url | ||
(progn | ||
(let* ((grep-regexp-prefix "refs/") | ||
(grep-options (if branch | ||
(list "-e" (concat grep-regexp-prefix "heads/" branch)) | ||
(if tag | ||
(list "-e" (concat grep-regexp-prefix "tags/" tag "^{}")) | ||
(list "-e" (concat grep-regexp-prefix "heads/master") "-e" (concat grep-regexp-prefix "heads/main"))))) | ||
(command-list (append (list "git" "ls-remote" url "|" "grep") grep-options)) | ||
(command (mapconcat #'shell-quote-argument command-list " ")) | ||
(result (shell-command-to-string command)) | ||
(hash (if (>= (string-width result) 40) | ||
(substring result 0 40) | ||
nil))) | ||
(if hash | ||
(unless (string-equal checksum hash) | ||
(add-to-list 'obsolute-packages package)) | ||
(add-to-list 'cannot-get-hash-packages package)) | ||
)) | ||
(add-to-list 'cannot-get-url-packages package)))) | ||
(add-to-list 'not-installed-packages package))))) | ||
(message "## obsolute packages ##") | ||
(dolist (package obsolute-packages) | ||
(message package)) | ||
(message "\n## not installed packages ##") | ||
(dolist (package not-installed-packages) | ||
(message package)) | ||
(message "\n## cannot get hash packages ##") | ||
(dolist (package cannot-get-hash-packages) | ||
(message package)) | ||
(message "\n## cannot get url packages ##") | ||
(dolist (package cannot-get-url-packages) | ||
(message package)))) |