SkillAgentSearch skills...

Yap

Package software with ease šŸ“¦ Versatile deb, rpm and apk packager fueled by PKGBUILD specfiles and golang

Install / Use

/learn @M0Rf30/Yap

README

YAP - Yet Another Packager

yap-logo

report card View examples License: GPL v3 Go Report Card GitHub release

šŸš€ Introduction

YAP (Yet Another Packager) is a modern, cross-distribution package building tool designed to simplify the complex process of creating packages for multiple GNU/Linux distributions. With YAP, you can maintain a single package specification and build native packages for various distributions including Debian, Ubuntu, Fedora, CentOS, Rocky Linux, Alpine, Arch Linux, and more.

YAP eliminates the need to learn multiple packaging formats and build systems by providing a unified interface based on the familiar PKGBUILD format from Arch Linux, extended with multi-distribution support and modern container-based builds.

✨ Key Features

🐳 Container-Based Isolation

  • OCI Container Builds: All builds run in isolated OCI containers (Docker/Podman)
  • No Host Contamination: Clean build environments without affecting your system
  • Reproducible Builds: Consistent results across different environments
  • Multi-Architecture Support: Build for different CPU architectures

šŸ“¦ Multi-Format Package Support

  • RPM Packages: For Red Hat, CentOS, Rocky Linux, Fedora, OpenSUSE
  • DEB Packages: For Debian, Ubuntu, Linux Mint, Pop!_OS
  • APK Packages: For Alpine Linux
  • TAR.ZST Archives: For Arch Linux and generic distributions
  • Future-Ready: Extensible architecture for additional formats

šŸ”§ Advanced Build Features

  • Dependency-Aware Building: Intelligent build ordering based on dependencies
  • Sequential Builds by Default: Predictable file-order builds using the "install" flag for inter-package ordering
  • Parallel Builds (opt-in): Enable dependency-aware topo-sort with worker pools via --parallel
  • Component Logging: Clear, tagged logging for complex build processes
  • Enhanced PKGBUILD Support: Extended syntax with custom variables and arrays
  • Cross-Distribution Variables: Distribution-specific configurations in single file
  • Cross-Compilation Support: Build packages for different architectures than your build environment

šŸŽÆ Developer Experience

  • Simple Configuration: JSON project files with minimal setup
  • Familiar Syntax: PKGBUILD-based with intuitive extensions
  • Rich CLI: Comprehensive command-line interface with auto-completion
  • Detailed Logging: Component-aware logging with build progress tracking
  • Error Handling: Clear error messages and debugging information

šŸ“„ Installation

# Download the latest release
wget https://github.com/M0Rf30/yap/releases/latest/download/yap_Linux_x86_64.tar.gz

# Extract the archive
tar -xzf yap_Linux_x86_64.tar.gz

# Install to system path
sudo mv yap /usr/local/bin/

# Verify installation
yap version

Build from Source

# Clone the repository
git clone https://github.com/M0Rf30/yap.git
cd yap

# Build YAP
go build -o yap cmd/yap/yap.go

# Install
sudo mv yap /usr/local/bin/

Container Support

Ensure you have either Docker or Podman installed:

# For Docker
sudo systemctl enable --now docker
sudo usermod -aG docker $USER

# For Podman
sudo systemctl enable --now podman

šŸš€ Quick Start

1. Create a Project Structure

mkdir my-package && cd my-package

Create a project configuration file yap.json:

{
  "name": "My Package",
  "description": "A sample package built with YAP",
  "buildDir": "/tmp/yap-build",
  "output": "artifacts",
  "projects": [
    {
      "name": "my-package"
    }
  ]
}

2. Create a PKGBUILD

Create directory my-package/ and add a PKGBUILD file:

mkdir my-package

Create my-package/PKGBUILD:

pkgname=my-package
pkgver=1.0.0
pkgrel=1
pkgdesc="My awesome application"
pkgdesc__debian="My awesome application for Debian"
pkgdesc__alpine="My awesome application for Alpine"
arch=('x86_64')
license=('GPL-3.0')
url="https://github.com/user/my-package"
makedepends=('gcc' 'make')
source=("https://github.com/user/my-package/archive/v${pkgver}.tar.gz")
sha256sums=('SKIP')

build() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    make
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    install -Dm755 my-package "${pkgdir}/usr/bin/my-package"
    install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}

3. Build Your Package

# Build for current system distribution
yap build .

# Build for specific distribution
yap build ubuntu-jammy .
yap build fedora-38 /path/to/project

# Build with specific options
yap build --cleanbuild --nomakedeps ubuntu-jammy .

4. Find Your Packages

Built packages will be available in the artifacts/ directory (or your specified output directory):

