diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/debputy/lsp/lsp_debian_control_reference_data.py | 239 | ||||
-rw-r--r-- | src/debputy/plugin/debputy/private_api.py | 2 |
2 files changed, 94 insertions, 147 deletions
diff --git a/src/debputy/lsp/lsp_debian_control_reference_data.py b/src/debputy/lsp/lsp_debian_control_reference_data.py index feed858..4237d64 100644 --- a/src/debputy/lsp/lsp_debian_control_reference_data.py +++ b/src/debputy/lsp/lsp_debian_control_reference_data.py @@ -223,6 +223,61 @@ ALL_SECTIONS = _allowed_values( ] ) +ALL_PRIORITIES = _allowed_values( + Keyword( + "required", + hover_text=textwrap.dedent( + """\ + The package is necessary for the proper functioning of the system (read: dpkg needs it). + + Applicable if dpkg *needs* this package to function and it is not a library. + + No two packages that both have a priority of *standard* or higher may conflict with + each other. + """ + ), + ), + Keyword( + "important", + hover_text=textwrap.dedent( + """\ + The *important* packages are a bare minimum of commonly-expected and necessary tools. + + Applicable if 99% of all users in the distribution needs this package and it is not a library. + + No two packages that both have a priority of *standard* or higher may conflict with + each other. + """ + ), + ), + Keyword( + "standard", + hover_text=textwrap.dedent( + """\ + These packages provide a reasonable small but not too limited character-mode system. This is + what will be installed by default (by the debian-installer) if the user does not select anything + else. This does not include many large applications. + + Applicable if your distribution installer will install this package by default on a new system + and it is not a library. + + No two packages that both have a priority of *standard* or higher may conflict with + each other. + """ + ), + ), + Keyword( + "optional", + hover_text="This is the default priority and used by the majority of all packages" + " in the Debian archive", + ), + Keyword( + "extra", + is_obsolete=True, + replaced_by="optional", + hover_text="Obsolete alias of `optional`.", + ), +) def all_architectures_and_wildcards(arch2table) -> Iterable[Union[str, Keyword]]: wildcards = set() @@ -674,7 +729,7 @@ SOURCE_FIELDS = _fields( """\ Declares the name of the source package. - Note this must match the name in the first entry of debian/changelog file. + Note this must match the name in the first entry of `debian/changelog` file. """ ), ), @@ -686,7 +741,7 @@ SOURCE_FIELDS = _fields( """\ Declares the last semantic version of the Debian Policy this package as last checked against. - **Example*: + **Example**: ``` Standards-Version: 4.5.2 ``` @@ -705,12 +760,12 @@ SOURCE_FIELDS = _fields( """\ Define the default section for packages in this source package. - Example: + **Example**: ``` Section: devel ``` - Please see https://packages.debian.org/unstable for more details about the sections. + Please see <https://packages.debian.org/unstable> for more details about the sections. """ ), ), @@ -719,73 +774,19 @@ SOURCE_FIELDS = _fields( FieldValueClass.SINGLE_VALUE, default_value="optional", warn_if_default=False, - known_values=_allowed_values( - Keyword( - "required", - hover_text=textwrap.dedent( - """\ - The package is necessary for the proper functioning of the system (read: dpkg needs it). - - Applicable if dpkg *needs* this package to function and it is not a library. - - No two packages that both have a priority of *standard* or higher may conflict with - each other. - """ - ), - ), - Keyword( - "important", - hover_text=textwrap.dedent( - """\ - The *important* packages are a bare minimum of commonly-expected and necessary tools. - - Applicable if 99% of all users in the distribution needs this package and it is not a library. - - No two packages that both have a priority of *standard* or higher may conflict with - each other. - """ - ), - ), - Keyword( - "standard", - hover_text=textwrap.dedent( - """\ - These packages provide a reasonable small but not too limited character-mode system. This is - what will be installed by default (by the debian-installer) if the user does not select anything - else. This does not include many large applications. - - Applicable if your distribution installer will install this package by default on a new system - and it is not a library. - - No two packages that both have a priority of *standard* or higher may conflict with - each other. - """ - ), - ), - Keyword( - "optional", - hover_text="This is the default priority and used by the majority of all packages" - " in the Debian archive", - ), - Keyword( - "extra", - is_obsolete=True, - replaced_by="optional", - hover_text="Obsolete alias of `optional`.", - ), - ), + known_values=ALL_PRIORITIES, hover_text=textwrap.dedent( """\ Define the default priority for packages in this source package. The priority field describes how important the package is for the functionality of the system. - Example: + **Example**: ``` Priority: optional ``` - Unless you know you need a different value, you should choose <b>optional</b> for your packages. + Unless you know you need a different value, you should choose **optional** for your packages. """ ), ), @@ -816,8 +817,8 @@ SOURCE_FIELDS = _fields( **Example**: ``` Uploaders: - John Doe <john@doe.org>, - Lisbeth Worker <lis@worker.org>, + John Doe <john@doe.org>, + Lisbeth Worker <lis@worker.org>, ``` Formally uploaders are considered co-maintainers for the package with the party listed in the @@ -947,7 +948,7 @@ SOURCE_FIELDS = _fields( It was used to enabling Debian Maintainers to upload the package without requiring a Debian Developer to sign the package. This mechanism has been replaced by a new authorization mechanism. - Please see https://lists.debian.org/debian-devel-announce/2012/09/msg00008.html for details about the + Please see <https://lists.debian.org/debian-devel-announce/2012/09/msg00008.html> for details about the replacement. ``` """ @@ -973,7 +974,7 @@ SOURCE_FIELDS = _fields( These build-dependencies must be satisfied when executing the **build-arch** and **binary-arch** targets either directly or indirectly in addition to those listed in **Build-Depends**. - Note that these dependencies are <em>not</em> available during **clean**. + Note that these dependencies are *not* available during **clean**. """ ), ), @@ -988,7 +989,7 @@ SOURCE_FIELDS = _fields( These build-dependencies must be satisfied when executing the **build-indep** and **binary-indep** targets either directly or indirectly in addition to those listed in **Build-Depends**. - Note that these dependencies are <em>not</em> available during **clean**. + Note that these dependencies are *not* available during **clean**. """ ), ), @@ -1045,9 +1046,9 @@ SOURCE_FIELDS = _fields( Please refer to the documentation of the **autodep8** package for which values you can put into this field and what kind of testsuite the keywords will provide. - Declaring this field in *debian/control* is only necessary when you want additional tests beyond - those in *debian/tests/control* as **dpkg** automatically records the package provided ones from - *debian/tests/control*. + Declaring this field in `debian/control` is only necessary when you want additional tests beyond + those in `debian/tests/control` as **dpkg** automatically records the package provided ones from + `debian/tests/control`. """ ), ), @@ -1101,7 +1102,7 @@ SOURCE_FIELDS = _fields( performance cost. This field can be used to explicitly declare that the legacy behaviour is unnecessary. - **Example:** + **Example**: ``` Rules-Requires-Root: no ``` @@ -1180,7 +1181,7 @@ SOURCE_FIELDS = _fields( Used for non-free packages to denote that they may be auto-build on the Debian build infrastructure Note that adding this field **must** be combined with following the instructions at - https://www.debian.org/doc/manuals/developers-reference/pkgs.html#non-free-buildd + <https://www.debian.org/doc/manuals/developers-reference/pkgs.html#non-free-buildd> """ ), ), @@ -1200,7 +1201,7 @@ SOURCE_FIELDS = _fields( intended to provide a one-line summary of a package. The lines after the **Synopsis** is known as the **Extended Description** and is intended as a longer summary of a package. - **Example:** + **Example**: ``` Description: documentation generator for Python projects Sphinx is a tool for producing documentation for Python projects, using @@ -1225,7 +1226,7 @@ SOURCE_FIELDS = _fields( part is inserted into a sentence like "The package provides {{Synopsis-goes-here}}". The **Extended Description** is a standalone description that should describe what the package does and how it relates to the rest of the system (in terms of, for example, which subsystem it is which part of). - Please see https://www.debian.org/doc/debian-policy/ch-controlfields.html#description for more details + Please see <https://www.debian.org/doc/debian-policy/ch-controlfields.html#description> for more details about the description field and suggestions for how to write it. """ ), @@ -1508,7 +1509,7 @@ BINARY_FIELDS = _fields( Declare this package also provide one or more other packages. This means that this package can substitute for the provided package in some relations. - *Example*: + **Example**: ``` Package: foo ... @@ -1521,7 +1522,7 @@ BINARY_FIELDS = _fields( declare a version, then it *cannot* be used to satisfy a dependency with a version restriction. Consider the following example: - **Archive scenario*: (This is *not* a debian/control file, despite the resemblance) + **Archive scenario**: (This is *not* a `debian/control` file, despite the resemblance) ``` Package foo Depends: bar (>= 1.0) @@ -1653,7 +1654,7 @@ BINARY_FIELDS = _fields( This field is primarily used in combination with build profiles inside the build dependency related fields to reduce the number of build dependencies required during bootstrapping of a new architecture. - **Example*: + **Example**: ``` Package: foo ... @@ -1666,7 +1667,7 @@ BINARY_FIELDS = _fields( Note that there is an official list of "common" build profiles with predefined purposes along with rules for how and when the can be used. This list can be found at - https://wiki.debian.org/BuildProfileSpec#Registered_profile_names. + <https://wiki.debian.org/BuildProfileSpec#Registered_profile_names>. """ ), ), @@ -1681,12 +1682,12 @@ BINARY_FIELDS = _fields( """\ Define the section for this package. - Example: + **Example**: ``` Section: devel ``` - Please see https://packages.debian.org/unstable for more details about the sections. + Please see <https://packages.debian.org/unstable> for more details about the sections. """ ), ), @@ -1697,73 +1698,19 @@ BINARY_FIELDS = _fields( warn_if_default=False, missing_field_severity=DiagnosticSeverity.Error, inherits_from_source=True, - known_values=_allowed_values( - Keyword( - "required", - hover_text=textwrap.dedent( - """\ - The package is necessary for the proper functioning of the system (read: dpkg needs it). - - Applicable if dpkg *needs* this package to function and it is not a library. - - No two packages that both have a priority of *standard* or higher may conflict with - each other. - """ - ), - ), - Keyword( - "important", - hover_text=textwrap.dedent( - """\ - The *important* packages are a bare minimum of commonly-expected and necessary tools. - - Applicable if 99% of all users in the distribution needs this package and it is not a library. - - No two packages that both have a priority of *standard* or higher may conflict with - each other. - """ - ), - ), - Keyword( - "standard", - hover_text=textwrap.dedent( - """\ - These packages provide a reasonable small but not too limited character-mode system. This is - what will be installed by default (by the debian-installer) if the user does not select anything - else. This does not include many large applications. - - Applicable if your distribution installer will install this package by default on a new system - and it is not a library. - - No two packages that both have a priority of *standard* or higher may conflict with - each other. - """ - ), - ), - Keyword( - "optional", - hover_text="This is the default priority and used by the majority of all packages" - " in the Debian archive", - ), - Keyword( - "extra", - is_obsolete=True, - replaced_by="optional", - hover_text="Obsolete alias of `optional`.", - ), - ), + known_values=ALL_PRIORITIES, hover_text=textwrap.dedent( """\ Define the priority this package. The priority field describes how important the package is for the functionality of the system. - Example: + **Example**: ``` Priority: optional ``` - Unless you know you need a different value, you should choose <b>optional</b> for your packages. + Unless you know you need a different value, you should choose **optional** for your packages. """ ), ), @@ -1965,7 +1912,7 @@ BINARY_FIELDS = _fields( item can be architecture dependent. For architecture dependent menu item values, use a custom substvar. - See https://d-i.debian.org/doc/internals/apa.html for the full list of menu item ranges + See <https://d-i.debian.org/doc/internals/apa.html> for the full list of menu item ranges and for how to request a number. """ ), @@ -2055,7 +2002,7 @@ BINARY_FIELDS = _fields( intended to provide a one-line summary of the package. The lines after the **Synopsis** is known as the **Extended Description** and is intended as a longer summary of the package. - **Example:** + **Example**: ``` Description: documentation generator for Python projects Sphinx is a tool for producing documentation for Python projects, using @@ -2080,7 +2027,7 @@ BINARY_FIELDS = _fields( part is inserted into a sentence like "The package provides {{Synopsis-goes-here}}". The **Extended Description** is a standalone description that should describe what the package does and how it relates to the rest of the system (in terms of, for example, which subsystem it is which part of). - Please see https://www.debian.org/doc/debian-policy/ch-controlfields.html#description for more details + Please see <https://www.debian.org/doc/debian-policy/ch-controlfields.html#description> for more details about the description field and suggestions for how to write it. """ ), @@ -2110,7 +2057,7 @@ BINARY_FIELDS = _fields( XB-Cnf-Visible-Pkgname: python3 ``` - Related bug: https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/1867157 + Related bug: <https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/1867157> """ ), ), @@ -2124,7 +2071,7 @@ BINARY_FIELDS = _fields( Please refer to the documentation of `dh_ruby` for more details. - https://manpages.debian.org/dh_ruby + <https://manpages.debian.org/dh_ruby> """ ), ), @@ -2141,7 +2088,7 @@ _DEP5_HEADER_FIELDS = _fields( FieldValueClass.FREE_TEXT_FIELD, ), Deb822KnownField( - "Upstream-Contract", + "Upstream-Contact", FieldValueClass.FREE_TEXT_FIELD, ), Deb822KnownField( @@ -2257,7 +2204,7 @@ _DTESTSCTRL_FIELDS = _fields( Declares that the specified packages must be installed for the test to go ahead. This supports all features of dpkg dependencies, including the architecture qualifiers (see - https://www.debian.org/doc/debian-policy/ch-relationships.html), + <https://www.debian.org/doc/debian-policy/ch-relationships.html>), plus the following extensions: `@` stands for the package(s) generated by the source package @@ -2342,7 +2289,7 @@ _DTESTSCTRL_FIELDS = _fields( Please use this considerately, as for large builds it unnecessarily builds the entire project when you only need a tiny subset (like the - tests/ subdirectory). It is often possible to run `make -C tests` + `tests/` subdirectory). It is often possible to run `make -C tests` instead, or copy the test code to `$AUTOPKGTEST_TMP` and build it there with some custom commands. This cuts down the load on the Continuous Integration servers and also makes tests more robust as @@ -2549,7 +2496,7 @@ _DTESTSCTRL_FIELDS = _fields( The test(s) needs write access to the built source tree (so it may need to be copied first). Even with this restriction, the test is not allowed to make any change to the built source tree which (i) - isn't cleaned up by debian/rules clean, (ii) affects the future + isn't cleaned up by `debian/rules clean`, (ii) affects the future results of any test, or (iii) affects binary packages produced by the build tree in the future. """ @@ -2667,7 +2614,7 @@ _DTESTSCTRL_FIELDS = _fields( path and is interpreted starting from the root of the built source tree. - This allows tests to live outside the debian/ metadata area, so that + This allows tests to live outside the `debian/` metadata area, so that they can more palatably be shared with non-Debian distributions. """ ), diff --git a/src/debputy/plugin/debputy/private_api.py b/src/debputy/plugin/debputy/private_api.py index 6d60333..8428a5f 100644 --- a/src/debputy/plugin/debputy/private_api.py +++ b/src/debputy/plugin/debputy/private_api.py @@ -682,7 +682,7 @@ def register_variables_via_private_api(api: DebputyPluginInitializerProvider) -> "SOURCE_DATE_EPOCH": textwrap.dedent( """\ Timestamp from the top most changelog entry (`dpkg-parsechangelog -STimestamp`) - Please see https://reproducible-builds.org/docs/source-date-epoch/ for the full definition of + Please see <https://reproducible-builds.org/docs/source-date-epoch/> for the full definition of this variable. """ ), |