Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

el-get-lock で管理しているパッケージの更新チェックスクリプトを作った #405

Merged
merged 3 commits into from Feb 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions el-get-lock-update-check.el
@@ -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))))