Skip to content

Latest commit

Β 

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

flatpak2spec

Build COPR Build Status Latest Release License SSH Signatures

flatpak2spec is a fast, robust Rust CLI tool designed to inspect Flatpak application repositories (or remote URLs) and automatically generate idiomatic Fedora RPM .spec files. By parsing Flatpak manifests (JSON/YAML), AppStream metadata, and build configurations, it bridges the gap between containerized app specs and native RPM packagingβ€”optimizing the output out-of-the-box for Fedora Copr, GitHub Actions, and online CI pipelines.

Important

Build System Support: flatpak2spec currently supports Flatpak manifests that utilize the Meson build system (buildstream / meson build options). Support for Cargo, CMake, and Autotools build systems is planned for future releases.

✨ Features

  • πŸš€ Remote & Local Workspace Inspection: Supports direct workspace parsing from local filesystem directories or remote repositories on GitHub, GitLab, and Codeberg.
  • πŸ“¦ Manifest & Metadata Parsing: Inspects Flatpak JSON/YAML manifests, AppStream metadata (.metainfo.xml), and Meson project configurations (meson.build).
  • πŸ“ Changelog & Release Notes Extraction: Automatically parses project changelogs and release notes to populate the RPM %changelog section cleanly.
  • 🏷️ Smart Version & Forge Detection: Queries remote forge tags to determine the latest semantic release version, handles URL prefixes (v1.0 vs 1.0), and formats accurate %forgesetup or Source0 download links.
  • πŸ”„ Automatic Submodule Handling: Detects .gitmodules within target repositories and emits Git fetching logic in %prep to streamline online CI archive builds.
  • πŸ› οΈ Idiomatic Spec Output: Leverages modern Fedora packaging macros (%meson, %meson_build, %find_lang) and %check validation steps (desktop-file-validate, appstream-util).
  • ⚑ Copr & CI-Ready: Built specifically for automated online build environments such as Fedora Copr (with internet enabled), GitHub Actions, and mock chroots.
  • 🎯 Noarch Detection: Automatically detects asset-only or script projects to emit BuildArch: noarch when appropriate.

Note

Build Environment Compatibility: Spec files generated by flatpak2spec are designed for online, automated build environments (such as Fedora Copr with network access enabled, GitHub Actions, or local mock chroots with network enabled).

Because these specs fetch missing Git submodules during %prep over the network, they are not directly intended for official Fedora Koji submission, which strictly requires offline/network-isolated builds and pre-bundled source archives.

πŸ“₯ Installation

πŸ“¦ Fedora / RHEL (Fedora Copr)

The easiest way to install and stay updated on Fedora or Enterprise Linux systems is via Copr:

  1. Enable the Copr repository

    sudo dnf copr enable infiniti151/flatpak2spec
  2. Install flatpak2spec

    sudo dnf install flatpak2spec

πŸš€ Pre-compiled Binaries (GitHub Releases)

