2018-09-07 21:49:49 -04:00
|
|
|
;; -*- no-byte-compile: t; -*-
|
|
|
|
;;; core/cli/packages.el
|
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defcli! (update u) ()
|
2019-07-12 14:16:53 +02:00
|
|
|
"Updates packages.
|
|
|
|
|
2019-08-15 01:34:28 -04:00
|
|
|
This works by fetching all installed package repos and checking the distance
|
|
|
|
between HEAD and FETCH_HEAD. This can take a while.
|
|
|
|
|
2019-07-12 14:16:53 +02:00
|
|
|
This excludes packages whose `package!' declaration contains a non-nil :freeze
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
or :ignore property."
|
|
|
|
(straight-check-all)
|
|
|
|
(doom-cli-reload-core-autoloads)
|
|
|
|
(when (doom-cli-packages-update)
|
|
|
|
(doom-cli-reload-package-autoloads 'force-p))
|
|
|
|
t)
|
2019-07-21 15:39:45 +02:00
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defcli! (build b)
|
|
|
|
((rebuild-p ["-r"] "Only rebuild packages that need rebuilding"))
|
|
|
|
"Byte-compiles & symlinks installed packages.
|
2019-07-21 15:39:45 +02:00
|
|
|
|
|
|
|
This ensures that all needed files are symlinked from their package repo and
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
their elisp files are byte-compiled. This is especially necessary if you upgrade
|
|
|
|
Emacs (as byte-code is generally not forward-compatible)."
|
|
|
|
(when (doom-cli-packages-build (not rebuild-p))
|
|
|
|
(doom-cli-reload-package-autoloads 'force-p))
|
|
|
|
t)
|
|
|
|
|
|
|
|
(defcli! (purge p)
|
|
|
|
((nobuilds-p ["-b" "--no-builds"] "Don't purge unneeded (built) packages")
|
|
|
|
(noelpa-p ["-p" "--no-elpa"] "Don't purge ELPA packages")
|
|
|
|
(norepos-p ["-r" "--no-repos"] "Don't purge unused straight repos")
|
|
|
|
(regraft-p ["-g" "--regraft"] "Regraft git repos (ie. compact them)"))
|
|
|
|
"Deletes orphaned packages & repos, and compacts them.
|
|
|
|
|
|
|
|
Purges all installed ELPA packages (as they are considered temporary). Purges
|
|
|
|
all orphaned package repos and builds. If -g/--regraft is supplied, the git
|
|
|
|
repos among them will be regrafted and compacted to ensure they are as small as
|
|
|
|
possible.
|
|
|
|
|
|
|
|
It is a good idea to occasionally run this doom purge -g to ensure your package
|
|
|
|
list remains lean."
|
|
|
|
(straight-check-all)
|
|
|
|
(when (doom-cli-packages-purge
|
|
|
|
(not noelpa-p)
|
|
|
|
(not norepos-p)
|
|
|
|
(not nobuilds-p)
|
|
|
|
regraft-p)
|
|
|
|
(doom-cli-reload-package-autoloads 'force-p))
|
|
|
|
t)
|
|
|
|
|
|
|
|
;; (defcli! rollback () ; TODO doom rollback
|
2019-07-21 15:39:45 +02:00
|
|
|
;; "<Not implemented yet>"
|
|
|
|
;; (user-error "Not implemented yet, sorry!"))
|
2019-06-16 23:01:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Library
|
2018-09-07 21:49:49 -04:00
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom-cli-packages-install ()
|
2019-06-16 23:01:17 +02:00
|
|
|
"Installs missing packages.
|
|
|
|
|
|
|
|
This function will install any primary package (i.e. a package with a `package!'
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
declaration) or dependency thereof that hasn't already been."
|
|
|
|
(print! (start "Installing & building packages..."))
|
2019-07-21 15:39:45 +02:00
|
|
|
(print-group!
|
|
|
|
(let ((n 0))
|
|
|
|
(dolist (package (hash-table-keys straight--recipe-cache))
|
|
|
|
(straight--with-plist (gethash package straight--recipe-cache)
|
|
|
|
(local-repo)
|
|
|
|
(let ((existed-p (file-directory-p (straight--repos-dir package))))
|
|
|
|
(condition-case-unless-debug e
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(and (straight-use-package (intern package) nil nil (make-string (1- (or doom-format-indent 1)) 32))
|
2019-07-21 15:39:45 +02:00
|
|
|
(not existed-p)
|
|
|
|
(file-directory-p (straight--repos-dir package))
|
|
|
|
(cl-incf n))
|
|
|
|
(error
|
|
|
|
(signal 'doom-package-error
|
|
|
|
(list e (straight--process-get-output))))))))
|
|
|
|
(if (= n 0)
|
|
|
|
(ignore (print! (success "No packages need to be installed")))
|
|
|
|
(print! (success "Installed & built %d packages") n)
|
|
|
|
t))))
|
|
|
|
|
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom-cli-packages-build (&optional force-p)
|
2019-07-21 15:39:45 +02:00
|
|
|
"(Re)build all packages."
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(print! (start "(Re)building %spackages...") (if force-p "all " ""))
|
2019-07-21 15:39:45 +02:00
|
|
|
(print-group!
|
|
|
|
(let ((n 0))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(if force-p
|
2019-07-21 15:39:45 +02:00
|
|
|
(let ((straight--packages-to-rebuild :all)
|
|
|
|
(straight--packages-not-to-rebuild (make-hash-table :test #'equal)))
|
|
|
|
(dolist (package (hash-table-keys straight--recipe-cache))
|
|
|
|
(straight-use-package
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(intern package) nil (lambda (_) (cl-incf n) nil)
|
|
|
|
(make-string (1- (or doom-format-indent 1)) 32))))
|
2019-07-27 17:20:02 +02:00
|
|
|
(dolist (recipe (hash-table-values straight--recipe-cache))
|
|
|
|
(straight--with-plist recipe (package local-repo no-build)
|
|
|
|
(unless (or no-build (null local-repo))
|
|
|
|
;; REVIEW We do these modification checks manually because
|
|
|
|
;; Straight's checks seem to miss stale elc files. Need
|
|
|
|
;; more tests to confirm this.
|
|
|
|
(when (or (ignore-errors
|
|
|
|
(gethash package straight--packages-to-rebuild))
|
|
|
|
(gethash package straight--cached-package-modifications)
|
|
|
|
(not (file-directory-p (straight--build-dir package)))
|
|
|
|
(cl-loop for file
|
2019-07-26 20:04:53 +02:00
|
|
|
in (doom-files-in (straight--build-dir package)
|
|
|
|
:match "\\.el$"
|
|
|
|
:full t)
|
|
|
|
for elc-file = (byte-compile-dest-file file)
|
|
|
|
if (and (file-exists-p elc-file)
|
|
|
|
(file-newer-than-file-p file elc-file))
|
2019-07-27 17:20:02 +02:00
|
|
|
return t))
|
2019-07-29 20:59:52 +02:00
|
|
|
(let ((straight-use-package-pre-build-functions
|
|
|
|
straight-use-package-pre-build-functions))
|
|
|
|
(add-hook 'straight-use-package-pre-build-functions
|
|
|
|
(lambda (&rest _) (cl-incf n)))
|
|
|
|
(let ((straight--packages-to-rebuild :all)
|
|
|
|
(straight--packages-not-to-rebuild (make-hash-table :test #'equal)))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(straight-use-package
|
|
|
|
(intern package) nil nil
|
|
|
|
(make-string (or doom-format-indent 0) 32)))
|
2019-07-29 20:59:52 +02:00
|
|
|
(straight--byte-compile-package recipe)
|
|
|
|
(dolist (dep (straight--get-dependencies package))
|
|
|
|
(when-let (recipe (gethash dep straight--recipe-cache))
|
|
|
|
(straight--byte-compile-package recipe)))))))))
|
2019-07-21 15:39:45 +02:00
|
|
|
(if (= n 0)
|
|
|
|
(ignore (print! (success "No packages need rebuilding")))
|
2019-07-26 20:04:53 +02:00
|
|
|
(doom--finalize-straight)
|
2019-07-21 15:39:45 +02:00
|
|
|
(print! (success "Rebuilt %d package(s)" n))
|
|
|
|
t))))
|
|
|
|
|
2018-09-07 21:49:49 -04:00
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom-cli-packages-update ()
|
|
|
|
"Updates packages."
|
|
|
|
(print! (start "Updating packages (this may take a while)..."))
|
2019-12-14 20:50:16 -05:00
|
|
|
;; TODO Refactor me
|
|
|
|
(let ((straight--repos-dir (straight--repos-dir))
|
|
|
|
(straight--packages-to-rebuild (make-hash-table :test #'equal))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(total (hash-table-count straight--repo-cache))
|
|
|
|
(i 1)
|
|
|
|
errors)
|
|
|
|
(print-group!
|
|
|
|
(dolist (recipe (hash-table-values straight--repo-cache))
|
|
|
|
(straight--with-plist recipe (package type local-repo)
|
|
|
|
(condition-case-unless-debug e
|
2019-12-14 20:50:16 -05:00
|
|
|
(let ((default-directory (straight--repos-dir local-repo)))
|
|
|
|
(if (not (file-in-directory-p default-directory straight--repos-dir))
|
|
|
|
(print! (warn "[%d/%d] Skipping %s because it is local")
|
|
|
|
i total package)
|
|
|
|
(let ((commit (straight-vc-get-commit type local-repo)))
|
|
|
|
(if (not (straight-vc-fetch-from-remote recipe))
|
|
|
|
(print! (warn "\033[K(%d/%d) Failed to fetch %s" i total package))
|
|
|
|
(let ((output (straight--process-get-output)))
|
|
|
|
(straight-merge-package package)
|
|
|
|
(let ((newcommit (straight-vc-get-commit type local-repo)))
|
|
|
|
(if (string= commit newcommit)
|
|
|
|
(print! (start "\033[K(%d/%d) %s is up-to-date\033[1A") i total package)
|
|
|
|
(ignore-errors
|
|
|
|
(delete-directory (straight--build-dir package) 'recursive))
|
|
|
|
(puthash package t straight--packages-to-rebuild)
|
|
|
|
(print! (info "\033[K(%d/%d) Updating %s...") i total package)
|
|
|
|
(unless (string-empty-p output)
|
|
|
|
(print-group!
|
|
|
|
(print! (info "%s") output)
|
|
|
|
(when (eq type 'git)
|
|
|
|
(straight--call "git" "log" "--oneline" newcommit (concat "^" commit))
|
|
|
|
(print-group!
|
|
|
|
(print! "%s" (straight--process-get-output))))))
|
|
|
|
(print! (success "(%d/%d) %s updated (%s -> %s)") i total package
|
|
|
|
(substring commit 0 7)
|
|
|
|
(substring newcommit 0 7))))))))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(cl-incf i))
|
|
|
|
(user-error
|
|
|
|
(signal 'user-error (error-message-string e)))
|
|
|
|
(error
|
|
|
|
(print! (warn "(%d/%d) Encountered error with %s" i total package))
|
|
|
|
(print-group!
|
|
|
|
(print! (error "%s" e))
|
|
|
|
(print-group! (print! (info "%s" (straight--process-get-output)))))
|
|
|
|
(push package errors)))))
|
2019-11-24 00:49:13 -05:00
|
|
|
(princ "\033[K")
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(when errors
|
|
|
|
(print! (error "There were %d errors, the offending packages are: %s")
|
|
|
|
(length errors) (string-join errors ", ")))
|
|
|
|
(if (hash-table-empty-p straight--packages-to-rebuild)
|
|
|
|
(ignore
|
|
|
|
(print! (success "All %d packages are up-to-date")
|
|
|
|
(hash-table-count straight--repo-cache)))
|
|
|
|
(let ((count (hash-table-count straight--packages-to-rebuild))
|
|
|
|
(packages (hash-table-keys straight--packages-to-rebuild)))
|
|
|
|
(sort packages #'string-lessp)
|
|
|
|
(doom--finalize-straight)
|
|
|
|
(doom-cli-packages-build)
|
|
|
|
(print! (success "Updated %d package(s)") count))
|
|
|
|
t))))
|
2019-07-21 15:39:45 +02:00
|
|
|
|
|
|
|
|
2019-07-29 21:04:58 +02:00
|
|
|
;;; PURGE (for the emperor)
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom--cli-packages-purge-build (build)
|
2019-07-29 21:04:58 +02:00
|
|
|
(let ((build-dir (straight--build-dir build)))
|
2019-07-29 21:18:49 +02:00
|
|
|
(delete-directory build-dir 'recursive)
|
2019-07-29 21:04:58 +02:00
|
|
|
(if (file-directory-p build-dir)
|
|
|
|
(ignore (print! (error "Failed to purg build/%s" build)))
|
|
|
|
(print! (success "Purged build/%s" build))
|
|
|
|
t)))
|
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom--cli-packages-purge-builds (builds)
|
2019-07-29 21:04:58 +02:00
|
|
|
(if (not builds)
|
|
|
|
(progn (print! (info "No builds to purge"))
|
|
|
|
0)
|
|
|
|
(length
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(delq nil (mapcar #'doom--cli-packages-purge-build builds)))))
|
2019-07-29 21:04:58 +02:00
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom--cli-packages-regraft-repo (repo)
|
2019-07-29 21:04:58 +02:00
|
|
|
(let ((default-directory (straight--repos-dir repo)))
|
|
|
|
(if (not (file-directory-p ".git"))
|
2019-11-25 02:14:58 -05:00
|
|
|
(ignore (print! (warn "\033[Krepos/%s is not a git repo, skipping" repo)))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(let ((before-size (doom-directory-size default-directory)))
|
|
|
|
(straight--call "git" "reset" "--hard")
|
|
|
|
(straight--call "git" "clean" "-ffd")
|
|
|
|
(if (not (car (straight--call "git" "replace" "--graft" "HEAD")))
|
2019-11-25 02:14:58 -05:00
|
|
|
(print! (info "\033[Krepos/%s is already compact\033[1A" repo))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(straight--call "git" "gc")
|
2019-11-25 02:14:58 -05:00
|
|
|
(print! (success "\033[KRegrafted repos/%s (from %0.1fKB to %0.1fKB)")
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
repo before-size (doom-directory-size default-directory))
|
|
|
|
(print-group! (print! "%s" (straight--process-get-output)))))
|
2019-07-29 21:04:58 +02:00
|
|
|
t)))
|
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom--cli-packages-regraft-repos (repos)
|
2019-07-29 21:04:58 +02:00
|
|
|
(if (not repos)
|
|
|
|
(progn (print! (info "No repos to regraft"))
|
|
|
|
0)
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(let ((before-size (doom-directory-size (straight--repos-dir))))
|
2019-11-25 02:14:58 -05:00
|
|
|
(print-group!
|
|
|
|
(prog1 (delq nil (mapcar #'doom--cli-packages-regraft-repo repos))
|
|
|
|
(princ "\033[K")
|
|
|
|
(let ((after-size (doom-directory-size (straight--repos-dir))))
|
|
|
|
(print! (success "Finished regrafting. Size before: %0.1fKB and after: %0.1fKB (%0.1fKB)")
|
|
|
|
before-size after-size
|
|
|
|
(- after-size before-size))))))))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
|
|
|
|
(defun doom--cli-packages-purge-repo (repo)
|
2019-07-29 21:04:58 +02:00
|
|
|
(let ((repo-dir (straight--repos-dir repo)))
|
|
|
|
(delete-directory repo-dir 'recursive)
|
|
|
|
(ignore-errors
|
|
|
|
(delete-file (straight--modified-file repo)))
|
|
|
|
(if (file-directory-p repo-dir)
|
|
|
|
(ignore (print! (error "Failed to purge repos/%s" repo)))
|
|
|
|
(print! (success "Purged repos/%s" repo))
|
|
|
|
t)))
|
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom--cli-packages-purge-repos (repos)
|
2019-07-29 21:04:58 +02:00
|
|
|
(if (not repos)
|
|
|
|
(progn (print! (info "No repos to purge"))
|
|
|
|
0)
|
|
|
|
(length
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(delq nil (mapcar #'doom--cli-packages-purge-repo repos)))))
|
2019-07-29 21:04:58 +02:00
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom--cli-packages-purge-elpa ()
|
2019-07-29 21:04:58 +02:00
|
|
|
(unless (bound-and-true-p package--initialized)
|
|
|
|
(package-initialize))
|
2019-09-03 14:07:09 -04:00
|
|
|
(let ((packages (cl-loop for (package desc) in package-alist
|
2019-09-02 13:12:57 -04:00
|
|
|
for dir = (package-desc-dir desc)
|
2019-09-24 20:49:24 -04:00
|
|
|
if (file-in-directory-p dir package-user-dir)
|
2019-09-02 13:12:57 -04:00
|
|
|
collect (cons package dir))))
|
|
|
|
(if (not package-alist)
|
|
|
|
(progn (print! (info "No ELPA packages to purge"))
|
|
|
|
0)
|
|
|
|
(mapc (doom-rpartial #'delete-directory 'recursive)
|
|
|
|
(mapcar #'cdr packages))
|
|
|
|
(length packages))))
|
2019-07-25 18:46:18 +02:00
|
|
|
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(defun doom-cli-packages-purge (&optional elpa-p builds-p repos-p regraft-repos-p)
|
2019-07-21 15:39:45 +02:00
|
|
|
"Auto-removes orphaned packages and repos.
|
2019-06-16 23:01:17 +02:00
|
|
|
|
|
|
|
An orphaned package is a package that isn't a primary package (i.e. doesn't have
|
|
|
|
a `package!' declaration) or isn't depended on by another primary package.
|
|
|
|
|
2019-07-25 18:46:18 +02:00
|
|
|
If BUILDS-P, include straight package builds.
|
|
|
|
If REPOS-P, include straight repos.
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
If ELPA-P, include packages installed with package.el (M-x package-install)."
|
2019-07-29 21:04:58 +02:00
|
|
|
(print! (start "Searching for orphaned packages to purge (for the emperor)..."))
|
|
|
|
(cl-destructuring-bind (&optional builds-to-purge repos-to-purge repos-to-regraft)
|
2019-08-18 11:24:44 -04:00
|
|
|
(let ((rdirs (straight--directory-files (straight--repos-dir) nil nil 'sort))
|
|
|
|
(bdirs (straight--directory-files (straight--build-dir) nil nil 'sort)))
|
2019-08-22 16:12:22 -04:00
|
|
|
(list (cl-remove-if (doom-rpartial #'gethash straight--profile-cache)
|
2019-08-18 11:24:44 -04:00
|
|
|
bdirs)
|
2019-08-22 16:12:22 -04:00
|
|
|
(cl-remove-if (doom-rpartial #'straight--checkhash straight--repo-cache)
|
2019-08-18 11:24:44 -04:00
|
|
|
rdirs)
|
2019-08-22 16:12:22 -04:00
|
|
|
(cl-remove-if-not (doom-rpartial #'straight--checkhash straight--repo-cache)
|
2019-08-18 11:24:44 -04:00
|
|
|
rdirs)))
|
2019-07-26 13:59:14 +02:00
|
|
|
(let (success)
|
|
|
|
(print-group!
|
2019-07-29 21:04:58 +02:00
|
|
|
(if (not builds-p)
|
|
|
|
(print! (info "Skipping builds"))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(and (/= 0 (doom--cli-packages-purge-builds builds-to-purge))
|
2019-07-29 21:04:58 +02:00
|
|
|
(setq success t)
|
|
|
|
(straight-prune-build-cache)))
|
2019-07-26 13:59:14 +02:00
|
|
|
(if (not elpa-p)
|
|
|
|
(print! (info "Skipping elpa packages"))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(and (/= 0 (doom--cli-packages-purge-elpa))
|
2019-07-29 21:04:58 +02:00
|
|
|
(setq success t)))
|
|
|
|
(if (not repos-p)
|
|
|
|
(print! (info "Skipping repos"))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(and (/= 0 (doom--cli-packages-purge-repos repos-to-purge))
|
|
|
|
(setq success t)))
|
|
|
|
(if (not regraft-repos-p)
|
|
|
|
(print! (info "Skipping regrafting"))
|
2019-11-25 02:14:58 -05:00
|
|
|
(print! (start "Regrafting %d repos..." (length repos-to-regraft)))
|
Rewrite core-cli
Highlights:
- 'doom purge' now purges builds, elpa packages, and repos by default.
Regrafting repos is now opt-in with the -g/--regraft switches.
Negation flags have been added for elpa/repos: -e/--no-elpa and
-r/--no-repos.
- Removed 'doom rebuild' (it is now just 'doom build' or 'doom b').
- Removed 'doom build's -f flag, this is now the default. Added the -r
flag instead, which only builds packages that need rebuilding.
- 'doom update' now updates packages synchronously, but produces more
informative output about the updating process.
- Straight can now prompt in batch mode, which resolves a lot of issues
with 'doom update' (and 'doom upgrade') freezing indefinitely or
throwing repo branch errors.
- 'bin/doom's switches are now positional. Switches aimed at `bin/doom`
must precede any subcommands. e.g.
Do: 'doom -yd upgrade'
Don't do: 'doom upgrade -yd'
- Moved 'doom doctor' from bin/doom-doctor to core/cli/doctor, and
integrated core/doctor.el into it, as to avoid naming conflicts
between it and Emacs doctor.
- The defcli! macro now has a special syntax for declaring flags, their
arguments and descriptions.
Addresses #1981, #1925, #1816, #1721, #1322
2019-11-07 15:59:56 -05:00
|
|
|
(and (doom--cli-packages-regraft-repos repos-to-regraft)
|
2019-07-29 21:04:58 +02:00
|
|
|
(setq success t)))
|
2019-07-26 13:59:14 +02:00
|
|
|
(when success
|
|
|
|
(doom--finalize-straight)
|
|
|
|
t)))))
|