Metadata-Version: 2.4
Name: cr2rpm
Version: 0.2.0
Summary: Generate RPM spec files from Crystal shard.yml
Author-email: Renich Bon Ćirić <renich@woralelandia.com>
License: GPL-3.0-or-later
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.9
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: pyyaml>=6.0
Requires-Dist: jinja2>=3.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: flake8>=6.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: build>=0.10; extra == "dev"
Dynamic: license-file

cr2rpm - Crystal to RPM Spec Generator
======================================

``cr2rpm`` is an automated tool for generating RPM spec files from Crystal ``shard.yml`` files, similar to ``go2rpm`` or ``rust2rpm``. It is specifically designed to support the **Shard-as-RPM** model required by Fedora.

Features
--------

* **Spec Generation**: Automates the creation of Fedora-compliant spec files.
* **Dependency Analysis**: Provides recursive dependency resolution and build order mapping.
* **Requires Inspection**: Discovers system C libraries (`@[Link]`), stdlib C dependencies, and test requires.
* **Metadata Extraction**: Supports macro-level metadata extraction (version, license, etc.).
* **Fedora Compliance**: Maps shard dependencies to ``BuildRequires: crystal-shard(name)``.

Installation
------------

Install from source in development mode:

::

    cd tools/cr2rpm
    pip install -e .

Usage
-----

**Generate a spec file from a local directory:**

::

    cr2rpm generate --path ./my-shard

**Inspect source files for C libraries and test requirements:**

::

    cr2rpm inspect --path ./my-shard --format rpm

**Analyze dependencies and build order:**

::

    # List recursive dependency tree
    cr2rpm deps --path ./my-shard --format tree

    # Generate mock chain build command
    cr2rpm deps --path ./my-shard --format mock

**Extract specific metadata for macros:**

::

    cr2rpm metadata --field version --format rpm

Commands
--------

* ``generate``: Creates the RPM spec file.
* ``inspect``: Inspects source files and metadata for system C and check-time dependencies.
* ``deps``: Resolves recursive dependencies from ``shard.lock``.
* ``metadata``: Extracts specific fields for use in RPM macros or scripts.

Resources
---------

* `Packaging Guidelines <https://codeberg.org/renich/crystal-in-fedora/src/branch/master/guidelines/Crystal.adoc>`_: Detailed context on Crystal packaging in Fedora.
* `macros/ <https://codeberg.org/fedora-crystal/crystal-rpm-macros>`_: RPM macros that integrate with ``cr2rpm``.

License
-------

GNU General Public License v3 or later (GPL-3.0-or-later).
