Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add attribute version_number #9

Closed
xsuchy opened this issue Mar 6, 2024 · 2 comments · Fixed by #10
Closed

add attribute version_number #9

xsuchy opened this issue Mar 6, 2024 · 2 comments · Fixed by #10

Comments

@xsuchy
Copy link
Member

xsuchy commented Mar 6, 2024

I want to add new attribute to release dict that would be name version_number. It would be the same as version except for rawhide there was the number. I.e. currently 41 instead of rawhide.

My motivation is to use it in situation like this rpm-software-management/mock#1342 where we need to know version of current rawhide to map it to current gpg key.

If you are ok with the name of the attribute I will create a PR.

@praiskup
Copy link
Member

praiskup commented Mar 6, 2024

I'm curious whether issue #4 or similar wouldn't affect mock if used like this?
I'm also a bit afraid of Bodhi API outages causing mock/copr builds to fail.

@FrostyX
Copy link
Member

FrostyX commented Mar 6, 2024

I want to add new attribute to release dict that would be name version_number. It would be the same as version except for rawhide there was the number. I.e. currently 41 instead of rawhide.

This is trivial to do

--- a/fedora_distro_aliases/__init__.py
+++ b/fedora_distro_aliases/__init__.py
@@ -79,7 +79,9 @@ class Distro(Munch):
         Create a `Distro` object from Bodhi `release`
         """
         keys = ["name", "long_name", "version", "state", "branch", "id_prefix"]
-        return cls({k: getattr(release, k) for k in keys})
+        distro = cls({k: getattr(release, k) for k in keys})
+        distro.version_number = distro.version
+        return distro

     @property
     def product(self):

I can send a PR right now.

However ... having the version as a number for rawhide was the default, we intentionally changed the number to "rawhide"

# The Fedora with the highest version is "rawhide", but
# Bodhi always uses release names, and has no concept of "rawhide".
fedora[-1].update({
    "name": "Rawhide",
    "long_name": "Fedora Rawhide",
    "version": "rawhide",
    "branch": "rawhide",
})

Hopefully that wasn't a mistake. If it was, we can probably still change it. But we would need to figure out another way to generate Mock chroot names.

FrostyX added a commit to FrostyX/fedora-distro-aliases that referenced this issue Mar 6, 2024
Fix rpm-software-management#9

For example for Fedora Rawhide that would mean that `distro.version`
will be `"rawhide"` and `distro.version_number` will be e.g. `"41"`.
FrostyX added a commit to FrostyX/fedora-distro-aliases that referenced this issue Mar 10, 2024
Fix rpm-software-management#9

For example for Fedora Rawhide that would mean that `distro.version`
will be `"rawhide"` and `distro.version_number` will be e.g. `"41"`.
FrostyX added a commit that referenced this issue Mar 10, 2024
Fix #9

For example for Fedora Rawhide that would mean that `distro.version`
will be `"rawhide"` and `distro.version_number` will be e.g. `"41"`.
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 a pull request may close this issue.

3 participants