Skip to content

Add lint rule for "~ppa" in version strings#4

Open
uraltun wants to merge 1 commit intoubuntu:mainfrom
uraltun:ppa-in-version-string
Open

Add lint rule for "~ppa" in version strings#4
uraltun wants to merge 1 commit intoubuntu:mainfrom
uraltun:ppa-in-version-string

Conversation

@uraltun
Copy link

@uraltun uraltun commented Mar 20, 2026

Added a check requiring "~ppa" in the version string for PPA uploads and the opposite for archive uploads. Includes a change to the Context object required to pass in the upload profile to detect upload destination, as well as a test for the new linter.

Also added a new ppa profile 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).

Copy link
Collaborator

@enr0n enr0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this is a good addition overall, just some requests on the implementation.

@uraltun uraltun force-pushed the ppa-in-version-string branch from dd2849c to f2eda5b Compare March 20, 2026 16:38
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.
@uraltun uraltun force-pushed the ppa-in-version-string branch from f2eda5b to 486ee91 Compare March 23, 2026 19:16

if target == "ppa":
if not version_contains_ppa:
raise HookException("upload to ppa does not include ~ppa in version string")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raising this exception here manifests as dput crashing. Probably a nicer way to return a failure that isn't a crash.

)


def check_ppa_version_string(changes: Changes, profile: dict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, my previous suggestion was to keep this entirely contained in dput.py, so no additions are needed to linters.py.

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