Skip to content
Open
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
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Built packages
*.deb
*.rpm
*.pkg.tar.*
*.apk

# LURE build artifacts
*.tar.gz
*.tar.xz
*.tar.zst

# Editor backups
*~
*.swp
*.swo
.*.swp

# OS files
.DS_Store
Thumbs.db
108 changes: 108 additions & 0 deletions fdbox-git/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# fdbox-git LURE Package

## What is fdbox?

[fdbox](https://github.com/diegoiast/fdbox) is a FreeDOS-like shell and utilities for Linux. It provides a command-line environment that mimics the classic DOS experience, implementing familiar commands like `dir`, `cd`, `type`, `copy`, `del`, and more.

Think of it as a nostalgic bridge for those who grew up with DOS, or an educational tool for understanding how command-line interfaces evolved.

### Features

- FreeDOS-compatible command syntax
- Built-in commands: `dir`, `cd`, `cls`, `copy`, `del`, `echo`, `exit`, `md`, `rd`, `type`, `ver`, etc.
- Some Unix utilities: `cal`, `head`, `tail`, `hexdump`
- Lightweight C implementation
- Cross-platform (Linux, Windows)

## Building Manually

```bash
sudo apt install build-essential cmake git
git clone https://github.com/diegoiast/fdbox.git
cd fdbox
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
./fdbox
```

## Lessons Learned: LURE Packaging Pitfalls

### 1. Debian Version Numbers Must Start with a Digit

**Problem:**
```
'Version' field value 'r282.6acbada-1': version number does not start with digit
```

**Cause:** The `version()` function generated `r282.6acbada` (commit count + short hash), but Debian policy requires version strings to begin with a digit.

**Wrong:**
```bash
version() {
cd "$srcdir/fdbox"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
```

**Correct:**
```bash
version() {
cd "$srcdir/fdbox"
# Prefix with 0.0.0 to satisfy Debian's digit-first requirement
printf "0.0.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
```

**Result:** `0.0.0.r282.6acbada` — starts with a digit, Debian-compliant.

### 2. Fallback Installation When No `make install` Target Exists

**Problem:** Many small projects don't define an `install` target in their CMakeLists.txt.

**Solution:** Use `||` to fall back to manual installation:
```bash
package() {
cd "$srcdir/fdbox/build"
make DESTDIR="$pkgdir" install || install -Dm755 fdbox "$pkgdir/usr/bin/fdbox"
}
```

This tries `make install` first, and if it fails, manually installs the binary with correct permissions (755) to `/usr/bin/`.

### 3. CMake in `prepare()` vs `build()`

**Why CMake runs in `prepare()`:** The CMake configure step downloads dependencies via CPM (CMake Package Manager) and requires internet access. LURE's `prepare()` phase is designed for tasks requiring network access, while `build()` should work offline.

### 4. Git Source Syntax

For git repositories in LURE, use the `git+` prefix:
```bash
sources=("git+https://github.com/diegoiast/fdbox.git")
checksums=("SKIP") # Git sources use SKIP for checksum
```

## Quick Reference: Debian Version Formats

| Format | Valid? | Example |
|--------|--------|---------|
| `r123.abc1234` | ❌ No | Starts with letter |
| `0.0.0.r123.abc1234` | ✅ Yes | Starts with digit |
| `1.0.0` | ✅ Yes | Standard semver |
| `2024.01.15` | ✅ Yes | Date-based |
| `0~git20260109` | ✅ Yes | Pre-release with tilde |

## File Structure

```
fdbox-git/
├── lure.sh # LURE build script
├── README.md # This file
└── *.deb # Generated package (after build)
```

## References

- [fdbox GitHub Repository](https://github.com/diegoiast/fdbox)
- [LURE Documentation](https://lure.sh/)
- [Debian Policy: Version Format](https://www.debian.org/doc/debian-policy/ch-controlfields.html#version)
55 changes: 55 additions & 0 deletions fdbox-git/lure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name="fdbox-git"
version="0.0.0"
release="1"
desc="FreeDOS-like shell and utilities for Linux"
homepage="https://github.com/diegoiast/fdbox"
maintainer="Foad <foad@example.com>"
architectures=("amd64")
license=("GPL-3.0-only")
provides=("fdbox")
conflicts=("fdbox")

# Build Dependencies
# - cmake & git: required for build configuration and CPM downloads
# - python3: detected/used during configuration
# - build-essential: for gcc/make
build_deps=("git" "cmake" "build-essential" "python3")

# Runtime Dependencies
deps=("libc6")

sources=("git+https://github.com/diegoiast/fdbox.git")
checksums=("SKIP")

version() {
cd "$srcdir/fdbox"
# Generates a version string like r123.abc1234
printf "0.0.0.r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
# 1. Create build directory
mkdir -p "$srcdir/fdbox/build"
cd "$srcdir/fdbox/build"

# 2. Run CMake
# We run this in prepare() because it downloads dependencies (CPM)
# and requires internet access.
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
}

build() {
cd "$srcdir/fdbox/build"
# 3. Compile
make
}

package() {
cd "$srcdir/fdbox/build"

# 4. Install
# Try using the standard make install.
# The '||' operator ensures that if 'make install' fails (e.g., no target defined),
# we fall back to installing the binary manually.
make DESTDIR="$pkgdir" install || install -Dm755 fdbox "$pkgdir/usr/bin/fdbox"
}
156 changes: 156 additions & 0 deletions yt-dlp-git/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# yt-dlp-git

A [LURE](https://github.com/lure-sh/lure) package for [yt-dlp](https://github.com/yt-dlp/yt-dlp), a feature-rich command-line audio/video downloader and youtube-dl fork with additional features and fixes.

## Package Information

| Field | Value |
|-------|-------|
| Upstream | https://github.com/yt-dlp/yt-dlp |
| License | Unlicense |
| Architecture | `all` (pure Python) |
| Provides | `yt-dlp` |
| Conflicts | `yt-dlp` |

Based on the [AUR yt-dlp-git package](https://aur.archlinux.org/packages/yt-dlp-git) by katt.

## Building

```bash
cd yt-dlp-git
lure build
```

## Installation

```bash
sudo apt install ./yt-dlp-git_*.deb
```

This will automatically remove any existing `yt-dlp` package from the distribution repositories due to the `conflicts` declaration.

## Verification

```bash
yt-dlp --version
```

## Dependencies

### Build Dependencies

- `git` — for cloning and version detection
- `make` — for running build targets
- `pandoc` — for generating man pages and documentation
- `python3-all` — Python interpreter
- `python3-build` — PEP 517 build frontend
- `python3-installer` — for installing wheels
- `python3-wheel` — wheel support
- `python3-pip` — for installing newer build dependencies

### Runtime Dependencies

- `python3`, `python3-certifi`, `python3-requests`, `python3-urllib3` — core requirements
- `python3-mutagen` — metadata handling
- `python3-pycryptodome` — AES-128 HLS stream decryption
- `python3-websockets` — websocket download support
- `python3-brotli` — brotli content encoding
- `ffmpeg` — video/audio post-processing (essential for merging formats)

## Lessons Learned

### 1. Ubuntu/Debian packages can be too old for bleeding-edge Python projects

**Problem:** yt-dlp's `pyproject.toml` requires `hatchling>=1.27.0`, but Ubuntu Noble (24.04) provides `python3-hatchling` version 1.21.0.

**Error message:**
```
ERROR Missing dependencies:
hatchling>=1.27.0
```

**Solution:** Install newer build dependencies via pip during the build phase instead of relying on system packages:

```bash
build_deps=("..." "python3-pip") # Add pip to build deps

build() {
# Install newer hatchling that meets requirements
python3 -m pip install --user --break-system-packages "hatchling>=1.27.0"
...
}
```

### 2. Trove classifiers must recognize new Python versions

**Problem:** After fixing hatchling, the build failed because `trove-classifiers` (2024.1.31) didn't recognize `Programming Language :: Python :: 3.14`.

**Error message:**
```
ValueError: Unknown classifier in field `project.classifiers`: Programming Language :: Python :: 3.14
```

**Solution:** Also install a newer `trove-classifiers` via pip:

```bash
python3 -m pip install --user --break-system-packages \
"hatchling>=1.27.0" \
"trove-classifiers>=2024.10.0"
```

### 3. The `--break-system-packages` flag is required on modern Debian/Ubuntu

PEP 668 introduced "externally managed environments" which prevents pip from modifying system Python packages by default. For build-time dependencies that won't persist after package installation, using `--break-system-packages` with `--user` is acceptable.

### 4. Package conflicts and provides work correctly

When `conflicts=("yt-dlp")` and `provides=("yt-dlp")` are declared:
- `apt` automatically removes the conflicting package during installation
- Reverse dependencies (like `hypnotix`) remain satisfied because the new package `provides` the same capability

### 5. Version function for git packages

The version function generates Debian-compatible versions from git tags:

```bash
version() {
cd "$srcdir/yt-dlp"
git describe --long --tags --abbrev=7 --exclude=nightly | \
sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
```

This produces versions like `2025.12.08.r53.g27afb31` where:
- `2025.12.08` — latest tag
- `r53` — 53 commits since tag
- `g27afb31` — git commit hash

### 6. Architecture `all` for pure Python packages

Since yt-dlp is pure Python with no compiled extensions, using `architectures=("all")` produces a single `.deb` that works on any architecture (amd64, arm64, armhf, etc.).

## AUR Discussion Notes

From the [AUR comments](https://aur.archlinux.org/packages/yt-dlp-git) (as of 2025-11-15):

- The `yt-dlp-ejs` optional dependency provides non-deprecated YouTube support
- Version pinning between `yt-dlp` and `yt-dlp-ejs` is a known complexity
- The check function may need `--deselect` for websocket tests until python-websockets updates

## Optional Dependencies (not included by default)

For additional functionality, consider installing:

- `rtmpdump` — RTMP stream support
- `atomicparsley` — embedding thumbnails in m4a files
- `aria2` — external downloader support
- `phantomjs` — JavaScript-based extractors
- `python3-secretstorage` — browser cookie extraction (GNOME keyring)
- `python3-xattr` — xattr metadata support

## See Also

- [yt-dlp documentation](https://github.com/yt-dlp/yt-dlp#readme)
- [yt-dlp supported sites](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)
- [LURE documentation](https://github.com/lure-sh/lure)
- [AUR yt-dlp-git](https://aur.archlinux.org/packages/yt-dlp-git)
50 changes: 50 additions & 0 deletions yt-dlp-git/lure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name="yt-dlp-git"
version="0.0.0"
release="1"
desc="A feature-rich command-line audio/video downloader"
homepage="https://github.com/yt-dlp/yt-dlp"
maintainer="Your Name <email@example.com>"
architectures=("all")
license=("Unlicense")
provides=("yt-dlp")
conflicts=("yt-dlp")

# Build Dependencies (Debian/Ubuntu names)
# NOTE: We exclude python3-hatchling because Ubuntu's version is too old
# We'll install hatchling via pip during build instead
build_deps=("git" "make" "pandoc" "python3-all" "python3-build" "python3-installer" "python3-wheel" "python3-pip")

# Runtime Dependencies
deps=("python3" "python3-certifi" "python3-requests" "python3-urllib3" "python3-mutagen" "python3-pycryptodome" "python3-websockets" "python3-brotli" "ffmpeg")

sources=("git+https://github.com/yt-dlp/yt-dlp.git")
checksums=("SKIP")

version() {
cd "$srcdir/yt-dlp"
git describe --long --tags --abbrev=7 --exclude=nightly | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
cd "$srcdir/yt-dlp"
git clean -dfx
}

build() {
cd "$srcdir/yt-dlp"

# Install hatchling>=1.27.0 (Ubuntu's version is too old)
python3 -m pip install --user --break-system-packages "hatchling>=1.27.0" "trove-classifiers>=2024.10.0"

# Ensure ~/.local/bin is in PATH for hatchling
export PATH="$HOME/.local/bin:$PATH"

make pypi-files
python3 devscripts/make_lazy_extractors.py
python3 -m build --wheel --no-isolation
}

package() {
cd "$srcdir/yt-dlp"
python3 -m installer --destdir="$pkgdir" dist/*.whl
}
Loading