deb-mock/Makefile

80 lines
No EOL
2.5 KiB
Makefile

.PHONY: help install install-dev test clean lint format docs
help: ## Show this help message
@echo "Deb-Mock - Debian Package Build Environment"
@echo ""
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
install: ## Install deb-mock (for Debian package build)
@echo "Installation handled by dh-python"
install-dev: ## Install deb-mock with development dependencies
pip install -e .
pip install -r requirements-dev.txt
test: ## Run tests
python -m pytest tests/ -v
test-coverage: ## Run tests with coverage
python -m pytest tests/ --cov=deb_mock --cov-report=html --cov-report=term
lint: ## Run linting checks
@echo "=== Running Python linting ==="
flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503
black --check --line-length=120 deb_mock/ tests/
isort --check-only --profile=black deb_mock/ tests/
@echo "=== Running YAML linting ==="
yamllint .forgejo/workflows/ deb_mock/configs/ test-config.yaml
@echo "=== Running shell linting ==="
find . -name "*.sh" -exec shellcheck {} \;
@echo "✅ All linting checks passed!"
format: ## Format code with black
black deb_mock/ tests/
clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf output/
rm -rf metadata/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
docs: ## Build documentation
cd docs && make html
install-system-deps: ## Install system dependencies (requires sudo)
sudo apt update
sudo apt install -y sbuild schroot debhelper build-essential debootstrap yamllint shellcheck
install-lint-deps: ## Install linting dependencies
pip install flake8 black isort bandit
sudo apt install -y yamllint shellcheck nodejs npm
sudo npm install -g markdownlint-cli
setup-chroot: ## Setup initial chroot environment (requires sudo)
sudo mkdir -p /var/lib/deb-mock/chroots
sudo mkdir -p /etc/schroot/chroot.d
sudo chown -R $$USER:$$USER /var/lib/deb-mock
build-example: ## Build an example package (requires setup)
deb-mock init-chroot bookworm-amd64
deb-mock build examples/hello_1.0.dsc
check: ## Run all checks (lint, test, format)
$(MAKE) lint
$(MAKE) test
$(MAKE) format
dist: ## Build distribution package
python setup.py sdist bdist_wheel
upload: ## Upload to PyPI (requires twine)
twine upload dist/*
dev-setup: ## Complete development setup
$(MAKE) install-system-deps
$(MAKE) setup-chroot
$(MAKE) install-dev