Bug#1098969: DebFile scripts ignore DEBIAN/templates file
Niels Thykier
niels at thykier.net
Sun Feb 8 13:59:49 GMT 2026
Control: tags -1 moreinfo
On Wed, 26 Feb 2025 17:02:08 -0300 "Gabriel B. Sant'Anna"
<gabriel.santanna at canonical.com> wrote:
> Package: python3-debian
> Version: 0.1.52
>
> The `scripts` method in `debfile.DebFile` doesn't list templates
> files, which might be required by config scripts.
>
> Reproduction:
>
> >>> from debian import debfile
> >>> deb = debfile.DebFile('xserver-xorg-legacy_21.1.12-1ubuntu1_amd64.deb')
> >>> print(deb.scripts().keys())
> dict_keys(['postinst', 'postrm', 'config'])
>
> The particular package is not important; this one just happens to
> include a DEBIAN/templates file which is not being listed by the
> scripts() method above.
>
> Fixing this requires only appending 'templates' to the MAINT_SCRIPTS
> array in src/debian/debfile.py, a change which doesn't cause any
> regressions in the test suite.
>
> Best regards,
> Gabriel B. Sant'Anna
>
>
I believe the current behaviour is correct. Since `DEBIAN/templates` is
not a `maintscript`, it should not be included in `scripts()`. It is the
same reason why `DEBIAN/control` is also not present in that value.
If you want to see if the file is present,
`deb.control.has_file('templates')` would be the way to go about it.
Beyond that, `deb.control` also has accessors for the actual contents.
Best regards,
Niels
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-python-debian-maint/attachments/20260208/a67fe54c/attachment.sig>
More information about the pkg-python-debian-maint
mailing list