No description
  • Python 96.8%
  • Shell 3.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-07 14:17:11 -05:00
aur2sb v2 2026-10-03 01:31:19 -05:00
examples Fix: /usr/local → /usr for SBo packages 2026-09-21 20:30:57 +00:00
tests test 2026-10-03 01:31:40 -05:00
.gitignore Add aur2sb core: PKGBUILD-to-SlackBuild converter (Waves 0-5) 2026-09-22 17:41:50 -05:00
aur2slack.py Fix: /usr/local → /usr for SBo packages 2026-09-21 20:30:57 +00:00
build-zipapp.py Add aur2sb core: PKGBUILD-to-SlackBuild converter (Waves 0-5) 2026-09-22 17:41:50 -05:00
pyproject.toml Add aur2sb core: PKGBUILD-to-SlackBuild converter (Waves 0-5) 2026-09-22 17:41:50 -05:00
README.md update readme 2026-10-07 14:17:11 -05:00

aur2sb — convert Arch PKGBUILDs to Slackware SlackBuilds

aur2sb converts any Arch Linux PKGBUILD — an AUR package, an official Arch repo package, or a local PKGBUILD file — into a complete, SBo-style SlackBuild file set targeting Slackware -current.

What it does

  • Fetches AUR packages via AUR RPC v5 + snapshot tarball, official Arch repo packages via the archlinux.org packaging git repos (git clone; .SRCINFO committed), or local PKGBUILD files (sibling .SRCINFO preferred).
  • Parses .SRCINFO only — the PKGBUILD is never executed or sourced.
  • Detects the upstream build system (autotools, cmake, meson, python, perl, cargo, go, make). Ruby (.gemspec) and Haskell (.cabal) build systems are also detected, but they currently have no renderable SlackBuild stanza and are refused cleanly with exit code 1 pending future build-stanza support.
  • Maps Arch dependency names to Slackware names; drops stock -current packages from REQUIRES.
  • Downloads HTTP(S) sources and recomputes real MD5 checksums.
  • Writes a complete SBo-style file set: <name>.SlackBuild, <name>.info, slack-desc, README, conditional doinst.sh, and passthrough patches/.
  • Applies hard refusal gates before rendering; failures exit non-zero and leave no output directory.
  • Optionally runs sbolint post-validation when installed.
  • Can be distributed as a single-file zipapp.

What it does NOT do

  • Resolve or install dependencies at build time (REQUIRES is advisory).
  • Build the package for you — it generates a SlackBuild script, then stops.
  • Translate package() line-by-line; manual review is always required.
  • Handle systemd/VCS/-bin/split/lib32-* packages by default (see refusal table below).

Requirements

  • Python 3.9 or newer.
  • Zero pip dependencies — the tool uses only the Python standard library and runs on a stock Slackware python3 install.
  • Optional: sbolint for post-validation.

Install

From a clone

git clone https://github.com/<user>/aur-slackbuild.git
cd aur-slackbuild
python3 -m venv venv
source venv/bin/activate
pip install -e .

Single-file zipapp

From the repository root run:

python3 build-zipapp.py

This produces dist/aur2sb.pyz. Copy it to any Slackware box and run it as a normal executable:

./aur2sb.pyz --help

Usage

aur2sb <pkgname-or-path> [options]

Input modes

Mode Invocation Source of truth
AUR aur2sb <name> AUR RPC v5 + snapshot tarball.
Official aur2sb --official <name> (or auto-fallback) archlinux.org packaging git repos (git clone, .SRCINFO committed).
Local aur2sb /path/to/PKGBUILD (or a dir containing one) Sibling .SRCINFO preferred; conservative parser refuses bash-complex PKGBUILDs with a makepkg --printsrcinfo hint.

Default is auto mode: local path detected first, then AUR, then official fallback if the AUR misses. Use --mode {auto,aur,official,local} to pick a source explicitly.

Supported flags (exact names from aur2sb/cli.py):

Flag Meaning
pkgname Package name or local PKGBUILD path (positional, required).
--mode Explicit input mode: auto, aur, official, or local.
--official Force official-repo mode (equivalent to --mode official).
--aur Force AUR mode (equivalent to --mode aur).
--output, -o Directory to write the <name>/ file set (default: .).
--maintainer Maintainer name for <name>.info (default: aur2sb user).
--email Maintainer email for <name>.info (default: aur2sb@localhost).
--allow-vcs Override the VCS refusal gate.
--allow-bin Override the -bin refusal gate.
--no-download Skip source downloads; MD5SUM is left empty.
--no-lint Skip the optional sbolint post-validation.
--version Print version and exit.

Example session

$ aur2sb st -o /tmp/sbo
Converting AUR package 'st' ...
output: /tmp/sbo/st
engine: make
version-build: 0.9.3-1_aur2sb
requires: libXft
dropped: 0
renamed: 1
warning: patch copied for review: terminfo.patch
warning: source 'terminfo.patch' not downloadable (VCS or local); no MD5
warning: source 'README.terminfo.rst' not downloadable (VCS or local); no MD5
sbolint: rc=1 (advisory — see caveats)

