Add custom exception hierarchy (PackageUpdateError, PackageNotFoundError, RepositoryStateError, ExternalCommandError, MissingToolError) for specific error handling throughout package update operations. Extract helper functions from 90-line update_package function: - validate_package_info: Package validation - resolve_package_directories: Path resolution - ensure_package_checkout: Salsa checkout with error handling - validate_repository_state: Check for uncommitted changes - run_gbp_pq_workflow: Run gbp pq import/switch with error checks - import_upstream_version: Import upstream using gbp - run_command: Centralized subprocess execution with consistent errors - check_required_tools: Validate required tools upfront Incorporate update scripts as Python functions (replaces external shell scripts): - update_debian_control: Update Standards-Version, remove obsolete fields - update_debian_copyright_year: Update copyright years to current - update_debian_watch: Upgrade watch files from version 4 to 5 - add_salsa_ci: Add debian/salsa-ci.yml if missing - run_package_updates: Orchestrator for all update operations Enhance network error handling in fetch_todo_list: - Handle HTTP errors, network errors, timeouts, invalid JSON - Add timeout parameter (default 30s) - Graceful error messages in list_todos and update_todos Add comprehensive test coverage: - 67 tests for update-pkg functionality - Tests for all helper functions and update operations - Network error handling tests - 125 total tests, all passing Benefits: - No external script dependencies - Consistent error handling throughout - Better error messages with actionable guidance - All update logic in one maintainable codebase Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| debian_todo | ||
| tests | ||
| AGENTS.md | ||
| LICENSE | ||
| notes | ||
| README.md | ||
| todo | ||
debian-todo
A CLI tool for Debian maintainers to track packages with new upstream versions that need updating.
Overview
This tool fetches TODO items from the Debian UDD (Ultimate Debian Database) and displays packages where a new upstream version is available. It filters out pre-release versions and shows relevant metadata like team ownership and co-uploaders.
Requirements
- Python 3.10+
- System packages:
python3-click,python3-debian,python3-rich
Install dependencies on Debian/Ubuntu:
apt install python3-click python3-debian python3-rich
Usage
# List packages needing updates (downloads todo.json if missing)
./todo list
# Include pre-release versions
./todo list --show-prerelease
# Fetch latest data and show changes
./todo update
Running ./todo without arguments is equivalent to ./todo list.
Files
todo.json- Cached TODO list from UDD (auto-downloaded)notes- Per-package notes (one package per line:<source> <note>).vcs_git_cache.json- Cache of Vcs-Git and uploader info from APT sources
Notes File Format
The notes file contains per-package annotations:
pysma needs uv_build backend
python-ftfy bad version
bleak needs new library, bumble - package uploaded
Each line starts with the source package name, followed by a note.
Configuration
The tool fetches data for a specific maintainer email configured in the TODO_URL constant. Modify this URL to track packages for a different maintainer.
Testing
Run tests with pytest:
apt install python3-pytest
PYTHONPATH=. pytest tests/ -v
Features
- Filters new upstream notifications, hiding other TODO types
- Skips pre-release versions (alpha, beta, rc) by default
- Compares normalized versions to avoid false positives
- Shows team from Vcs-Git (e.g.,
python-team,HAfor homeassistant-team) - Displays uploaders when no team is set
- Responsive output: table view on wide terminals, compact view on narrow
- Caches APT source parsing for faster subsequent runs
License
MIT License. See LICENSE for details.