mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
Restore Homebrew and Debian package manager support
- Add Homebrew formula (brew_dist/archivebox.rb) using virtualenv pattern
with auto-generation via homebrew-pypi-poet in bin/build_brew.sh
- Add Debian packaging via nFPM (pkg/debian/) with thin .deb that pip-installs
archivebox into /opt/archivebox/venv on postinstall
- Add build/release scripts: bin/{build,release}_{brew,deb}.sh
- Update CI workflows to build packages on release and test them
- Update README apt/brew install instructions with working commands
- Update bin/setup.sh to use .deb download instead of old Launchpad PPA
https://claude.ai/code/session_01Vx1EsNrNySgsc8Y67dGzCn
This commit is contained in:
101
bin/build_brew.sh
Executable file
101
bin/build_brew.sh
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
### Bash Environment Setup
|
||||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
||||
# set -o xtrace
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
IFS=$'\n'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
FORMULA_FILE="$REPO_DIR/brew_dist/archivebox.rb"
|
||||
|
||||
echo "[+] Building Homebrew formula for archivebox==${VERSION}..."
|
||||
|
||||
# Create a temporary virtualenv for generating the formula
|
||||
TMPDIR="$(mktemp -d)"
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
python3 -m venv "$TMPDIR/venv"
|
||||
source "$TMPDIR/venv/bin/activate"
|
||||
|
||||
pip install --quiet "archivebox==${VERSION}" homebrew-pypi-poet 2>/dev/null
|
||||
|
||||
echo "[+] Generating resource stanzas with homebrew-pypi-poet..."
|
||||
RESOURCES="$(poet archivebox)"
|
||||
|
||||
# Get the sdist URL and SHA256 from PyPI
|
||||
SDIST_URL="$(pip download --no-binary :all: --no-deps -d "$TMPDIR/sdist" "archivebox==${VERSION}" 2>&1 | grep -oP 'https://\S+\.tar\.gz' | head -1 || true)"
|
||||
if [ -z "$SDIST_URL" ]; then
|
||||
SDIST_URL="https://files.pythonhosted.org/packages/source/a/archivebox/archivebox-${VERSION}.tar.gz"
|
||||
fi
|
||||
SDIST_SHA256="$(pip hash "$TMPDIR/sdist/"*.tar.gz 2>/dev/null | grep 'sha256:' | cut -d: -f2 || echo '')"
|
||||
|
||||
deactivate
|
||||
|
||||
echo "[+] Updating formula file: $FORMULA_FILE"
|
||||
|
||||
# Build the formula from the template
|
||||
cat > "$FORMULA_FILE" << RUBY
|
||||
# This formula is auto-generated by bin/build_brew.sh using homebrew-pypi-poet.
|
||||
# To update: run bin/build_brew.sh, or trigger the GitHub Actions homebrew workflow.
|
||||
#
|
||||
# Users install with:
|
||||
# brew tap archivebox/archivebox
|
||||
# brew install archivebox
|
||||
|
||||
class Archivebox < Formula
|
||||
include Language::Python::Virtualenv
|
||||
|
||||
desc "Self-hosted internet archiving solution"
|
||||
homepage "https://github.com/ArchiveBox/ArchiveBox"
|
||||
url "${SDIST_URL}"
|
||||
sha256 "${SDIST_SHA256}"
|
||||
license "MIT"
|
||||
head "https://github.com/ArchiveBox/ArchiveBox.git", branch: "dev"
|
||||
|
||||
depends_on "python@3.13"
|
||||
depends_on "node"
|
||||
depends_on "git"
|
||||
depends_on "wget"
|
||||
depends_on "curl"
|
||||
depends_on "ripgrep"
|
||||
depends_on "yt-dlp"
|
||||
|
||||
# Python dependency resource blocks auto-generated by homebrew-pypi-poet
|
||||
# AUTOGENERATED_RESOURCES_START
|
||||
${RESOURCES}
|
||||
# AUTOGENERATED_RESOURCES_END
|
||||
|
||||
def install
|
||||
virtualenv_install_with_resources
|
||||
end
|
||||
|
||||
def post_install
|
||||
# Install runtime dependencies (plugins, JS extractors, etc.)
|
||||
system bin/"archivebox", "install", "--binproviders", "pip,npm"
|
||||
end
|
||||
|
||||
service do
|
||||
run [opt_bin/"archivebox", "server", "--quick-init", "0.0.0.0:8000"]
|
||||
keep_alive crashed: true
|
||||
working_dir var/"archivebox"
|
||||
log_path var/"log/archivebox.log"
|
||||
error_log_path var/"log/archivebox.log"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("#{bin}/archivebox version")
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
||||
echo "[√] Formula updated: $FORMULA_FILE"
|
||||
echo " Version: ${VERSION}"
|
||||
echo " URL: ${SDIST_URL}"
|
||||
Reference in New Issue
Block a user