If you prefer not to install via package manager or are running a non-RPM Linux distribution, grab the latest pre-compiled release binary tarball and its corresponding .sig signature for your architecture (x86_64 or aarch64):

  1. Download tarball and .sig

    # Fetch the latest release tag dynamically
    TAG=$(curl -sI https://github.com/Infiniti151/flatpak2spec/releases/latest | grep -i "^location:" | awk -F'/' '{print $NF}' | tr -d '\r')
    
    # Download the tarball and signature for your machine architecture
    curl -LO "https://github.com/Infiniti151/flatpak2spec/releases/download/${TAG}/flatpak2spec-${TAG#v}-$(uname -m).tar.gz"
    curl -LO "https://github.com/Infiniti151/flatpak2spec/releases/download/${TAG}/flatpak2spec-${TAG#v}-$(uname -m).tar.gz.sig"
  2. Verification

    • Verify SSH signature

      # Create an ephemeral allowed signers file for verification
      echo "43163551+Infiniti151@users.noreply.github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILTdQcJHfsMenp/k1A6ANxCqDJKvj3wp1d+7wSQCYwSU" > /tmp/allowed_signers
      
      # Verify the signature against the release archive
      ssh-keygen -Y verify -f /tmp/allowed_signers -I 43163551+Infiniti151@users.noreply.github.com -n file -s flatpak2spec-*.tar.gz.sig < flatpak2spec-*.tar.gz

      A successful output will read:

      Good "file" signature for 43163551+Infiniti151@users.noreply.github.com with ED25519 key SHA256:5zeSTkU1qsZrkkCW4w2TKlD61J9eTihMPVx6lhgL92M`
    • Verify build attestation (needs GitHub CLI installed)

      gh attestation verify --owner Infiniti151 flatpak2spec-*.tar.gz

      A successful output will read:

      The following policy criteria will be enforced:
      - Predicate type must match:................ https://slsa.dev/provenance/v1
      - Source Repository Owner URI must match:... https://github.com/Infiniti151
      - Subject Alternative Name must match regex: (?i)^https://github\.com/Infiniti151/
      - OIDC Issuer must match:................... https://token.actions.githubusercontent.com
      
      βœ“ Verification succeeded!
      
      The following 1 attestation matched the policy criteria
      
      - Attestation #1
      - Build repo:..... Infiniti151/flatpak2spec
      - Build workflow:. .github/workflows/release.yml@refs/heads/main
      - Signer repo:.... Infiniti151/flatpak2spec
      - Signer workflow: .github/workflows/release.yml@refs/heads/main
      
  3. Extract the release tarball

    tar -xzf flatpak2spec-*.tar.gz
  4. Make executable and move to /usr/local/bin

    chmod +x flatpak2spec
    sudo mv flatpak2spec /usr/local/bin/
    rm flatpak2spec*

πŸ› οΈ Manual Build (From Source)

Ensure you have Rust and Cargo installed, then build directly from source:

git clone https://github.com/Infiniti151/flatpak2spec.git
cd flatpak2spec
cargo build --release

The compiled binary will be available at target/release/flatpak2spec or $CARGO_TARGET_DIR/release/flatpak2spec (if you've set $CARGO_TARGET_DIR).

πŸ’» Usage

flatpak2spec [OPTIONS] --repo <PATH_OR_URL>

Options:
  -r, --repo <PATH_OR_URL>   Path or URL to the Flatpak application repository
  -b, --bug-url <URL>        Bug tracker URL for the BugURL spec field (optional)
  -p, --packager <PACKAGER>  Packager name for the %changelog section (optional)
  -e, --email <EMAIL>        Packager email for the %changelog section (optional)
  -o, --output <FILE>        Optional output file path (defaults to stdout if omitted)
  -v, --verbose...           Enable verbose logging output
  -h, --help                 Print help
  -V, --version              Print version

πŸ“„ Generated Spec File

Command:

flatpak2spec -b https://github.com/Infiniti151/flatpak-apps -p Infiniti151 -e 43163551+Infiniti151@users.noreply.github.com -r https://gitlab.com/mission-center-devs/mission-center

Output:

%global         app_id        io.missioncenter.MissionCenter
%global         forgeurl      https://gitlab.com/mission-center-devs/mission-center
%global         tag           v%{version}

Name:           missioncenter
Version:        1.2.0
Release:        1%{?dist}
Summary:        Monitor system resource usage
License:        GPL-3.0-or-later
BugURL:         https://github.com/Infiniti151/flatpak-apps

%forgemeta

URL:            %{forgeurl}
Source0:        %{forgesource}

BuildRequires:  meson >= 0.63.0
BuildRequires:  ninja-build
BuildRequires:  blueprint-compiler
BuildRequires:  cargo
BuildRequires:  cargo-rpm-macros
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  forge-srpm-macros
BuildRequires:  gcc
BuildRequires:  gettext
BuildRequires:  glib2-devel
BuildRequires:  glibc-langpack-en
BuildRequires:  gtk-update-icon-cache
BuildRequires:  libappstream-glib
BuildRequires:  patch
BuildRequires:  pkgconfig(gbm)
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  python3-devel
BuildRequires:  rustc

Requires:       gtk4
Requires:       hicolor-icon-theme
Requires:       libadwaita

%description
Monitor your CPU, Memory, Disk, Network and GPU usage, accompanied by a per app and process breakdown of these statistics

Features:
- Monitor overall or per-thread CPU usage
- See system process, thread, and handle count, uptime, clock speed (base and current), cache sizes
- Monitor RAM and Swap usage
- See a breakdown how the memory is being used by the system
- Monitor Disk utilization and transfer rates
- Monitor network utilization and transfer speeds
- See network interface information such as network card name, connection type (Wi-Fi or Ethernet), wireless speeds and frequency, hardware address, IP address
- Monitor overall GPU usage, video encoder and decoder usage, memory usage and power consumption, powered by the popular NVTOP project
- Monitor system fans
- See a breakdown of resource usage by app and process
- Supports a minified summary view for simple monitoring
- Use hardware accelerated rendering for all the graphs in an effort to reduce CPU and overall resource usage
- Uses GTK4 and Libadwaita
- Written in Rust

Limitations (there is ongoing work to overcome all of these):
- Intel GPU monitoring is only supported for Broadwell and later GPUs; and does not support VRAM, power, or temperature monitoring
- When using Linux Mint/Cinnamon, launched applications may not show up in the "Applications" section (Upstream issue: https://github.com/linuxmint/cinnamon/issues/12015)

Comments, suggestions, bug reports and contributions welcome

%prep
%forgesetup

# Re-initialize git context for forge tarballs to resolve submodules
if [ ! -d ".git" ]; then
        git init -q
        git remote add origin %{forgeurl}
        git fetch -q --depth 1 origin %{tag}
        git checkout -q -f FETCH_HEAD
fi
git submodule update --init --recursive

%build
%meson
%meson_build

%install
%meson_install
%find_lang %{name}

%check
%meson_test
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.metainfo.xml
glib-compile-schemas --dry-run --strict %{buildroot}%{_datadir}/glib-2.0/schemas/

%files -f %{name}.lang
%license COPYING
%doc README.md
%{_bindir}/%{name}
%{_bindir}/%{name}-magpie
%{_datadir}/%{name}
%{_datadir}/applications/%{app_id}.desktop
%{_datadir}/icons/hicolor/*/apps/%{app_id}*
%{_datadir}/glib-2.0/schemas/*.gschema.xml
%{_metainfodir}/%{app_id}.metainfo.xml

%changelog
* Sat Aug 01 2026 Infiniti151 <43163551+Infiniti151@users.noreply.github.com> - 1.2.0-1
- Noteworthy changes:
- Add a new Battery page to the Performance tab, with charge graphs and detailed battery information (@jlo62)
- Show per-partition usage details on the disk page, including used and free space (@jojo2357)
- Overhaul the graphing backend: smoother animations and rendering, a new loading shimmer while data loads, and less stuttering on application startup (@jojo2357, @kicsyromy)
- Improve application detection, fixing wrong names and icons, phantom entries for PWAs, and constantly cycling processes (@kicsyromy)
- Improvements to the Snap package, which was upgraded to the core24 snap (@kicsyromy)
- Improvements to the AppImage package which now uses quick-sharun, is smaller and no longer depends on FUSE (@kicsyromy)
- Minor features:
- Add a second CPU graph that can show temperature, power draw or CPU frequency (@jlo62)
- Add memory compression (zRAM/zswap) statistics to the Memory page (@timatgca)
- ... see upstream for full release notes

πŸ“‚ Project Structure

flatpak2spec/
β”œβ”€β”€ Cargo.toml                      # Project metadata, binary definition, and crate dependencies
β”œβ”€β”€ cliff.toml                      # git-cliff changelog generator config
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── release.yml             # CI/CD workflow for automated building, attestation, and releases
└── src/
    β”œβ”€β”€ main.rs                     # Entry point: orchestrates CLI args, workspace cloning, and pipeline execution
    β”œβ”€β”€ spec.rs                     # Assembles all generated section strings into a final RPM .spec file
    β”œβ”€β”€ repository.rs               # Workspace preparation and remote Git repository cloning logic
    β”œβ”€β”€ manifest.rs                 # Flatpak manifest parser and validation engine
    β”œβ”€β”€ meson.rs                    # Meson build file inspection and metadata extraction
    β”œβ”€β”€ utils.rs                    # Common filesystem, regex search, and string helper utilities
    └── sections/                   # Spec file section generators
        β”œβ”€β”€ mod.rs                  # Module aggregator exporting all spec section submodules
        β”œβ”€β”€ header.rs               # Generates RPM spec preamble metadata (Name, Version, License, URL, Source0)
        β”œβ”€β”€ deps.rs                 # Translates Flatpak modules/dependencies into BuildRequires and Requires directives
        β”œβ”€β”€ description.rs          # Generates the %description section
        β”œβ”€β”€ build.rs                # Generates %prep, %build, %install, and %check sections
        β”œβ”€β”€ scriptlets.rs           # Generates post/un scriptlets (icon cache updates, glib schemas)
        β”œβ”€β”€ files.rs                # Scans project artifacts to generate %files listings and %find_lang macros
        └── changelog.rs            # Generates the %changelog section

🀝 Contributing

Contributions, bug reports, and pull requests are welcome! Feel free to check out the issues page.

πŸ“œ License

This project is licensed under GPL-3.0-or-later.

About

A fast Rust CLI tool that converts Flatpak application manifests and Meson repositories into Fedora RPM .spec files for Fedora Copr and CI/CD pipelines.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages