{"id":51015024,"url":"https://github.com/jamesarch/createrepo_rs","last_synced_at":"2026-06-21T09:02:24.758Z","repository":{"id":353477128,"uuid":"1219639694","full_name":"jamesarch/createrepo_rs","owner":"jamesarch","description":"🦀 Pure-Rust drop-in for createrepo_c — ~4× less memory, zero C dependencies, one static binary, built-in --dump-manifest. Byte-identical dnf/yum repodata.","archived":false,"fork":false,"pushed_at":"2026-06-16T03:08:36.000Z","size":313,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-16T04:14:50.395Z","etag":null,"topics":["cli","createrepo","devops","dnf","linux","package-management","repodata","rpm","rpm-packaging","rust","static-binary","yum"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamesarch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-24T04:32:39.000Z","updated_at":"2026-06-16T03:08:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jamesarch/createrepo_rs","commit_stats":null,"previous_names":["jamesarch/createrepo_rs"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/jamesarch/createrepo_rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesarch%2Fcreaterepo_rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesarch%2Fcreaterepo_rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesarch%2Fcreaterepo_rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesarch%2Fcreaterepo_rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesarch","download_url":"https://codeload.github.com/jamesarch/createrepo_rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesarch%2Fcreaterepo_rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34603622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","createrepo","devops","dnf","linux","package-management","repodata","rpm","rpm-packaging","rust","static-binary","yum"],"created_at":"2026-06-21T09:02:23.842Z","updated_at":"2026-06-21T09:02:24.750Z","avatar_url":"https://github.com/jamesarch.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# createrepo_rs\n\n[![Rust](https://img.shields.io/badge/Rust-1.76%2B-orange.svg)](https://www.rust-lang.org)\n[![License](https://img.shields.io/badge/license-GPL--2.0-blue.svg)](LICENSE)\n[![CI](https://github.com/jamesarch/createrepo_rs/actions/workflows/ci.yml/badge.svg)](https://github.com/jamesarch/createrepo_rs/actions)\n[![crates.io](https://img.shields.io/crates/v/createrepo_rs.svg)](https://crates.io/crates/createrepo_rs)\n\nPure-Rust drop-in for `createrepo_c`. **~4× less memory · zero C dependencies · one static binary · built-in `--dump-manifest`.** Byte-identical output — dnf/yum see an equivalent repo.\n\n```\n$ time createrepo_rs /srv/zabbix/ --dump-manifest   # 254 RPMs, 80 cores\nreal    0m0.078s   ← was 10.5s with rpm -K loop (130×, manifest scan)\n```\n\n\u003e Speed is **comparable** to createrepo_c — in a controlled benchmark createrepo_c\n\u003e is often a touch faster (it defaults to 5 workers; `--workers` accepts 1–100).\n\u003e createrepo_rs is **not** a speed play. The durable wins are **memory (~4× less)**,\n\u003e **dependencies (5 vs 53)**, and **byte-identical output** — all reproducible in\n\u003e one `docker run`, see [`benchmark/`](benchmark/).\n\n\u003e Production-tested: Zabbix 7.2 mirror, Debian 13, 80-core. Ships in COPR / AUR / Debian.\n\n[中文文档](README_zh.md)\n\n---\n\n## Why\n\nI needed fast RPM metadata generation for a private Zabbix mirror.\n`createrepo_c` works, but it pulls `librpm`, `libxml2`, `glib2`, `zchunk` — packaging pain on Debian.\nAnd `rpm -K` loops for manifest scanning were taking 10+ seconds in CI.\n\nRewrote it in Rust: parallel worker pool, in-memory SQLite (single `VACUUM INTO` flush), zero shared libs.\nThe result ships as a 3.5 MB musl static binary with no runtime dependencies.\n\n---\n\n## vs createrepo_c\n\n| | createrepo_c | createrepo_rs |\n|---|---|---|\n| Dependencies | librpm, libxml2, glib2, zchunk... | **zero FFI** — pure Rust crates |\n| Binary | ~200KB + shared libs | **3.5MB musl static** |\n| Default workers | 5 (`--workers 1–100`) | all CPUs (auto) |\n| Memory safety | manual malloc/free | borrow checker |\n| Peak memory | ~83 MB | **4–8× less** (10–20 MB) |\n| Output | (reference) | **byte-identical, verified** |\n| Cross-compile | painful | `cargo zigbuild` |\n| `--dump-manifest` | ❌ need `rpm -K` loop | ✅ parallel, 0.078s/254 pkgs |\n| Signature detection | ❌ separate `rpm -K` | ✅ built-in |\n| I/O timeout | ❌ | ✅ `--timeout` watchdog |\n| dnf compatible | ✅ | ✅ verified |\n| CLI params | 55 | 53 |\n\n---\n\n## Install\n\n```bash\n# crates.io\ncargo install createrepo_rs\n\n# Fedora / RHEL / CentOS (COPR)\ndnf copr enable jamesarch/createrepo-rs \u0026\u0026 dnf install createrepo-rs\n\n# Arch Linux (AUR)\nyay -S createrepo-rs\n\n# Debian / Ubuntu\ncurl -LO https://github.com/jamesarch/createrepo_rs/releases/download/v0.1.9/createrepo-rs_0.1.9_amd64.deb\ndpkg -i createrepo-rs_0.1.9_amd64.deb\n\n# RHEL / CentOS\ncurl -LO https://github.com/jamesarch/createrepo_rs/releases/download/v0.1.9/createrepo-rs-0.1.9-1.el9.x86_64.rpm\ndnf install createrepo-rs-0.1.9-1.el9.x86_64.rpm\n\n# Docker\ndocker run --rm -v /path/to/rpms:/data jamesarch/createrepo-rs /data\n# or: ghcr.io/jamesarch/createrepo-rs /data\n```\n\n```bash\n# Basic usage\ncreaterepo_rs /path/to/rpms/\n\n# Production example\ncreaterepo_rs /srv/repo/ \\\n  --baseurl=https://mirrors.example.com/repo \\\n  --compress-type=zstd \\\n  --timeout=300\n```\n\n### CI/CD\n\n```yaml\n# GitHub Actions\n- uses: docker://ghcr.io/jamesarch/createrepo-rs:0.1.9\n  with:\n    args: ./rpms --baseurl=https://repo.example.com --compress-type=zstd\n```\n\n```yaml\n# GitLab CI\ngenerate-repodata:\n  image: ghcr.io/jamesarch/createrepo-rs:0.1.9\n  script:\n    - createrepo_rs ./rpms --compress-type=zstd\n```\n\nContainer tags: `latest` · `0.1.9` · `0.1` · `sha-\u003cshort-sha\u003e`\n\n---\n\n## Performance\n\nReproducible head-to-head ([`benchmark/`](benchmark/)) — one `docker run`, both\ntools native in the same container, [hyperfine](https://github.com/sharkdp/hyperfine)\n(5 runs). Numbers below: 10-core aarch64, 2000 synthetic packages.\n\n### Wall-clock — full repodata generation\n\n| Command | Time |\n|---------|------|\n| createrepo_c (default, 5 workers) | **67 ms** |\n| createrepo_c (`--workers 10`) | 102 ms |\n| createrepo_rs (all cores) | 82 ms |\n\ncreaterepo_c is the **fastest** here — ~1.2× faster than createrepo_rs — and\nraising its worker count doesn't help at this repo size. createrepo_c defaults to\n5 workers and accepts `--workers 1–100`; there is no \"5-thread cap.\" **Treat the\ntwo as comparable on speed, with createrepo_c often slightly ahead.**\n\n### What createrepo_rs actually wins\n\n| Metric | createrepo_c | createrepo_rs |\n|--------|--------------|---------------|\n| Peak RSS (2000 pkgs) | ~84 MB | **20 MB — ~4× less** |\n| Shared libraries | 53 | **5** |\n| Output (pkgid set) | reference | **byte-identical** |\n| Footprint | 72 KB binary + 53 `.so` | single 3.8 MB static binary, zero FFI |\n\nThe durable, universal wins are **memory, dependency footprint, and identical\noutput** — not raw speed.\n\n### `--dump-manifest` — parallel package inventory scan\n\nReads only RPM signature header + name/version/arch. Skips files, deps, changelogs.\nReplaces `rpm -K` + `rpm -qp` loops in CI pipelines.\n\n| Method | Time | Workers |\n|--------|------|---------|\n| `rpm -K` loop (bash) | 10.5s | 1 |\n| **`--dump-manifest`** | **0.078s** | 80 (auto) |\n\nOutput: JSON lines, one object per package, with signature detection.\n\n```bash\n$ createrepo_rs /srv/repo --dump-manifest\n{\"name\":\"zabbix-server\",\"version\":\"7.2.0\",\"release\":\"1.el9\",\"arch\":\"x86_64\",\"signed\":true}\n{\"name\":\"zabbix-agent2\",\"version\":\"7.2.0\",\"release\":\"1.el9\",\"arch\":\"x86_64\",\"signed\":true}\n...\n```\n\ncreaterepo_rs parallelises across all cores by default (`--workers N` to pin a\ncount). The scan above replaces `rpm -K` + `rpm -qp` loops in CI pipelines.\n\n---\n\n## Architecture\n\n### In-memory SQLite\n\nSQLite builds in RAM, flushes once at finish:\n\n```\nparse RPMs (parallel) ──► insert_package() ──► RAM (single connection)\n                                                      │\n                                               VACUUM INTO repomd.sqlite\n```\n\nTraditional: one transaction + fsync per package. This: all inserts in RAM, one disk write.\n\n### I/O resilience\n\nNetwork mounts (NFS, CIFS, FUSE) can stall indefinitely. Mitigations:\n\n- `--timeout=N` watchdog thread → forced exit on hang\n- `recv_timeout(300s)` on result collection\n- `send_timeout(30s)` on job submission\n- `catch_unwind` per worker — one bad RPM can't crash the pool\n\n### Source layout\n\n```\ncreaterepo_rs/\n├── build.rs          # git hash + timestamp baked into --version\n├── lib.rs            # library root + prelude re-exports\n├── src/main.rs       # CLI orchestration, --dump-manifest\n├── cli/mod.rs        # clap parser (53 params)\n├── pool/mod.rs       # parallel worker pool (crossbeam + catch_unwind)\n├── rpm/mod.rs        # RPM header parsing via `rpm` crate\n├── types/mod.rs      # Package, Dependency, RepomdRecord\n├── compression/      # gzip, bzip2, zstd, xz\n├── db/mod.rs         # in-memory SQLite + VACUUM INTO\n├── xml/              # repomd.xml generation + parse (for --update)\n└── walk/mod.rs       # directory traversal with glob exclude\n```\n\n---\n\n## Features\n\n**Core**\n- primary.xml, filelists.xml, other.xml, repomd.xml — dnf-compatible\n- In-memory SQLite — `VACUUM INTO` flush at finish\n- Multi-threaded RPM parsing (auto-detects CPU count)\n- `--timeout=N` watchdog for stuck I/O\n- `--dump-manifest` — parallel JSON-lines inventory with signature detection\n- `--update` incremental mode with `Arc\u003cPackage\u003e` cache\n- Graceful Ctrl+C, `catch_unwind` panic recovery\n\n**Dependency extraction**\n- Provides / Requires / Conflicts / Obsoletes / Suggests / Enhances / Recommends / Supplements\n- Full EVR (Epoch:Version-Release) parsing + flags (EQ, LT, GT, LE, GE)\n\n**Compression:** gzip (default) · zstd · xz · bzip2\n\n---\n\n## Key CLI flags\n\n| Flag | Description |\n|------|-------------|\n| `--workers=N` | Parallel threads (default: all CPUs) |\n| `--timeout=N` | Watchdog timeout in seconds |\n| `--dump-manifest` | JSON-lines inventory + signature detection |\n| `--compress-type=zstd` | Compression algorithm |\n| `--no-database` | Skip SQLite generation |\n| `--update` | Incremental mode |\n| `--retain-old-md-by-age=30d` | Auto-cleanup old metadata |\n| `--compatibility` | Max compat mode (gzip + simple filenames) |\n\nFull reference: `createrepo_rs --help` (53 params)\n\n---\n\n## Library usage\n\n```toml\n[dependencies]\ncreaterepo_rs = \"0.1\"\n```\n\n```rust\nuse createrepo_rs::prelude::*;\n\n// Parse an RPM\nlet mut reader = RpmReader::open(Path::new(\"pkg.rpm\")).unwrap();\nlet pkg = reader.read_package().unwrap();\nprintln!(\"{} {}-{}\", pkg.name, pkg.version, pkg.release);\n\n// Lightweight manifest scan (header only)\nlet entry = reader.read_manifest_entry().unwrap();\nprintln!(\"{} {} signed={}\", entry.name, entry.arch, entry.signed);\n```\n\n---\n\n## Build\n\n```bash\ncargo build --release\n\n# musl static binary (requires cargo-zigbuild + zig)\ncargo zigbuild --release --target x86_64-unknown-linux-musl\n\n# ARM64\ncargo zigbuild --release --target aarch64-unknown-linux-musl\n```\n\n## Docker test\n\n```bash\ncd docker-test \u0026\u0026 docker compose up -d\n# verifies dnf can consume the generated repodata\n```\n\n---\n\n## Changelog\n\n**v0.1.8** — parallel `--dump-manifest` · `read_manifest_entry()` header-only · 254 pkgs: 10.5s → 0.078s  \n**v0.1.7** — `--dump-manifest` · `is_signed()` PGP/RSA/DSA detection · `ManifestEntry`  \n**v0.1.6** — in-memory SQLite · single `VACUUM INTO` flush · removed per-struct boilerplate  \n**v0.1.5** — `--timeout` watchdog · `recv_timeout` · `catch_unwind` · build info in `--version`  \n**v0.1.4** — initial public release · 52 CLI params · dnf-compatible output  \n\n---\n\n## License\n\nGPL-2.0-or-later — same as createrepo_c.\n\nBuilt with [rpm-rs/rpm](https://github.com/rpm-rs/rpm) · [quick-xml](https://github.com/tafia/quick-xml) · [rusqlite](https://github.com/rusqlite/rusqlite) · [crossbeam](https://github.com/crossbeam-rs/crossbeam)  \nEVR parsing reference: [dralley/rpmrepo_metadata](https://github.com/dralley/rpmrepo_metadata) ([@dralley](https://github.com/dralley), Red Hat)  \nOriginal C implementation: [rpm-software-management/createrepo_c](https://github.com/rpm-software-management/createrepo_c)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesarch%2Fcreaterepo_rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesarch%2Fcreaterepo_rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesarch%2Fcreaterepo_rs/lists"}