$ ls -l /tmp/sbo/st
-rwxr-xr-x 1 user user  2915 Sep 21 12:00 st.SlackBuild
-rw-r--r-- 1 user user   263 Sep 21 12:00 st.info
-rw-r--r-- 1 user user   606 Sep 21 12:00 slack-desc
-rw-r--r-- 1 user user   476 Sep 21 12:00 README
drwxr-xr-x 2 user user    60 Sep 21 12:00 patches

More examples

# Basic conversion in the current directory
aur2sb python-mando

# Custom output directory; skip downloads; VCS override
aur2sb python-mando -o ~/slackbuilds
aur2sb python-mando --no-download
aur2sb neovim-git --allow-vcs

# Set maintainer fields
aur2sb st --maintainer "Jane Doe" --email "jane@example.com"

# Official Arch repo package (explicit mode)
aur2sb --official glslang

# Local PKGBUILD file
aur2sb ./PKGBUILD

# A refused conversion (Arch-only dependency)
aur2sb yay

Exit codes

Code Meaning
0 Success — file set written.
1 Refused — one or more refusal gates triggered.
2 Error — AUR lookup failed, network failure, or malformed input.

Refusal policy

These conditions cause a non-zero exit and no output directory unless noted otherwise.

Condition Override Notes
VCS packages (-git, -svn, etc. or git+… sources) --allow-vcs Dynamic pkgver() has no Slackware equivalent.
-bin packages (upstream prebuilt binaries) --allow-bin Mis-translation risk too high.
Split packages (pkgbase with multiple pkgname) None May be supported later with --pick.
lib32-* / multilib packages None No stock multilib on Slackware.
Hard Arch-only deps (pacman, yay, paru, archlinux-keyring, makepkg) None Not expressible on Slackware.
Systemd unit sources None No systemd on Slackware.
Unknown build system None Engine detection failed.
Checksum mismatch None Downloaded source did not match .SRCINFO.

Generated file set

<name>/
├── <name>.SlackBuild   # executable build script (mode 0755)
├── <name>.info         # SBo metadata: version, download, MD5SUM, REQUIRES
├── slack-desc          # 11-line package description
├── README              # generated notes for the maintainer
├── doinst.sh           # optional post-install script
└── patches/            # optional passthrough of .patch/.diff files
  • <name>.SlackBuild — bash build script, engine-specific stanza inserted.
  • <name>.info — space-separated fields, REQUIRES lists only non-stock deps.
  • slack-desc — SBo-format description block.
  • README — warnings, dropped/renamed deps, build hints.
  • doinst.sh — emitted only when desktop/mime/icon/schema/backup handling is detected.
  • patches/ — copies upstream patches for manual review and wiring.

Extending aur2sb

Extension point How to change it
Dependency name mapping Edit data/name_map.toml.
Stock package drop-list The full main-tree package set from a -current mirror; regenerate with python3 -m aur2sb --refresh-stock (uses mirror.stax.xyz by default; --mirror to override). Users with slimmer installs can trim the generated data file.
VCS/Arch-only refusal rules Edit data/drop_rules.toml.
Add a build engine Drop a new <engine>.stanza file into aur2sb/templates/; it is auto-discovered with no code changes.

About examples/

The examples/ directory and aur2slack.py are a pre-existing proof-of-concept retained as read-only historical reference. They are not produced by aur2sb and may use a different heuristic pipeline.

Caveats

  • The generated build tag is _aur2sb. The _SBo tag is reserved for slackbuilds.org submissions.
  • Output targets Slackware -current (e.g., gcc 16 / glibc 2.44 toolchain). Packages will not run on Slackware 15.0.
  • Generated SlackBuilds follow Slackware convention and run as root.
  • sbolint may flag non-submission conventions (tag, PKGTYPE, or slack-desc formatting). These warnings are advisory; aur2sb is not an SBo submission tool.
  • sbolint output is advisory: aur2sb targets -current users, not SBo submissions, so lint nits about _SBo tag/tgz defaults are expected and safe to ignore.
  • The upstream PKGBUILD is not mechanically translated; always review the generated README and upstream install steps before building.
  • Auto-archived GitHub/GitLab tarballs exclude submodules; generated builds for submodule-dependent projects may need review.
  • Upstream Arch epoch values are dropped from VERSION (Slackware has no epoch); check the generated README for the dropped-epoch warning.

Project layout

aur2sb/
├── cli.py         # argparse entry point and main()
├── generator.py   # conversion pipeline orchestrator
├── model.py       # internal package dataclasses
├── aur.py         # AUR RPC v5 client and snapshot handling
├── srcinfo.py     # .SRCINFO parser
├── buildsys.py    # build-system detection
├── names.py       # Arch → Slackware name mapping helpers
├── deps.py        # dependency filtering and REQUIRES assembly
├── md5.py         # source download and MD5 recomputation
├── render.py      # slack-desc, .info, README, doinst.sh renderers
├── checks.py      # refusal gates
├── lint.py        # optional sbolint integration
├── quoteguard.py  # bash-quoting and value validation
├── archpkg.py     # official Arch repo client
├── pkgbuild_local.py  # local PKGBUILD reader
├── archiveurl.py  # pinned-VCS archive URL derivation
├── templates/     # engine stanza templates and str.replace-based assembly
└── data/          # name_map.toml, stock_packages.txt, drop_rules.toml

License

License: GPL-3.0-or-later (GNU GPLv3). See https://www.gnu.org/licenses/gpl-3.0.html for the full text.