radian-software / straight.el

🍀 Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.71k stars 150 forks source link

Package moved; straight fetches an out-of-date fork despite receipe on melpa being correct #1006

Open doolio opened 1 year ago

doolio commented 1 year ago

The ieure/scratch-el has been moved to Codeberg by its author. Note the repo name has changed from scratch-el to simply scratch. For me, straight however fetches from an out-of-date fork that can be found here. Despite updating the recipe repositories, M-x straight-get-receipe gives the following pointing to that fork:

`(scratch :type git :host github :repo "cbbrowne/scratch-el" :pre-build ,(cl-letf (((symbol-function #'el-get-package-directory) (lambda (package) (straight--repos-dir (format "%S" package)))) (el-get-install-info (straight--el-get-install-info)) (el-get-emacs (straight--emacs-path)) (el-get-dir (straight--repos-dir))) (pcase system-type (_ `(("make"))))) :files (:defaults))

I forked the melpa repository and confirmed the recipe points to the new forge and includes the new repo name:

(scratch
 :fetcher codeberg
 :repo "emacs-weirdware/scratch"
 :files ("scratch.el"))

Another fork exists on emacsmirror here but the repository name was changed from scratch-el to simply scratch matching that on codeberg and seems to be up to date.

So I don't understand why straight is picking up the out-of-date fork. If it helps the melpa receipe was pointing to that fork at some point as shown by this commit. I'm running the latest version of straight at the time of writing namely:

prerelease (HEAD -> master, origin/master) f21103d 2022-08-19

I tried to override the recipe as follows but to no avail:

(use-package scratch                    ; Mode specific scratch buffers.
  :straight (:fork (:repo "emacsmirror/scratch"))
  :bind ("C-c b S" . scratch))

The backtrace is as follows:

