Skip to content

Experimental support for using Borg alongside Package.el #46

Closed
@tarsius

Description

@tarsius

Borg can now be installed as a secondary package manager alongside package.el. This is not documented in the manual yet. Please follow the below instructions instead. Beside adding such installation instructions to the manual, I also have to describe use-cases and restructure the manual. This is quite a bit of work and that is why I am making this feature available now with only limited documentation.

While it is possible (and in fact a major goal of this update) to install Borg in an existing configuration that relies on package.el I demonstrating how to install it Borg in a new configuration using package.el. If you want to use Borg and package.el at the same time, then I recommend you first go through this process to get a feel for how things work and only then do it in your existing configuration.

First create a new temporary repository in e.g. /tmp/.emacs.d/, clone the package database, and edit /tmp/.emacs.d/init.el:

git init /tmp/.emacs.d
git clone git@github.com:emacsmirror/epkgs.git
emacs /tmp/.emacs.d/init.el

Put this into the /tmp/.emacs.d/init.el:

(setq user-init-file (or load-file-name buffer-file-name))
(setq user-emacs-directory (file-name-directory user-init-file))

(require 'package)
(add-to-list 'package-archives (cons "melpa" "https://melpa.org/packages/") t)

(package-initialize)
(package-refresh-contents)

If you are modifying an existing configuration, then make sure you put that at the top of the file and that you remove all existing package.el configuration.

Then start a new Emacs instance using that configuration.

emacs -Q --load /tmp/.emacs.d/init.el

Install borg using package.el.

M-x package-install RET borg RET

You could start using borg to install other packages right now, but lets first finish the configuration. Replace the last two lines, that we added above, with these:

(package-initialize 'no-activate)
(package-activate 'borg)
(require 'borg-elpa)
(borg-elpa-initialize)

Quit Emacs and start a new instance.

emacs -Q --load init.el

Install a package using Borg. (After the first RET you will be told Compiling EmacSQL SQLite binary. Just wait for that to complete.)

M-x borg-assimilate RET hl-todo RET

That causes package.el to write custom-set-variables and custom-save-faces forms into the init file, so you might want to reload the buffer from the modified file at this point.

M-x revert-buffer RET

The hl-todo package has no dependency, but if it did, then you would have to first install those in separate steps because Borg does not handle dependencies for you. (In the future it might.) You can however use epkg-describe-package to get a tree of dependencies. You can install dependencies of package using package.el if you wish -- even if you are going to install the package itself using Borg.

Have a look at the load-path and note that all the lib directories come before all the elpa directories. Packages installed with Borg override those installed with Package.el.

Use list-packages to get a list of Elpa packages and note that that list includes the packages that you installed using Borg -- with correct version strings, summaries and all.

Once you have installed magit and use-package you should also add the following to your init file.

(use-package magit
  :config
  (magit-add-section-hook 'magit-status-sections-hook
                          'magit-insert-modules
                          'magit-insert-stashes
                          'append)

EDIT: Building a package using Borg currently fails if a dependency was installed using Package.el. I am working on a fix.

EDIT: When using Borg as the primary package manager, then something like this should work:

(progn ;    `borg'
  (setq epkg-repository "~/git/emacs/epkgs/")
  ;; (package-initialize)
  (add-to-list 'load-path (expand-file-name "lib/borg" user-emacs-directory))
  (require  'borg-elpa)
  (borg-elpa-initialize))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions