Bug 2318053 - Review Request: rust-tree-sitter-bash - Bash grammar for tree-sitter
Summary: Review Request: rust-tree-sitter-bash - Bash grammar for tree-sitter
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Michel Lind
QA Contact: Fedora Extras Quality Assurance
URL: https://crates.io/crates/tree-sitter-...
Whiteboard:
Depends On: 2321682
Blocks: FE-NEEDSPONSOR 2310209 2333626
TreeView+ depends on / blocked
 
Reported: 2024-10-11 15:22 UTC by solomoncyj
Modified: 2025-03-15 00:27 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-03-02 02:19:00 UTC
Type: ---
Embargoed:
michel: fedora-review+


Attachments (Terms of Use)

Description solomoncyj 2024-10-11 15:22:19 UTC
Spec URL: https://download.copr.fedorainfracloud.org/results/solomoncyj/rust/fedora-40-x86_64/08125636-rust-tree-sitter-bash/rust-tree-sitter-bash.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/solomoncyj/rust/fedora-40-x86_64/08125636-rust-tree-sitter-bash/rust-tree-sitter-bash-0.23.1-1.fc40.src.rpm
Description: Tree-sitter Language type, used by the library and by language implementations
Fedora Account System Username: solomoncyj

Reproducible: Always

Comment 1 solomoncyj 2024-10-25 13:09:36 UTC
Spec URL: https://download.copr.fedorainfracloud.org/results/solomoncyj/rust/fedora-rawhide-x86_64/08175084-rust-tree-sitter-bash/rust-tree-sitter-bash.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/solomoncyj/rust/fedora-rawhide-x86_64/08175084-rust-tree-sitter-bash/rust-tree-sitter-bash-0.23.1-1.fc42.src.rpm
Description: Tree-sitter Language type, used by the library and by language implementations
Fedora Account System Username: solomoncyj

Reproducible: Always

Comment 2 Fedora Review Service 2024-10-25 13:12:19 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/8175131
(failed)

Build log:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2318053-rust-tree-sitter-bash/fedora-rawhide-x86_64/08175131-rust-tree-sitter-bash/builder-live.log.gz

Please make sure the package builds successfully at least for Fedora Rawhide.

- If the build failed for unrelated reasons (e.g. temporary network
  unavailability), please ignore it.
- If the build failed because of missing BuildRequires, please make sure they
  are listed in the "Depends On" field


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 3 Peter Oliver 2024-11-01 12:09:21 UTC
Can/should this be built directly from the source rather than the crate, in such a way that the same source package outputs subpackages for both the C and Rust bindings (and, potentially, other languages too, such as Python and JavaScript)?