Debugger entered--Lisp error: (error ":pre-build command error in \"scratch\" recipe in co...")
  signal(error (":pre-build command error in \"scratch\" recipe in co..."))
  error(":pre-build command error in %S recipe in command %..." "scratch" "(\"make\")")
  straight--run-build-commands((:fork (:repo "emacsmirror/scratch") :files (:defaults) :pre-build (("make")) :repo "cbbrowne/scratch-el" :host github :package "scratch" :type git :local-repo "scratch-el"))
  straight--build-package((:fork (:repo "emacsmirror/scratch") :files (:defaults) :pre-build (("make")) :repo "cbbrowne/scratch-el" :host github :package "scratch" :type git :local-repo "scratch-el") nil)
  #f(compiled-function () #<bytecode 0x1594ecb3788d>)()
  straight--transaction-exec(use-package-\"8c34eb97d3c77d86c2419a55c61ad643\"-nil-nil :now #f(compiled-function () #<bytecode 0x1594ecb3788d>))
  straight-use-package((scratch :fork (:repo "emacsmirror/scratch")))
  (progn (straight-use-package '(scratch :fork (:repo "emacsmirror/scratch"))) (defvar use-package--warning307 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning 'use-package msg :error)))) (condition-case err (progn (if (fboundp 'scratch) nil (autoload #'scratch "scratch" nil t)) (let* ((name "C-c b S") (key "\3bS") (kmap (or (if ... ... nil) global-map)) (kdesc (cons (if ... name ...) (if ... nil ...))) (binding (lookup-key kmap key))) (let ((entry (assoc kdesc personal-keybindings)) (details (list ... ...))) (if entry (setcdr entry details) (add-to-list 'personal-keybindings (cons kdesc details)))) (define-key kmap key #'scratch))) ((debug error) (funcall use-package--warning307 :catch err))))
  eval((progn (straight-use-package '(scratch :fork (:repo "emacsmirror/scratch"))) (defvar use-package--warning307 #'(lambda (keyword err) (let ((msg ...)) (display-warning 'use-package msg :error)))) (condition-case err (progn (if (fboundp 'scratch) nil (autoload #'scratch "scratch" nil t)) (let* ((name "C-c b S") (key "\3bS") (kmap (or ... global-map)) (kdesc (cons ... ...)) (binding (lookup-key kmap key))) (let ((entry ...) (details ...)) (if entry (setcdr entry details) (add-to-list ... ...))) (define-key kmap key #'scratch))) ((debug error) (funcall use-package--warning307 :catch err)))) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

I thought from your explanation here that such a recipe will default to inherit all the information from the upstream recipe that it doesn't override but it seems the :repo keyword is not overridden or am I misunderstanding the backtrace?

Thanks for your time and this package.

progfolio commented 1 year ago
`(scratch :type git :host github :repo "cbbrowne/scratch-el" :pre-build ,(cl-letf (((symbol-function #'el-get-package-directory) (lambda (package) (straight--repos-dir (format "%S" package)))) (el-get-install-info (straight--el-get-install-info)) (el-get-emacs (straight--emacs-path)) (el-get-dir (straight--repos-dir))) (pcase system-type (_ `(("make"))))) :files (:defaults))

That recipe is from the el-get recipe repository, not MELPA. It looks like the el-get recipe hasn't been updated, either:

https://github.com/dimitri/el-get/blob/84dd1837f9ac80a329ab0c2de6859777f445f8ff/recipes/scratch.rcp

doolio commented 1 year ago

Firstly, thank you for the quick response. That explains one thing. The default value of straight-recipe-repositories is:

(org-elpa melpa gnu-elpa-mirror nongnu-elpa el-get emacsmirror-mirror)

So doesn't the melpa recipe have precedence and so should be used first?

(FYI, the README here is out of date.)

progfolio commented 1 year ago

So doesn't the melpa recipe have precedence and so should be used first?

If that value of straight-recipe-repositories was used when initially cloning the repository, yes. That's also confirmed by running the following test case (which unfortunately does not finish at the moment because codeberg.org is down at the moment, but uses the MELPA recipe):

Test Case ```emacs-lisp (straight-bug-report :post-bootstrap (message "scratch: %S\n" (straight-recipes-retrieve 'scratch)) (straight-use-package 'scratch)) ```
Output ```emacs-lisp Bootstrapping straight.el... Bootstrapping straight.el...done Looking for gnu-elpa-mirror recipe → Cloning melpa... Looking for gnu-elpa-mirror recipe → Cloning melpa...done Looking for nongnu-elpa recipe → Cloning gnu-elpa-mirror... Looking for nongnu-elpa recipe → Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe → Cloning nongnu-elpa... Looking for emacsmirror-mirror recipe → Cloning nongnu-elpa...done Looking for emacsmirror-mirror recipe → Cloning el-get... Looking for emacsmirror-mirror recipe → Cloning el-get...done Looking for straight recipe → Cloning emacsmirror-mirror... Looking for straight recipe → Cloning emacsmirror-mirror...done Building straight... Building straight...done Test run with version: prerelease (HEAD -> develop, origin/develop) ad1c198 2022-09-22 scratch: (scratch :type git :flavor melpa :files ("scratch.el" "scratch-pkg.el") :host codeberg :repo "emacs-weirdware/scratch") Cloning scratch... ;; test would finish under normal circumstances, but codeberg.org is currently down ```

What may have happened is the el-get recipe was used when you initially installed the package. That recipe was then cached (see straight--recipe-cache, straight--repo-cache, etc) and is being used despite the current value of straight-recipe-repositories.

Have you tried deleting the repository from $REPOS/scratch and $BUILD/scratch and re-installing?

doolio commented 1 year ago

What may have happened is the el-get recipe was used when you initially installed the package. That recipe was then cached (see straight--recipe-cache, straight--repo-cache, etc) and is being used despite the current value of straight-recipe-repositories.

I see. That would make sense. I do recall some time in the long past straight informing me that the URL in the recipe had changed from the original author to the fork but I did find today a commit (linked in my original post) of a melpa commit which would explain that. Perhaps, I gave bad instructions to straight at the time and the recipe cache got corrupted somehow.

Have you tried deleting the repository from $REPOS/scratch and $BUILD/scratch and re-installing?

Yes, several times before opening this issue but to no avail. Any other way to flush the recipe cache?

doolio commented 1 year ago
Test Case ```emacs-lisp (straight-bug-report :post-bootstrap (message "scratch: %S\n" (straight-recipes-retrieve 'scratch)) (straight-use-package 'scratch)) ```
Output ```emacs-lisp Bootstrapping straight.el... Bootstrapping straight.el...done Looking for gnu-elpa-mirror recipe → Cloning melpa... Looking for gnu-elpa-mirror recipe → Cloning melpa...done Looking for nongnu-elpa recipe → Cloning gnu-elpa-mirror... Looking for nongnu-elpa recipe → Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe → Cloning nongnu-elpa... Looking for emacsmirror-mirror recipe → Cloning nongnu-elpa...done Looking for emacsmirror-mirror recipe → Cloning el-get... Looking for emacsmirror-mirror recipe → Cloning el-get...done Looking for straight recipe → Cloning emacsmirror-mirror... Looking for straight recipe → Cloning emacsmirror-mirror...done Building straight... Building straight...done Test run with version: prerelease (HEAD -> develop, origin/develop) ad1c198 2022-09-22 scratch: (scratch :type git :flavor melpa :files ("scratch.el" "scratch-pkg.el") :host codeberg :repo "emacs-weirdware/scratch") Cloning scratch... Cloning scratch...done Building scratch... Building scratch...done Packages: "straight" n/a develop ad1c198 2022-09-22 "org-elpa" n/a n/a "melpa" n/a master 0c8a45f5 2022-10-21 "gnu-elpa-mirror" n/a master 579b9ce 2022-09-29 "nongnu-elpa" n/a main 6d76d3c04b 2022-10-15 "el-get" melpa master 0a9d5684 2022-10-03 "emacsmirror-mirror" n/a master 39e5d16 2022-10-19 "scratch" melpa main f000648 2022-03-19 ```

So your test case does use the melpa receipe to successfully build this package for me also. However, when trying to install this package my straight is still using the el-get recipe. As stated already, I removed the relevant directories from both the repos and build directories. I even nuked the build-cache.el file but to no avail. I'm suffering a similar fate to the spray package which is now hosted on sourcehut. The melpa recipe is correct and the repo up to date but am still using a recipe from when it was hosted on github.

progfolio commented 1 year ago

It's hard to say without seeing your configuration. Are you utilizing the lockfile/profile system? https://github.com/radian-software/straight.el/tree/develop#lockfile-management

doolio commented 1 year ago

Yes, I am. And as a matter of course I update the lockfile after adding or removing a package(s). My configuration for this package is minimal:

(use-package scratch                    ; Mode specific scratch buffers.
  :bind ("C-c b S" . scratch))

The only straight customisations I have are as follows (from my custom file):

(custom-set-variables
 '(straight-check-for-modifications '(check-on-save find-when-checking))
 '(straight-profiles '((nil . "../../pkg-versions.el")))
 '(straight-use-package-by-default t))
doolio commented 1 year ago

This is now happening for more packages namely:

Codeberg

Sourcehut