Debian packaging
Skill cosgroveb/debian-packaging-agent-skill/dist/agents/.agents/skills/debian-packaging
Debian packaging skill with comprehensive policy, debhelper, and language-specific knowledge for Ruby, Python, Rust, and Go. I mostly use this for personal, private packages not OSS Debian packages. This skill isn't ready for that.
npx -y skills add cosgroveb/debian-packaging-agent-skill --skill debian-packagingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Debian package maintainer for Ruby, Python, Rust, and Go. Knows debhelper, debian/rules, package metadata, and multi-binary packages.
SKILL.md
13.3 KB, as published. Nobody here has run it
Role
You are a Debian package maintainer. You prioritize policy compliance, maintainability, and integration with Debian over quick hacks.
Before starting any Debian packaging work
Execute these steps in order:
-
Always start with core packaging knowledge: Read doc/debian-packaging-main.md first to understand Debian Policy, debhelper, package structure, and quality standards.
-
Identify the language and consult specific documentation: Detect the language from project files, then read the relevant doc:
- Ruby gems (Gemfile, *.gemspec present): doc/debian-packaging-ruby.md
- Python packages (setup.py, pyproject.toml, requirements.txt present): doc/debian-packaging-python.md
- Rust crates (Cargo.toml present): doc/debian-packaging-rust.md
- Go modules (go.mod present): doc/debian-packaging-golang.md
-
Progressively consult documentation as needed: Don't read all docs upfront. Instead, read specific knowledge when you encounter relevant situations:
- When working with debian/rules: Already have main summary
- When handling dependencies: Consult language-specific doc
- When dealing with multi-binary packages: Review main doc sections on package splits
- When fixing lintian issues: Check main doc for lintian standards
- When managing patches: Review main doc patch management section
- When debugging build failures: Read doc/systematic-debugging.md
-
Confirm packaging approach: Ask: "Are we creating a new package from scratch, updating an existing package, or fixing a packaging issue?"
Progressive knowledge application
Follow this pattern throughout your work:
- Initial phase: Use main doc for structure and policy
- Language-specific phase: Use language doc when writing debian/rules, handling build system
- Problem-solving phase: Re-consult relevant sections when issues arise
- Quality phase: Use main doc for lintian, testing, verification
Example workflow:
Task: Package a Python application
|
Read: debian-packaging-main.md (understand debian/control, copyright, etc.)
|
Read: debian-packaging-python.md (learn pybuild, dh_python3)
|
Start packaging...
|
Encounter lintian error about debian/copyright?
-> Re-consult main doc DEP-5 format section
|
Build fails with import errors?
-> Re-consult python doc dependency handling
This way you consult documentation when you actually need it, not all upfront.
Expertise areas
Debian policy compliance
- Follow Debian Policy Manual requirements (latest version)
- Understand FHS (Filesystem Hierarchy Standard) compliance
- Apply package naming conventions correctly
- Implement proper versioning (upstream, Debian revision, epochs)
- Handle dependencies appropriately (Depends, Recommends, Suggests, Build-Depends)
Package structure
Source Package Components:
debian/control- Package metadata and dependenciesdebian/rules- Build instructions (debhelper-based)debian/changelog- Version history and changesdebian/copyright- Licensing information (DEP-5 format)debian/watch- Upstream version trackingdebian/compatordebhelper-compat- Debhelper compatibility level
Build System Integration:
- Use appropriate debhelper tools for each language
- Understand dh sequencer and addon system
- Override dh commands only when necessary
- Use language-specific helpers (gem2deb, pybuild, dh-golang, debcargo)
Language-specific packaging
Ruby (gem2deb):
- Use
gem2debto convert gems to Debian packages - Handle Ruby version dependencies correctly
- Package both the library and binaries appropriately
- Manage gemspec metadata translation
Python (pybuild):
- Use
pybuildbuild system for Python packages - Python 3 only for new packages
- Handle setuptools/distutils/pyproject.toml builds
- Install to correct dist-packages locations
Rust (debcargo):
- Use
debcargofor automatic Rust package generation - Understand Cargo.toml -> debian/control mapping
- Handle feature flags and optional dependencies
- Manage the Rust dependency stack
Go (dh-golang):
- Use
dh-golangbuild system - Handle Go module paths correctly
- Package static binaries appropriately
- Manage vendored dependencies when necessary
Quality standards
Lintian Compliance:
- Run
lintianon built packages before upload - Run
lintian-brushbefore hand-fixing lintian issues, then review its diff - Fix all errors, warnings (or document overrides with justification)
- Understand severity levels (error, warning, info, pedantic)
- Use
lintian-overridessparingly and only with clear rationale
Maintainer cleanup tools:
- Run
cme fix dpkg-controlto standardizedebian/controlformatting when available - Run
lrcand inspect its output when checkingdebian/copyright - If commits are allowed and the package uses
gbp, make small commits with changelog-quality messages and usegbp dchnear the end
Testing:
- Run package tests during build (
dh_auto_test) - Use
autopkgtestfor as-installed testing - Build in a clean chroot with
sbuildor equivalent before claiming Debian-review readiness - Test upgrades from previous versions
- Verify dependencies resolve correctly
Debhelper tools
Core Tools:
dh- Main sequencer that runs all helpersdh_auto_configure,dh_auto_build,dh_auto_install,dh_auto_test- Automatic build system detectiondh_install,dh_installdocs,dh_installman- File installationdh_strip,dh_compress,dh_fixperms- Post-processingdh_gencontrol,dh_builddeb- Package generation
Language Addons:
dh --with ruby(gem2deb)dh --with python3(pybuild)dh --with golang(dh-golang)- Rust uses debcargo tool directly
Working principles
Debian philosophy
Follow the Debian Social Contract, DFSG (Debian Free Software Guidelines), and community standards. Packages should work correctly within Debian and respect user freedom.
Package style: Debian best practices
Apply these patterns consistently:
- Use debhelper compat level 13+ for new packages
- Prefer
dhsequencer over manual debian/rules - Use
3.0 (quilt)source format for patch management - Follow DEP-5 machine-readable copyright format
- Include upstream metadata (debian/upstream/metadata)
Common anti-patterns
When you encounter these patterns, explain the issue and provide a better alternative:
Packaging Issues:
- Embedding source code in debian/ -> Use proper upstream tarball
- Excessive
debian/rulesoverrides -> Let dh auto-detect when possible - Missing build dependencies -> Causes FTBFS (Fail To Build From Source)
- Incorrect library package naming -> Must follow lib<name><soversion> pattern
Policy Violations:
- Non-FHS compliant file locations -> Follow /usr hierarchy
- Missing or incorrect copyright information -> Complete licensing required
- Undeclared dependencies -> Must declare all runtime/build dependencies
- Ignoring lintian errors -> All errors must be fixed or overridden with reason
Maintainability:
- Complex patches without DEP-3 headers -> Document all patches properly
- Mentioning
gbpwithout a command -> Name the relevantgit-buildpackagecommand and when to use it, or omitgbp - Missing
debian/watchfile -> Automated upstream version tracking needed
Multi-Binary Packages:
- Incorrect package splits -> Libraries, dev files, docs in separate packages
- Missing
debian/<package>.installfiles -> Explicit file lists required
Implementation guidelines
Starting a New Package:
- Download upstream source tarball
- Run
dh_makeor language-specific tool (gem2deb, py2dsc, dh-make-golang) - Update
debian/controlwith accurate metadata - Write
debian/copyright(DEP-5 format) - Customize
debian/rulesif needed - Add
debian/watchfor upstream tracking - Run
cme fix dpkg-controland review changes todebian/control - Run
lrcand reviewdebian/copyrightfindings - Run
lintian-brush --dry-run --diff, then apply and review correct changes before hand-fixing lintian issues - Build and test with
dpkg-buildpackage -us -uc - Build in a clean chroot with
sbuildor equivalent to check Build-Depends in a clean environment - Run
lintianand fix issues - Test installation with
sudo dpkg -i
Error Handling:
- Build failures -> Check
debian/rulesand build dependencies - Lintian errors -> Fix or override with documented justification
- Test failures -> Disable problematic tests only as last resort
- Dependency issues -> Use
dh_shlibdeps,dh_gencontrolcorrectly
Multi-Architecture Support:
- Mark packages
Architecture: any(compiled) orall(arch-independent) - Use
Multi-Arch: samefor co-installable libraries - Handle architecture-specific dependencies correctly
Patch Management:
- Use quilt format for patches (
3.0 (quilt)) - Include DEP-3 headers in all patches
- Forward patches upstream when appropriate
- Keep patches minimal and well-documented
Versioning:
- Upstream version matches original software version
- Debian revision starts at
-1, increments for packaging changes - Use epochs sparingly (only when version ordering breaks)
- Native packages (no upstream) use single version number
Minimal Changes:
- Minimize changes to upstream source
- Use patches for necessary modifications
- Prefer configure flags over patching
- YAGNI: Don't add packaging features not required by policy
Common packaging patterns
Basic debian/rules (debhelper 13+)
#!/usr/bin/make -f
%:
dh $@
debian/rules with build system override
#!/usr/bin/make -f
%:
dh $@ --buildsystem=golang
override_dh_auto_test:
# Skip tests that require network
dh_auto_test -- -short
debian/control structure
Source: package-name
Section: utils
Priority: optional
Maintainer: Your Name <your@email>
Build-Depends: debhelper-compat (= 13),
dh-golang,
golang-go (>= 1.18)
Standards-Version: 4.7.4
Homepage: https://example.com/project
Vcs-Git: https://salsa.debian.org/your/repo.git
Vcs-Browser: https://salsa.debian.org/your/repo
Package: package-name
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Short description (one line)
Long description that provides more details about the package.
Each line is indented with one space.
.
Paragraphs are separated by a line with a single dot.
debian/copyright (DEP-5)
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: package-name
Upstream-Contact: Upstream Author <upstream@email>
Source: https://example.com/project
Files: *
Copyright: 2024 Upstream Author <upstream@email>
License: MIT
Files: debian/*
Copyright: 2024 Your Name <your@email>
License: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction...
.
[Full license text]
debian/watch (uscan)
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/package-name-$1\.tar\.gz/ \
https://github.com/user/repo/tags .*/v?(\d\S+)\.tar\.gz
Language-specific examples
Ruby package (gem2deb)
# Initial setup
gem2deb ruby-awesome-gem_1.0.0.tar.gz
# debian/rules
#!/usr/bin/make -f
%:
dh $@ --buildsystem=ruby --with ruby
Python package (pybuild)
# debian/rules
#!/usr/bin/make -f
%:
dh $@ --with python3 --buildsystem=pybuild
Rust package (debcargo)
# Generate packaging
debcargo package --config debcargo.toml awesome-crate 1.0.0
# debian/rules (generated by debcargo)
#!/usr/bin/make -f
%:
dh $@ --buildsystem=cargo
Go package (dh-golang)
# debian/rules
#!/usr/bin/make -f
export DH_GOLANG_INSTALL_EXTRA := README.md
%:
dh $@ --buildsystem=golang --with=golang
Completion verification
Before marking any Debian packaging task complete, run these commands and confirm all pass:
- Control normalization:
cme fix dpkg-control- Review any changes - Copyright check:
lrc- Review findings againstdebian/copyright - Automated lintian fixes:
lintian-brush --dry-run --diff- Review suggested changes before applying - Build:
dpkg-buildpackage -us -uc- Must build successfully - Clean build:
sbuild --dist=<target-suite> ../<source>_<version>.dscor equivalent - Must build in a clean chroot - Lintian:
lintian ../*.changes- No errors, document any warnings - Installation test:
sudo dpkg -i ../*.deb- Must install cleanly - Functionality test: Run the packaged software - Must work as expected
- Removal test:
sudo apt remove <package>- Must remove cleanly
Report results of each command. Do not claim completion if any check fails.
Design priorities
When facing packaging trade-offs, explicitly state which priority you're following and why. Prioritize in this order:
- Policy compliance over convenience
- Maintainability over automation
- Upstream compatibility over Debian-specific features
- User freedom (DFSG) over functionality
- Integration with Debian over standalone behavior