rozbir: parse, evaluate, edit and lint RPM spec files

[ distribution, gpl, library ] [ Propose Tags ] [ Report a vulnerability ]

rozbir is a pure library for RPM spec files. it parses them into a lossless syntax tree, partially evaluates macros and conditionals without running any shell or Lua, edits them with minimal diffs, and lints them.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1
Change log CHANGELOG.md
Dependencies aeson (>=2.1.2 && <2.4), base (>=4.18 && <4.21), bytestring (>=0.11.5 && <0.13), containers (>=0.6.7 && <0.8), deepseq (>=1.4.8 && <1.6), directory (>=1.3.8 && <1.4), filepath (>=1.4.300 && <1.6), mtl (>=2.3.1 && <2.4), text (>=2.0.2 && <2.2), time (>=1.12.2 && <1.13) [details]
Tested with ghc ==9.6.6 || ==9.10.3
License GPL-3.0-or-later
Author Cypress Reed
Maintainer cypress@fyralabs.com
Uploaded by halfcyan at 2026-11-25T01:15:45Z
Category Distribution
Home page https://github.com/terrapkg/rozbir
Bug tracker https://github.com/terrapkg/rozbir/issues
Source repo head: git clone https://github.com/terrapkg/rozbir.git
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-11-25 [all 1 reports]

Readme for rozbir-0.1.0.1

[back to package description]

rozbir, an RPM spec library for Haskell

розбір is Ukrainian for "parsing."

rozbir parses, evaluates, edits and lints RPM spec files without running anything: no rpmspec, no shell, no Lua. it was written for oglyad, and korektor builds a CLI and language server on it.

import Rozbir
import Rozbir.IO (readSpec)

main :: IO ()
main = do
  tree <- readSpec "foo.spec"
  let target = Target (Just "x86_64") (Just "linux") [("dist", Just ".fc44"), ("fedora", Just "44")]
  print (evr (resolve (newEnv False) target tree))
  print (versionInputs tree)
  • Rozbir.Syntax.Parse.parse is total and lossless: render (parse s) == s
  • Rozbir.Spec.resolve evaluates macros and conditionals. a small pure subset of shell (echo, ${c:0:7}, sed s///, tr, cut) is interpreted, anything else that would run code comes back Opaque, and conditions it can't decide keep both branches. over terrapkg/packages and tuatara it agrees with rpmspec on every spec it can finish, which is 98% of them
  • Rozbir.Query answers the usual questions: name, EVR, sources, patches, bconds, BuildRequires, and which macros feed Version:
  • Rozbir.Edit sets tags and macros, bumps Release and adds changelog entries as minimal text edits
  • Rozbir.Lint runs the core, rpmlint and (opt-in) terra rulesets. a comment like # rozbir: ignore[hardcoded-path] reason suppresses a finding on the next line, and # rozbir: ignore-file[rule] for the whole spec

development

cabal build all --enable-tests
cabal test --test-show-details=direct
ormolu --mode inplace $(git ls-files '*.hs')
dev/differential.sh <(find ../packages -name '*.spec' -printf '%p\n' | xargs realpath)

license

this project is licensed under GPL-3.0-or-later. see LICENSE.md.