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

Generate warning when local repository names are in conflict #500

Closed
raxod502 opened this issue Mar 24, 2020 · 13 comments
Closed

Generate warning when local repository names are in conflict #500

raxod502 opened this issue Mar 24, 2020 · 13 comments

Comments

@raxod502
Copy link
Member

Currently, if you use two packages from MELPA (or any source) which result in the same auto-generated local repository name (:local-repo), e.g.

then straight.el generates a warning

Warning (straight): Packages "web-server" and "simple-httpd" have incompatible recipes (:repo cannot be both "eschulte/emacs-web-server" and "skeeto/emacs-web-server")

However, this is not a very informative warning to the user, because it does not suggest the resolution of the issue, which is to manually specify :local-repo for one of the recipes. A better warning should be shown.

Related issues:

@raxod502 raxod502 added this to the 1.0 milestone Mar 24, 2020
progfolio added a commit to progfolio/straight.el that referenced this issue Aug 16, 2020
Points user to resolution when local repo names are in conflict.

Fixes radian-software#500
raxod502 added a commit that referenced this issue Aug 20, 2020
Points user to resolution when local repo names are in conflict.

Fixes #500

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
@raxod502
Copy link
Member Author

Huh. So apparently merging that pull request doesn't close this issue, despite GitHub's claims to the contrary.

@SkySkimmer
Copy link
Contributor

Merging in develop doesn't count, it needs to get merged to the default branch AFAIK

@raxod502
Copy link
Member Author

Ah! That would make sense. Thank you for the explanation :)

@yiufung
Copy link

yiufung commented Jan 12, 2021

My setup is as below:

(use-package pdf-tools
	...
	:straight web-server
	...)

(use-package ein
	...
	:straight (simple-httpd :host github :repo "skeeto/emacs-web-server" :local-repo "simple-httpd")
	...)

(Also available in yiufung/dot-emacs/init.el#L2879 and yiufung/dot-emacs/init.el#L3795)

I delete web-server and simple-httpd folders under straight/repo and straight/build folder to have a clean rebuild. However, a warning message still prompts:Warning (straight): Two different recipes given for "simple-httpd" (:local-repo cannot be both "emacs-web-server" and "simple-httpd")

Under straight/repo, both simple-httpd and emacs-web-server come from skeeto/emacs-web-server. As a result, straight/build/web-server and straight/build/simple-httpd always points to simple-httpd.

Incidentally, straight-get-recipe returns correct results for both repos:

  • (web-server :type git :flavor melpa :host github :repo "eschulte/emacs-web-server")
  • (simple-httpd :type git :flavor melpa :host github :repo "skeeto/emacs-web-server")

straight-version returns prerelease (HEAD -> master, origin/master) 2d407bc 2020-12-20

Did I miss anything obvious?

@progfolio
Copy link
Contributor

progfolio commented Jan 12, 2021

Does M-x straight-normalize-package simple-httpd followed by a rebuild help?

@yiufung
Copy link

yiufung commented Jan 12, 2021

@progfolio No it doesn't, neither for simple-httpd nor web-server.

Digged into the function definition, and find that:

  • (gethash "simple-httpd" straight--recipe-cache): (:host github :repo "skeeto/emacs-web-server" :local-repo "simple-httpd" :package "simple-httpd" :type git)
  • (gethash "web-server" straight--recipe-cache) returns wrong result: (:flavor melpa :package "web-server" :local-repo "emacs-web-server" :type git :repo "skeeto/emacs-web-server" :host github)

It seems to involve cache file build-cache.el, so I backup the file, and restarted Emacs. straight then rebuild all packages. However, the error remains after all rebuild is done.

@progfolio
Copy link
Contributor

progfolio commented Jan 12, 2021

Try evaluating the following and sharing the results:

(cl-remove-if-not
 (lambda (package)
   (member "web-server" (nth 1 (gethash package straight--build-cache))))
 (hash-table-keys straight--recipe-cache))

@yiufung
Copy link

yiufung commented Jan 12, 2021

Try both and rebuilt both, still to no avail.

@progfolio
Copy link
Contributor

progfolio commented Jan 12, 2021

Sorry, I should have been more clear. I meant for you to evaluate the above code and see if it printed anything to your *Messages* buffer. It should tell us if there are other packages which depend on "web-server".

@progfolio
Copy link
Contributor

You can try this as well:

(cl-some
 (lambda (package)
   (and (member "web-server" (nth 1 (gethash package straight--build-cache)))
     package))
 (hash-table-keys straight--recipe-cache))

And if it finds a package which depends on "web-server" it should echo it/ print it to Messages.

@yiufung
Copy link

yiufung commented Jan 12, 2021

ELISP> (cl-some
 (lambda (package)
   (and (member "web-server" (nth 1 (gethash package straight--build-cache)))
     package))
 (hash-table-keys straight--recipe-cache))
nil
ELISP> (cl-some
 (lambda (package)
   (and (member "simple-httpd" (nth 1 (gethash package straight--build-cache)))
     package))
 (hash-table-keys straight--recipe-cache))
"org-roam-s..."
ELISP> (cl-some
 (lambda (package)
   (and (member "simple-httpd" (nth 1 (gethash package straight--build-cache)))
     package))
 (hash-table-keys straight--recipe-cache))
"org-roam-server"
ELISP> (cl-remove-if-not
 (lambda (package)
   (member "web-server" (nth 1 (gethash package straight--build-cache))))
 (hash-table-keys straight--recipe-cache))
nil
ELISP> (cl-remove-if-not
 (lambda (package)
   (member "simple-httpd" (nth 1 (gethash package straight--build-cache))))
 (hash-table-keys straight--recipe-cache))
("org-roam-server" "jupyter" "impatient-mode")

@jasonhemann
Copy link

I'm experiencing what @yiufung was running into. Running @progfolio 's commands, I see org-roam-server and org2web depending on simple-httpd, and markdown-preview-mode depending on web-server. Curiously, though, my version of the error message is slightly different from what @raxod502 points to for the same issue: my version mentions emacs-web-server

@raxod502
Copy link
Member Author

You may want to open a new issue for this with the full configuration (see straight-bug-report), for visibility.

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