I have suggested some RPM macros to help build C bindings (https://src.fedoraproject.org/rpms/tree-sitter/pull-request/1).  We could enhance that to cover Rust too, if someone interested in Rust could work out that part of the recipe.

Comment 4 Cristian Le 2024-11-03 09:58:10 UTC
(In reply to Peter Oliver from comment #3)
> Can/should this be built directly from the source rather than the crate, in
> such a way that the same source package outputs subpackages for both the C
> and Rust bindings (and, potentially, other languages too, such as Python and
> JavaScript)?

I don't think that is advisable because each packaging environment have their own workflow and even in this package the build artifacts for each one is different. Synchronizing the versions across a `rust-tree-sitter-bash` and `python-tree-sitter-bash` would indeed be advisable, but probably we can use a different tooling for that.

> I have suggested some RPM macros to help build C bindings
> (https://src.fedoraproject.org/rpms/tree-sitter/pull-request/1).  We could
> enhance that to cover Rust too, if someone interested in Rust could work out
> that part of the recipe.

Unfortunately those have a strong assumption that the packaging project is using Makefile, but that would be incompatible with building the rust or python package. Do you have example projects that could be using that?

Comment 5 Peter Oliver 2024-11-03 23:34:39 UTC
[fedora-review-service-build]

Comment 6 Fedora Review Service 2024-11-03 23:41:05 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/8206505
(succeeded)

Review template:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2318053-rust-tree-sitter-bash/fedora-rawhide-x86_64/08206505-rust-tree-sitter-bash/fedora-review/review.txt

Found issues:

- No gcc, gcc-c++ or clang found in BuildRequires
  Read more: https://docs.fedoraproject.org/en-US/packaging-guidelines/C_and_C++/

Please know that there can be false-positives.

---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 7 Peter Oliver 2024-11-04 00:20:35 UTC
(In reply to Cristian Le from comment #4)
> (In reply to Peter Oliver from comment #3)
> > Can/should this be built directly from the source rather than the crate, in
> > such a way that the same source package outputs subpackages for both the C
> > and Rust bindings (and, potentially, other languages too, such as Python and
> > JavaScript)?
> 
> I don't think that is advisable because each packaging environment have
> their own workflow

I don't think that presents a problem.  See https://src.fedoraproject.org/rpms/tree-sitter-java/blob/rust/f/tree-sitter-java.spec for a spec file that builds binding for Rust as well as C and Python.  I don't know anything about Rust, but the package seems to build okay at least.

> > I have suggested some RPM macros to help build C bindings
> > (https://src.fedoraproject.org/rpms/tree-sitter/pull-request/1).  We could
> > enhance that to cover Rust too, if someone interested in Rust could work out
> > that part of the recipe.
> 
> Do you have example projects that could be using that?

Here's an example spec file:

---
Name:           tree-sitter-c
Version:        0.21.4

%global libname lib%{name}
%global summary C grammar for Tree-sitter
%global desc    Add support for C to Tree-sitter, an incremental parsing system for \
programming tools.


Release:        %autorelease
Summary:        %{summary}
License:        MIT
URL:            https://github.com/tree-sitter/%{name}

Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildSystem:    treesitter

%description
%{desc}


%package -n %{libname}
Summary:        %{summary}
Recommends:     libtree-sitter
Enhances:       libtree-sitter

%description -n %{libname}
%{desc}


%package -n %{libname}-devel
Summary:        Development files for %{libname}
Requires:       %{libname}%{?_isa} = %{version}-%{release}

%description -n %{libname}-devel
Libraries and header files for developing applications that use
%{name}.


%{?ldconfig_scriptlets}


%files -n %{libname}
%license LICENSE
%doc README.md
%{_libdir}/%{libname}.so.*

%files -n %{libname}-devel
%{_includedir}/tree_sitter/%{name}.h
%{_libdir}/%{libname}.so
%{_libdir}/pkgconfig/%{name}.pc


%changelog
%autochangelog
---

Comment 8 Fabio Valentini 2024-11-04 11:54:57 UTC
> I don't think that presents a problem.  See https://src.fedoraproject.org/rpms/tree-sitter-java/blob/rust/f/tree-sitter-java.spec for a spec file that builds binding for Rust as well as C and Python.  I don't know anything about Rust, but the package seems to build okay at least.

This package is in violation of the Rust Packaging Guidelines, notably:

> Projects from crates.io MUST be packaged from the sources that are published there (i.e. by using the %{crates_source} macro).

https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_package_sources

The exception from this section might apply, but I am surprised that this hasn't been discussed with the Rust SIG at all.

https://docs.fedoraproject.org/en-US/packaging-guidelines/Rust/#_crates_with_rust_library_interface

Comment 9 Cristian Le 2024-11-04 13:33:34 UTC
To elaborate on the rust packaging, it is quite difficult to maintain a package without running `rust2rpm` and then if you want to add other bindings like python and go, then the packaging becomes even more complicated to satisfy each packaging guidelines simultaneously. For example for rust packaging the whole repo source must be packaged for re-distribution since it works like a header-only library, but then we would have to filter out all of the bindings from the other languages.

What your `BuildSystem` approach would be useful for though is for distributing the C (and/or C++?) libraries as you are doing with the snippet you've shared. But I have one recommendation. Instead of using the Makefile, please use the CMake build system because that also generates the <Pkg>Config.cmake files needed to be imported by other CMake/meson projects.

Comment 10 Peter Oliver 2024-11-05 00:36:06 UTC
(In reply to Cristian Le from comment #9)
> To elaborate on the rust packaging, it is quite difficult to maintain a
> package without running `rust2rpm`

Does the resulting .spec vary much from one Tree-sitter parser to another?

> and then if you want to add other
> bindings like python and go, then the packaging becomes even more
> complicated to satisfy each packaging guidelines simultaneously.

Assuming we want the bindings for multiple languages, is it really harder to do this in a single spec file rather than artificially splitting it over multiple source packages?

I think if we can get this right once, and make a suitable template, we can save a lot of effort in the long run.

> For example
> for rust packaging the whole repo source must be packaged for
> re-distribution since it works like a header-only library, but then we would
> have to filter out all of the bindings from the other languages.

I don't think this is true.  Calling %cargo_install on the source code fetched from GitHub does the right thing AFAICT.

> But I have one recommendation. Instead of using the Makefile,
> please use the CMake build system because that also generates the
> <Pkg>Config.cmake files needed to be imported by other CMake/meson projects.

Sounds good, but that appears to be a new feature of tree-sitter released only last month that we don't have in Fedora yet, and that not all parsers so-far support (ironically, tree-sitter-cmake included).

Comment 11 Peter Oliver 2024-11-05 00:38:41 UTC
(In reply to Fabio Valentini from comment #8)

> The exception from this section might apply,

That was my reading, yes.

> but I am surprised that this hasn't been discussed with the Rust SIG at all.

I think Tree-sitter parser packaging would probably benefit from some discussion more generally.  I'll put together a proof of concept and post about it.

Comment 12 Peter Oliver 2024-11-05 13:31:16 UTC
(In reply to Peter Oliver from comment #11)

> I think Tree-sitter parser packaging would probably benefit from some
> discussion more generally.  I'll put together a proof of concept and post
> about it.

I've asked about this on the Packaging mailing list. https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/X3B2MYPPSWBGWRFD7K62NNLIMIL3O56F/

Comment 13 Peter Oliver 2025-01-06 16:26:51 UTC
There was a lack on enthusiasm for the idea of packaging bindings for multiple languages from a common source.  This could be down to a lack of interest in Tree-sitter in general, but, in any case, let’s go ahead without it for now.

Would you like to swap this review for any of those listed at https://bugzilla.redhat.com/buglist.cgi?bug_id=2258924&bug_id_type=anddependson&bug_status=NEW&columnlist=product%2Ccomponent%2Cassigned_to%2Cbug_status%2Cshort_desc%2Cchangeddate%2Cbug_severity&component=Package%20Review&list_id=13541136&order=status%2C%20assigned_to%2C%20id%2C%20&product=Fedora&query_format=advanced ?

Comment 14 Michel Lind 2025-01-30 09:51:57 UTC
I need it for difftastic, and did not realize there is this review request until I was about to submit mine (sorry!)

I put up a PR to have upstream include the license file - https://github.com/tree-sitter/tree-sitter-bash/pull/286

Package was generated with rust2rpm, simplifying the review.

- package builds and installs without errors on rawhide
- test suite is run and all unit tests pass
! latest version of the crate is packaged
  => please update to 0.23.3 when importing
- license matches upstream specification (MIT) and is acceptable for Fedora
- license file is included with %license in %files
- package complies with Rust Packaging Guidelines

Package APPROVED.

===

Recommended post-import rust-sig tasks (use `fedora-sig-onboard onboard rust-$crate` to automate):

- add @rust-sig with "commit" access as package co-maintainer
  (should happen automatically)

- set bugzilla assignee overrides to @rust-sig (optional)

- set up package on release-monitoring.org:
  project: $crate
  homepage: https://crates.io/crates/$crate
  backend: crates.io
  version scheme: semantic
  version filter: alpha;beta;rc;pre
  distro: Fedora
  Package: rust-$crate

- track package in koschei for all built branches
  (should happen automatically once rust-sig is co-maintainer)

Comment 15 Fedora Admin user for bugzilla script actions 2025-02-01 09:17:18 UTC
The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-tree-sitter-bash

Comment 16 Fedora Update System 2025-02-21 04:06:29 UTC
FEDORA-2025-77f48bda55 (rust-tree-sitter-bash-0.23.3-8.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-77f48bda55

Comment 17 Fedora Update System 2025-02-21 04:06:30 UTC
FEDORA-2025-057be36c81 (rust-tree-sitter-bash-0.23.3-8.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-057be36c81

Comment 18 Fedora Update System 2025-02-22 02:27:00 UTC
FEDORA-2025-77f48bda55 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf install --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-77f48bda55 \*`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-77f48bda55

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 19 Fedora Update System 2025-02-22 02:49:23 UTC
FEDORA-2025-057be36c81 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf install --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-057be36c81 \*`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-057be36c81

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 20 Fedora Update System 2025-02-22 03:17:13 UTC
FEDORA-2025-d985ff519b has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf install --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-d985ff519b \*`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-d985ff519b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 21 Fedora Update System 2025-03-02 02:19:00 UTC
FEDORA-2025-77f48bda55 (rust-tree-sitter-bash-0.23.3-8.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 22 Fedora Update System 2025-03-02 02:48:51 UTC
FEDORA-2025-057be36c81 (rust-tree-sitter-bash-0.23.3-8.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2025-03-15 00:27:29 UTC
FEDORA-2025-d985ff519b (rust-tree-sitter-bash-0.23.3-8.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.