Skip to content

[fix] tsc-dyn-get--recorded-version: support new DYN-VERSION syntax #249

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

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

domq
Copy link
Contributor

@domq domq commented Jan 5, 2023

Previously, a tree-sitter DYN-VERSION file used to look like this:

0.18.0
(with no final newlines). Now it may look like this:
emacs-tree-sitter@0.18.0
(still sans final newlines).

In tsc-dyn-get--recorded-version, support both formats by erasing everything up to and including first @

dancewhale added a commit to dancewhale/elisp-tree-sitter that referenced this pull request Apr 9, 2023
tsc-dyn-get--recorded-version: support new DYN-VERSION syntax emacs-tree-sitter#249

Previously, a tree-sitter DYN-VERSION file used to look like this:

0.18.0
(with no final newlines). Now it may look like this:
emacs-tree-sitter@0.18.0
(still sans final newlines).
In tsc-dyn-get--recorded-version, support both formats by erasing everything up to and including first @
@domq
Copy link
Contributor Author

domq commented May 8, 2023

Hello @ubolonton, would you be so kind as to approve this pull request?

@getong
Copy link

getong commented Dec 5, 2023

@jcs090218
Would you merge this pr, I have the same error msg.

[2023-12-06T05:52:12.737495] tsc-dyn-get: Using source :compilation (:loaded nil :recorded emacs-tree-sitter@0.18.0 :requested 0.18.0)
[2023-12-06T05:52:12.749085] Could not get ‘tsc-dyn’: (error Invalid version syntax: ‘emacs-tree-sitter@0.18.0’ (must start with a number))

@jcs090218
Copy link
Member

This makes sense to me! Thank you to everyone who participated in this bug!

@jcs090218 jcs090218 merged commit 3e1e06d into emacs-tree-sitter:master Dec 5, 2023
@getong
Copy link

getong commented Dec 5, 2023

how about making a new tag?

@jcs090218
Copy link
Member

It seems like there is an error with our release pipeline. I will try to fix it ASAP. 🤔

@ubolonton
Copy link
Collaborator

ubolonton commented Dec 9, 2023

This is a version:

0.18.0

This is not:

emacs-tree-sitter@0.18.0

Please fix the things that write incorrect data into DYN-VERSION instead.

This file is also updated by tsc-dyn-get--github.

ubolonton added a commit that referenced this pull request Mar 17, 2024
vincentkam pushed a commit to vincentkam/elisp-tree-sitter that referenced this pull request Apr 22, 2024
This change allows the package to work on Emacs on Android +
termux.

Users will still need to manually install the required termux
packages.

Additionally, the DYN-VERSION file in the `tsc` package (in
`.emacs.d/elpa/tsc-[version]/` ) may need to be manually modified to
conform to the expected format--e.g. from `emacs-tree-sitter@0.18.0`
to `0.18.0` (see
emacs-tree-sitter#249 for
more info).

Finally, a change to `tree-sitter-langs` package is also needed for
things to work locally.
vincentkam pushed a commit to vincentkam/elisp-tree-sitter that referenced this pull request Apr 22, 2024
This change allows the package to work on Emacs on Android +
termux.

Users will still need to manually install the required termux
packages.

Additionally, the DYN-VERSION file in the `tsc` package (in
`.emacs.d/elpa/tsc-[version]/` ) may need to be manually modified to
conform to the expected format--e.g. from `emacs-tree-sitter@0.18.0`
to `0.18.0` (see
emacs-tree-sitter#249 for
more info).

Finally, a change to `tree-sitter-langs` package is also needed for
things to work locally (see
emacs-tree-sitter/tree-sitter-langs#563).
@meedstrom
Copy link

meedstrom commented Apr 23, 2024

@jcs090218 I have no familiarity with this codebase, but I would actually suggest to change the code that asks cargo for the version to write to DYN-VERSION in the first place. Then everything should be correct from the beginning.

This function:

(defun tsc-dyn-get--build-version ()
  "Return the dynamic module's version after asking 'cargo'."
  (thread-first (shell-command-to-string "cargo pkgid")
    string-trim
    (split-string "\[#:\]")
    last car))

For the split-string, just add a @.

(defun tsc-dyn-get--build-version ()
  "Return the dynamic module's version after asking 'cargo'."
  (thread-first (shell-command-to-string "cargo pkgid")
    string-trim
    (split-string "\[#@:\]")
    last car))

Then this PR can be reverted, resulting in fewer s-exps.

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

Successfully merging this pull request may close these issues.

5 participants