[Fedora-packaging] Packaging Tree-sitter parsers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a couple of questions regarding packaging Tree-sitter parsers for Fedora.

Some background.  Tree-sitter is a library for writing parsers for source code, for use in, for example, syntax highlighters and text editors.  Nearly 500 different parsers are available separately (https://github.com/tree-sitter/tree-sitter/wiki/List-of-parsers).  However, we only have one of them packaged for Fedora so far.

Official bindings are available for using the parsers from a number of languages (https://tree-sitter.github.io/tree-sitter/#language-bindings).  The Tree-sitter project has tooling to automatically generate these bindings, which are committed to the Git repository of each parser.  On release, the bindings are uploaded to the native repository for each language (i.e., crates.io for Rust, pypi.org for Python, etc.).

First question.  Should we be building all bindings we care about for a parser from a single SRPM (using the upstream source code), rather than making a bunch of duplicate SRPMs (one for each language, from the language-specific releases)?  I think a single SRPM per parser makes more sense, but it does have the drawback of making the .spec files more complicated, and prevents us from generating them with, say, rust2rpm.

This brings me to my second question.  Spec files for different Tree-sitter parsers are pretty-much identical to each other, so should we generate them using macros?

Iʼve put together some draft macros (https://src.fedoraproject.org/rpms/tree-sitter/pull-request/1#request_diff), and built them into a tree-sitter-srpm-macros package (https://copr.fedorainfracloud.org/coprs/mavit/tree-sitter/).  Here is an example complete spec file using these macros:

```
Name:           tree-sitter-c
Version:        0.21.4
Release:        %autorelease
License:        MIT
URL:            https://github.com/tree-sitter/%{name}
Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
BuildSystem:    treesitter

%{treesitter -l C}

%changelog
%autochangelog
```

Iʼm sure the macros are in need of review, but does this seem like a generally good approach?

--
Peter Oliver
-- 
_______________________________________________
packaging mailing list -- packaging@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to packaging-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/packaging@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux