Modernizace nástrojů pro RPM spec soubory

Prototyp jazykového serveru

Dan Čermák

  LinuxDays.cz 2024

CC BY 4.0

who -u

Dan Čermák

Software Developer @SUSE, SLE BCI releng
i3 SIG, Package maintainer
Developer Tools, Testing and Documentation, Home Automation
https://dancermak.name
dcermak
@Defolos@mastodon.social

What is a Language Server?

with a Language Server:

RPM Spec Files

  • m4 inspired macro language
  • no AST, processed & executed during build

Why?

  • Editor plugins simplistic & inconsistent
  • I want a real IDE for spec files

Building the LSP

Features

  • autocompletion using your system macros + spec sections
  • expand macros on hover
  • jump to definition for macros
  • breadcrumbs
  • experimental container mode

Demo!

Jump to Definition

  • specfile gives you origin of a macro
  • use regex searches:
    • in spec
    • in %_rpmmacrosdir
    • use autogenerated Provides: rpm_macro($name)

Container Mode

  • ship server in container images

Demo!

Challenges

  • hidden global state
  • in memory storage required
  • parsing errors are un-recoverable
  • editors are weird
  • macros are OS dependent

Roadmap

  • improve container mode
  • investigate tree-sitter integration
  • better parser
  • integration with bash-lsp
  • commands to build RPMs
  • syntax highlighting
  • better testing
  • publish the VSCode extension
  • your idea here!

💙 Thank you 💚

  • Matěj Cepl
  • Maxwell G
  • Jakub Kadlčik
  • Dmitri Popov
  • Jehan Singh
  • Danilo Spinella
  • and all the testers

Links

github.com/dcermak/rpm-spec-language-server

dcermak.github.io/rpm-spec-language-server-presentation

Questions?

Answers!