Skip to content

Conversation

@cottsay
Copy link
Member

@cottsay cottsay commented Nov 26, 2024

These options change the name of the output artifacts, so we need to check for and use them appropriately.

https://github.com/astraw/stdeb/tree/master?tab=readme-ov-file#stdebcfg-configuration-file

@cottsay cottsay added the enhancement New feature or request label Nov 26, 2024
@cottsay cottsay self-assigned this Nov 26, 2024
Copy link

@j-rivero j-rivero left a comment

Choose a reason for hiding this comment

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

I think that the current approach is not correct.

The suffix applies to source_pkg_name not to debver (note that there are other suffixes that can be applied to debinc but that is a different history and won't help to take precedence over a package that it is: foo+ds-1 . I've never seen a prefix applied to package source names. Probably needs to be something like:

source_pkg_name += config_parser.get(pkg.name, 'Source-Package-Name-Suffix', fallback='')

f'deb_dist/{source_pkg_name}_{pkg.version}-{debinc}.debian.tar.gz',
...

@cottsay
Copy link
Member Author

cottsay commented Nov 27, 2024

I don't think Source-Package-Name-Suffix is a valid stdeb configuration option. Additionally, changing the name of the package will mean that consumers will need to include that when installing the package, right?

Here's a demo for this PR. I added the following lines to my stdeb.cfg:

Upstream-Version-Prefix: 99.
Upstream-Version-Suffix: +ds99

...and ran publish-python stdeb:packagecloud to get these artifacts on the other side:

deb_dist/python3-colcon-argcomplete_99.0.3.3+ds99-1_all.deb
deb_dist/python3-colcon-argcomplete_99.0.3.3+ds99-1.debian.tar.xz
deb_dist/python3-colcon-argcomplete_99.0.3.3+ds99-1.dsc
deb_dist/python3-colcon-argcomplete_99.0.3.3+ds99.orig.tar.gz

Additionally:

$ dpkg -I deb_dist/python3-colcon-argcomplete_99.0.3.3+ds99-1_all.deb
 new Debian package, version 2.0.
 size 5628 bytes: control archive=1380 bytes.
     574 bytes,    14 lines      control              
    1669 bytes,    15 lines      md5sums              
     292 bytes,    12 lines   *  postinst             #!/bin/sh
     427 bytes,    12 lines   *  prerm                #!/bin/sh
 Package: python3-colcon-argcomplete
 Version: 99.0.3.3+ds99-1
 Architecture: all
 Maintainer: Dirk Thomas <web@dirk-thomas.net>
 Installed-Size: 39
 Depends: python3:any (>= 3.6~), python3-argcomplete, python3-colcon-core
 Section: python
 Priority: optional
 Homepage: https://colcon.readthedocs.io
 Description: Completion for colcon command lines using argcomplete.
  colcon-argcomplete
  ==================
  .
  An extension for `colcon-core <https://github.com/colcon/colcon-core>`_ to provide command line completion using `argcomplete <https://github.com/kislyuk/argcomplete>`_.

These options seem to do exactly what we want, and are applied as a prefix or suffix to the automatically discovered package version number from the Python sources.

@cottsay
Copy link
Member Author

cottsay commented Nov 27, 2024

To clarify, this PR doesn't change stdeb behavior and doesn't actually make the artifacts change name. This PR changes publish-python so that it correctly predicts the change to the output file names from stdeb.

Copy link

@j-rivero j-rivero left a comment

Choose a reason for hiding this comment

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

re-reading what I posted first, sorry I think I completely confuse the name part with the version part and the version part with the debinc part. Apologies, heavy lack of coffee.

You are totally right about not changing the name itself. Changes make sense, yes.

@cottsay cottsay merged commit 04f1148 into main Nov 27, 2024
@cottsay cottsay deleted the cottsay/version-prefix-suffix branch November 27, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants