Add lint rule for "~ppa" in version strings#4
Open
uraltun wants to merge 1 commit intoubuntu:mainfrom
Open
Conversation
enr0n
requested changes
Mar 20, 2026
Collaborator
enr0n
left a comment
There was a problem hiding this comment.
Thanks! I think this is a good addition overall, just some requests on the implementation.
dd2849c to
f2eda5b
Compare
Checks that "~ppa" is not present in uploads to the archive, or that it is present for uploads to a PPA. Also added a test for the new linter, including mock profiles to use when testing. Added a new profile for ppa uploads, which only contains the new hook for now.
f2eda5b to
486ee91
Compare
uraltun
commented
Mar 23, 2026
|
|
||
| if target == "ppa": | ||
| if not version_contains_ppa: | ||
| raise HookException("upload to ppa does not include ~ppa in version string") |
Author
There was a problem hiding this comment.
Raising this exception here manifests as dput crashing. Probably a nicer way to return a failure that isn't a crash.
enr0n
reviewed
Mar 23, 2026
| ) | ||
|
|
||
|
|
||
| def check_ppa_version_string(changes: Changes, profile: dict): |
Collaborator
There was a problem hiding this comment.
To clarify, my previous suggestion was to keep this entirely contained in dput.py, so no additions are needed to linters.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a check requiring "~ppa" in the version string for PPA uploads and the opposite for archive uploads. Includes a change to the
Contextobject required to pass in the upload profile to detect upload destination, as well as a test for the new linter.Also added a new
ppaprofile which runs when an upload is meant for a PPA. Currently only includes the newly added check.Open to feedback on the hook name, as well as whether or not it should count as a fail for PPA uploads instead of a warn (I think why not, though I may have missed valid contexts for doing so).