rpm-software-management / tito

A tool for managing rpm based git projects.
GNU General Public License v2.0
379 stars 128 forks source link

Support branch aliases in releasers #476

Closed FrostyX closed 8 months ago

FrostyX commented 9 months ago

Fix #430

FrostyX commented 9 months ago

This obsoletes PR #475.

What do you think @xsuchy?

@lachmanfrantisek, @lbarcziova, there is a hardcoded version of this in the Packit code. @xsuchy suggested creating a separate python package for resolving the aliases. We could use this implementation, what do you think?

xsuchy commented 9 months ago

It can be better (like implement rest of the aliases) but this is HUGE improvement. +1 for merging and improve later in next PR :)

lbarcziova commented 9 months ago

@FrostyX the linked variable is used only as a feedback value, otherwise we use Bodhi for resolving the aliases here. But having this code in a separate package for the benefit of reusing it by multiple projects makes sense to me!

FrostyX commented 9 months ago

otherwise we use Bodhi for resolving the aliases here.

Thank you, I will take a look if it is applicable for Tito

having this code in a separate package for the benefit of reusing it by multiple projects makes sense to me!

Perfect! I will ping you so we can figure out the details (e.g. where it should live) and I will try to kick off the project.

FrostyX commented 9 months ago

@lbarcziova I took your get_aliases and modified it a bit. It doesn't return e.g.

{
    'fedora-all': ['fedora-38', 'fedora-39', 'fedora-rawhide']
    ...
}

but rather

{
    'fedora-all': [
        Distro({'name': 'F38', 'long_name': 'Fedora 38', 'version': '38', ...}),
        Distro({'name': 'F39', 'long_name': 'Fedora 39', 'version': '39', ...}),
        Distro({'name': 'Rawhide', 'long_name': 'Fedora Rawhide', 'version': 'rawhide', ...})
    ...
    ]
}

The reason is that in Tito I want to use something like

aliases = get_distro_aliases()
branches = [x.branch for x in aliases["fedora-all"]

and in Packit you will want

aliases = get_distro_aliases()
branches = [x.namever for x in aliases["fedora-all"]

Also, you will maybe be able to replace (some parts of) your get_branches function.

What do you think of the code now? If it was moved to a separate package outside of Tito, would you use it?

lachmanfrantisek commented 9 months ago

@FrostyX I like the object-like approach. It would be really handy for us as well -- sometimes, we need the namever (for chroots), and sometimes branches (e.g. when working with dit-git).

FrostyX commented 8 months ago

I updated this PR to use fedora-distro-aliases ... so I marked this PR as blocked until the package is in Fedora.

FrostyX commented 8 months ago

But it is ready for a review. I am only planning to squash the commits before merging.

praiskup commented 8 months ago

First package release using Tito with this patch: https://github.com/fedora-copr/resalloc-ibm-cloud/commit/5ceece9613192befcb97ad3148d099bd99df42d0