Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
pull_request:

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-latest
container: archlinux:base-devel
timeout-minutes: 20

steps:
- name: Check out the source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: Install test tools
run: >-
pacman -Syu --noconfirm --needed
desktop-file-utils
libarchive
libxml2
rust
shellcheck
zstd

- name: Check Rust formatting
run: cargo fmt --all -- --check

- name: Run Clippy
run: cargo clippy --all-targets --locked -- -D warnings

- name: Run tests
run: cargo test --all-targets --locked

- name: Check shell scripts
run: |
bash -n scripts/*.sh
shellcheck scripts/*.sh

- name: Check desktop and XML files
run: |
desktop-file-validate assets/io.github.devnvll.Debforge.desktop
xmllint --noout assets/io.github.devnvll.Debforge.svg
xmllint --noout assets/org.devnvll.debforge.policy
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/target/
/*.pkg.tar.*
/.debtap-rs-*
/packaging/pkg/
/packaging/src/
/packaging/*.pkg.tar.*
*.deb
.env
.env.*
!.env.example
*.key
*.pem
39 changes: 28 additions & 11 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The first release has these targets:

## Pipeline

The converter has five stages.
The converter has six stages.

1. **Read**
- Validate the `!<arch>` Debian archive signature.
Expand All @@ -36,13 +36,20 @@ The converter has five stages.
- Merge Debian multiarch library directories into the Arch library layout.
- Preserve modes, symbolic links, hard links, and extended archive metadata.

4. **Describe**
4. **Inspect**
- Parse ELF headers and dynamic tables in Rust.
- Reject a definite CPU architecture mismatch.
- Reject device nodes, sockets, and other unsupported special files.
- Report missing interpreters, missing shared libraries, privileged modes,
and Debian multiarch runtime paths.

5. **Describe**
- Generate `.PKGINFO` directly from the parsed control data.
- Generate `.MTREE` with SHA-256 file data unless the user disables it.
- Use the installed Pacman hooks for standard cache updates.
- Never copy Debian `apt`, repository, `dpkg`, or service-control code into the default install script.

5. **Write**
6. **Write**
- Stream one `bsdtar` process into one parallel `zstd` process.
- Use Zstandard level 3 by default.
- Write to a partial file and rename it only after both processes succeed.
Expand All @@ -55,24 +62,30 @@ package for a full Namcap shared-library scan. The cost grows with the number of
dependencies and payload files.

`debtap-rs` uses a constant number of process starts for normal conversion. It
reads the local Arch package-name set once. Dependency resolution is then an
in-memory set lookup. It does not inspect every ELF file. Extraction and output
compression remain disk-bound and run through libarchive and parallel Zstandard.
reads the local Arch package-name set once. Dependency resolution and ELF
inspection are then in-memory operations. Extraction and output compression
remain disk-bound and run through libarchive and parallel Zstandard.

## Module boundaries

- `cli`: command-line compatibility and option validation.
- `control`: Deb822 parsing and Debian version and architecture conversion.
- `dependency`: relation parsing, alias mapping, and alternative selection.
- `compatibility`: ELF and special-file inspection.
- `workspace`: private work directories and cleanup.
- `archive`: Debian member extraction, payload extraction, MTREE generation, and package output.
- `transform`: filesystem layout changes and installed-size calculation.
- `scripts`: safe hook generation and explicit raw-script translation.
- `package`: Arch metadata and PKGBUILD generation.
- `process`: checked child-process execution and pipelines.
- `installer`: unprivileged review, authorization, and receipts.
- `privileged`: fixed root helper interface, secure staging, and Pacman execution.

No module can install a package. Installation remains a separate, authorized
`pacman -U` step in the desktop handler.
The converter cannot install a package. The installer is a separate
unprivileged flow. It creates a private conversion, shows a transaction review,
and sends only the reviewed package path and digest to a small Polkit helper.
The helper copies the same open file into a root-only directory, checks the
digest again, validates it, and starts `pacman -U`.

## Dependency policy

Expand All @@ -88,9 +101,10 @@ resolution uses the built-in mapping and keeps valid same-name dependencies.

## Maintainer-script policy

The default `safe` policy generates hooks only from payload types that need a
cache refresh. Examples are desktop files, MIME data, icon themes, GLib schemas,
systemd units, and tmpfiles rules.
The default `safe` policy omits Debian maintainer code. Standard Pacman
transaction hooks handle desktop files, MIME data, icon themes, GLib schemas,
systemd units, and tmpfiles rules when their owning Arch packages provide those
hooks. Debforge records omitted scripts and Debian triggers as review warnings.

The `none` policy writes no `.INSTALL` file.

Expand All @@ -106,6 +120,9 @@ scripts can call Debian-only commands or change repository settings.
- An unknown dependency name is kept after safe name normalization and produces a warning.
- Existing output is not replaced unless `--force` is present.
- Partial output always uses a separate file name.
- A special payload file or definite ELF architecture mismatch stops conversion.
- The root helper refuses links, wrong owners, changed hashes, relative paths,
unexpected arguments, and packages larger than its fixed safety limit.

## Compatibility

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "debtap-rs"
version = "0.1.0"
version = "0.2.0"
edition = "2024"
rust-version = "1.85"
description = "A fast and safe Debian-to-Arch package converter"
Expand All @@ -11,6 +11,10 @@ repository = "https://github.com/DevNvll/debforge"
name = "debtap-rs"
path = "src/main.rs"

[[bin]]
name = "debforge-helper"
path = "src/bin/debforge-helper.rs"

[profile.release]
codegen-units = 1
lto = "thin"
Expand Down
Loading