artifacts/
ā”œā”€ā”€ debian/
│   └── my-package_1.0.0-1_amd64.deb
ā”œā”€ā”€ ubuntu/
│   └── my-package_1.0.0-1_amd64.deb
ā”œā”€ā”€ fedora/
│   └── my-package-1.0.0-1.x86_64.rpm
ā”œā”€ā”€ alpine/
│   └── my-package-1.0.0-r1.apk
└── arch/
    └── my-package-1.0.0-1-x86_64.pkg.tar.zst

šŸ“– Documentation

Project Configuration (yap.json)

The project configuration file defines build settings and project structure:

{
  "name": "My Multi-Package Project",
  "description": "Project description",
  "buildDir": "/tmp/yap-builds",
  "output": "dist",
  "cleanPrevious": true,
  "projects": [
    {
      "name": "package-one",
      "depends": []
    },
    {
      "name": "package-two",
      "depends": ["package-one"]
    }
  ]
}

Configuration Options:

  • name: Project display name
  • description: Project description
  • buildDir: Temporary build directory (default: /tmp)
  • output: Output directory for built packages (default: artifacts)
  • cleanPrevious: Clean previous builds (default: false)
  • projects: Array of packages to build
  • depends: Package build dependencies (for build ordering)

PKGBUILD Extensions

YAP extends the standard PKGBUILD format with multi-distribution support:

Distribution-Specific Variables

YAP supports distribution-specific variable overrides using the __ (double underscore) syntax. These directives follow a strict priority system to ensure the most specific configuration takes precedence.

Priority System (Highest to Lowest):

  1. Priority 3 - Full distribution with codename: variable__ubuntu_noble
  2. Priority 2 - Distribution name only: variable__ubuntu
  3. Priority 1 - Package manager: variable__apt
  4. Priority 0 - Base variable (fallback): variable

How It Works:

  • Higher priority values override lower priority values
  • Once a higher priority is set, lower priorities are ignored
  • Most specific configuration always wins

Examples:

# Base description (Priority 0 - fallback)
pkgdesc="My application"

# Distribution-specific descriptions (Priority 2)
pkgdesc__debian="My application for Debian/Ubuntu"
pkgdesc__fedora="My application for Fedora/CentOS"
pkgdesc__alpine="My application for Alpine Linux"
pkgdesc__arch="My application for Arch Linux"

# Version-specific descriptions (Priority 3 - highest)
pkgdesc__ubuntu_noble="My application optimized for Ubuntu 24.04 Noble"
pkgdesc__ubuntu_jammy="My application for Ubuntu 22.04 Jammy"
pkgdesc__fedora_39="My application for Fedora 39"

# Package manager specific dependencies (Priority 1)
makedepends=('gcc' 'make')
makedepends__apt=('build-essential' 'cmake')
makedepends__yum=('gcc-c++' 'cmake3')
makedepends__apk=('build-base' 'cmake')

# Distribution-specific dependencies (Priority 2)
makedepends__ubuntu=('build-essential' 'cmake' 'pkg-config')
makedepends__debian=('build-essential' 'cmake')

# Version-specific dependencies (Priority 3 - highest)
makedepends__ubuntu_noble=('build-essential' 'cmake' 'pkg-config' 'libtool')

Practical Example for Ubuntu Noble:

depends="generic-package"          # Priority 0 (fallback)
depends__apt="apt-specific"        # Priority 1 (package manager)
depends__ubuntu="ubuntu-specific"  # Priority 2 (distribution)
depends__ubuntu_noble="noble-optimized"  # Priority 3 (most specific)

# Result: Only "noble-optimized" will be used for Ubuntu Noble builds

Supported Distribution Codes:

  • Ubuntu: ubuntu_focal, ubuntu_jammy, ubuntu_noble
  • Debian: debian_bullseye, debian_bookworm
  • Fedora: fedora_38, fedora_39, fedora_40
  • Rocky: rocky_8, rocky_9
  • CentOS: centos_7, centos_8
  • Alpine: alpine_3_18, alpine_3_19
  • And more...

Architecture-Specific Variables

YAP also supports architecture-specific variable overrides using the _ (single underscore) syntax, following the Arch Linux PKGBUILD convention. Architecture-specific variables have the highest priority in the system.

Updated Priority System (Highest to Lowest):

  1. Priority 4+ - Combined architecture + distribution: variable_x86_64__ubuntu_noble
  2. Priority 4 - Architecture-specific: variable_x86_64
  3. Priority 3 - Full distribution with codename: variable__ubuntu_noble
  4. Priority 2 - Distribution name only: variable__ubuntu
  5. Priority 1 - Package manager: variable__apt
  6. Priority 0 - Base variable (fallback): variable

Supported Architectures:

  • x86_64 - 64-bit x86 (Intel/AMD)
  • i686 - 32-bit x86
  • `aa

Related Skills

View on GitHub
GitHub Stars12
CategoryProduct
Updated3d ago
Forks2

Languages

Go

Security Score

95/100

Audited on Apr 7, 2026

No findings