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

Missing handling of feature/package name mismatch #456

Closed
svenssonaxel opened this issue Jan 12, 2020 · 5 comments
Closed

Missing handling of feature/package name mismatch #456

svenssonaxel opened this issue Jan 12, 2020 · 5 comments

Comments

@svenssonaxel
Copy link

What's wrong

Features who's name include a + character often have a package name that exchanges the + for -plus. This can

  • confuse the user or 3rd-party utilities that expect to be able to call straight-use-package and require with the same symbol.
  • cause straight-use-package to fail.

Directions to reproduce

(straight-use-package 'crosshairs)
-> Debugger entered--Lisp error: (error "Could not find package hl-line+ in recipe repositories: (org-elpa melpa gnu-elpa-mirror emacsmirror-mirror)")

Workaround

(straight-override-recipe
 `(hl-line+ ,@(straight--convert-recipe 'hl-line-plus)))
(straight-use-package 'crosshairs)

Proposed solution 1

Let a variable hold a list of functions to be applied to a package name to produce aliases

(defun straight--plus-alias (x)
  (replace-regexp-in-string "\\+\\($\\|-\\)" "-plus\\1" x))
(defvar straight--package-alias-functions
  (list #'identity #'straight--plus-alias)
  "A list of functions, each tried in turn to transform the first argument of
`straight-use-package`")

Then, let straight-use-package try these functions in succession, failing only if they all fail.

Proposed solution 2

Add a recipe repository that searches the other recipe repositories, finding recipes for anything matching "-plus($|-)" and publishing recipes with that match exchanged for "+\1".
This introduces dependencies between repositories and might be a little convoluted, especially w.r.t. caches.

Version information

  • Emacs version:
    GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-09-23, modified by Debian

  • Operating system:
    Linux d 4.9.0-8-amd64 Move FIXME notices into Github issues #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux

@raxod502
Copy link
Member

Proposed solution 3: break backwards compatibility and throw caution to the wind :)

The plus thing is just an artifact of the fact that

  • GitHub doesn't let you have plus signs in repo names
  • Emacsmirror publishes packages as GitHub repos
  • My Emacsmirror mirror indexes the packages by listing the GitHub repos under Emacsmirror

So we end up with my Emacsmirror mirror giving straight.el incorrect names for packages on Emacsmirror. No worries, we'll just fix it in post ;)

@raxod502
Copy link
Member

Thanks for the report.

@svenssonaxel
Copy link
Author

Proposed solution 3: break backwards compatibility

Haha, well any way you want to do it!

Note that "-plus" is sometimes correct, sometimes not. I am unable to find any incorrectly named packages in any other builtin recipe repository than emacsmirror-mirror.

@svenssonaxel
Copy link
Author

Tested 0d48441 and confirmed working. Thank you!

@raxod502
Copy link
Member

I am unable to find any incorrectly named packages in any other builtin recipe repository than emacsmirror-mirror.

This is expected since the bug that causes plus symbols to be turned into -plus is strictly on the side of the Emacsmirror mirror, and not anywhere upstream or in straight.el. Thanks for checking though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants