Skip to content

Add modern Debian/Ubuntu packaging for Python 3 (PEP 517, autopkgtest)#87

Open
sarsolot wants to merge 5 commits intocfv-project:python3from
sarsolot:debian/packaging
Open

Add modern Debian/Ubuntu packaging for Python 3 (PEP 517, autopkgtest)#87
sarsolot wants to merge 5 commits intocfv-project:python3from
sarsolot:debian/packaging

Conversation

@sarsolot
Copy link

Add modern Debian/Ubuntu packaging for Python 3 (PEP 517, autopkgtest)

Summary

This PR adds/upgrades in-tree Debian/Ubuntu packaging for the Python 3 version of cfv (the python3 branch).
The existing debian/ directory in the repo appears to be from the legacy Python 2 era; this replaces it with modern packaging suitable for current Debian/Ubuntu workflows.

What’s included

  • Modern debhelper-compat (= 13) + dh-sequence-python3
  • PEP 517 / pyproject.toml build via pybuild (PYBUILD_SYSTEM=pyproject)
  • Minimal debian/rules and Rules-Requires-Root: no
  • autopkgtest:
    • cfv --help smoke test
    • Small functional test: generate a checksum file (sha1) and verify it (no network, no source-tree dependency)
  • Installs the existing cfv.1 man page via debian/cfv.manpages
  • DEP-5 debian/copyright (includes MIT BitTorrent code licensing)
  • debian/watch included for future release monitoring
  • Builds/tests are network-free

Tested

Locally verified on Ubuntu with:

  • dpkg-buildpackage -b
  • lintian -IE --pedantic (only remaining notes relate to upstream LICENSE placement, which is acceptable)
  • autopkgtest -B . -- null (PASS)

Ubuntu PPA

For convenience (and to demonstrate it builds/installs cleanly), builds are published in Launchpad PPA:

  • ppa:sarsolot/cfv

Notes for Debian

I’m not a Debian maintainer, but I tried to keep the packaging aligned with Debian best practices so it can be adopted with minimal changes later (mainly versioning/changelog targeting unstable / UNRELEASED and any maintainer-field conventions a sponsor may prefer).

Happy to iterate on this based on maintainer or sponsor feedback.

Complete rewrite of Debian packaging for the Python 3 version:

* Migrate from Python 2 to Python 3
* Switch to PEP 517 build system (pyproject.toml with setuptools.build_meta)
* Update to debhelper-compat 13 and dh-sequence-python3
* Add autopkgtest with smoke test and functional verification
* Update to Standards-Version 4.7.0
* Add explicit man page installation via debian/cfv.manpages
* Modernize debian/copyright to DEP-5 format (includes MIT license for BitTorrent code)
* Add debian/watch file for upstream release monitoring
* Remove obsolete Python 2 era files (compat, dirs, docs, README.Debian)
* Update Vcs-* fields to point to GitHub repository
* Target Ubuntu 25.10 (questing) for PPA upload

Packaging suitable for both Ubuntu PPA and future Debian submission.
@sarsolot sarsolot mentioned this pull request Jan 24, 2026
@lxp
Copy link
Member

lxp commented Jan 28, 2026

Thanks for your effort in updating the Debian packaging!

Since I do not know much myself about Debian packaging standards, I would suggest to just merge your changes, since it can only get better from the current broken state. I only noticed two things:

You do not run the unit and integration tests in the autopkgtests. Was this an intentional decision?
For example, the CI shows how to run them:

- name: Run unit tests
run: python -W error -bb test/test.py --unit --exit-early
- name: Run integration tests (internal)
run: |
ulimit -n
ulimit -n 4096
python -W error -bb test/test.py -i --exit-early
- name: Run integration tests (external process)
run: |
ulimit -n
ulimit -n 4096
test/test.py -e --exit-early

Your current version 3.2.0+git20251102.8533a22-1~ubuntu25.10.1~ppa1 does not reflect the version the currently unreleased development version used by cfv:

__version__ = '3.2.1.dev0'

Does the .dev0 suffix make problems in Debian package versioning?
(In Python packaging 3.2.1.dev0 is smaller than 3.2.1: https://packaging.python.org/en/latest/discussions/versioning/)

- Bump version from 3.2.0 to 3.2.1~dev0 to match Python version 3.2.1.dev0
- The ~ prefix ensures proper Debian version sorting (sorts before release)
- Simplify version to 1~ppa2 (remove Ubuntu version suffix)
- Update Standards-Version from 4.7.0 to 4.7.2
Add cfv-upstream test script that runs:
- Unit tests (test.py --unit)
- Integration tests - internal (test.py -i)
- Integration tests - external process (test.py -e)

The test script provides a 'python' shim for upstream tests that use
environment.

This matches the test suite run in CI and addresses maintainer feedback
about running tests in autopkgtests.
@sarsolot
Copy link
Author

Thanks a lot for the review - much appreciated.

Even though I have been a long-time Debian/Ubuntu user (and admin), Debian packaging itself is something I am still actively learning, so the feedback was very helpful.

For now I:

  • added the upstream unit + integration tests to autopkgtest (reusing the same commands as CI),
  • aligned the snapshot versioning with upstream (3.2.1~dev0, so it upgrades cleanly to a future 3.2.1).

One thought: it might make sense to merge the packaging first for Ubuntu (PPA), but keep this Debian issue open. A working PPA and in-tree debian/ files are a good step, but they are not the same as an official Debian package yet.

Additionally, it may be smoother to finalize/merge the Debian packaging once the BLAKE3 and xxh/xxhsfv PRs are merged, so the packaging can reflect them properly (e.g. via Suggests: python3-blake3, python3-xxhash) rather than revisiting it again shortly after.

@lxp
Copy link
Member

lxp commented Jan 31, 2026

Thanks for the iteration, it looks good to me.

I agree that this PR does not fully solve #4, but it is the first milestone for solving the issue.

I have no objection to delay this PR until the others are merged. I will take a look at the BLAKE3 MR in the next days.

@lxp lxp self-requested a review January 31, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments