Learn more about these different git repos.
Other Git URLs
From fedora-buildsys IRC:
clime: I have both neovim.spec and neovim.spec.rpkg in my dir. Do you know why rpkg is using the spec instead of the spec.rpkg? agriffis: there is some priority defined, let me check... #fedora-buildsys: Cannot send to nick/channel agriffis: there is some priority defined, let me check... I can force it with: rpkg spec -p --spec ./neovim.spec.rpkg agriffis: it seems it is just alphabetic order: https://pagure.io/rpkg-util/blob/master/f/rpkglib/rpm_package.py#_93 This seems to have changed in v3? I've had both in the dir forever. agriffis: yes, it has been changed os.listdir isn't necessarily alphabtical s/alphabtical/alphabetical/ agriffis: is it not defined for os.listdir? i need to take a look it's just whatever the OS sends back can i set the spec name in rpkg.conf? "The list is in arbitrary order," from docs: https://docs.python.org/3/library/os.html so this is a bug agriffis: no, i don't think i added that function to specify a spec file agriffis: i need to take a close look at this / fix this...
Original behavior from v2 is: https://pagure.io/rpkg-util/blob/v2/f/rpkglib/__init__.py#_165
How about this to prefer rpkg first?
diff --git a/rpkglib/rpm_package.py b/rpkglib/rpm_package.py index f88da8d..3919cb6 100644 --- a/rpkglib/rpm_package.py +++ b/rpkglib/rpm_package.py @@ -90,7 +90,9 @@ class RpmPackage(object): def locate_spec(cls, path): spec_path = None - for f in os.listdir(path): + rpkg_first = lambda f: (0 if f.endswith('.rpkg') else 1, f) + + for f in sorted(os.listdir(path), key=rpkg_first): if (f.endswith('.spec') or f.endswith('.spec.rpkg')) and not f.startswith('.'): spec_path = os.path.abspath(os.path.join(path, f)) break
@agriffis Thank you, I applied your patch here: https://pagure.io/rpkg-util/c/eaecb33a1e1bad90c4511a5aebf80176f2be8f56?branch=master with some minor tweaks.
I like this behavior more than what was in v2 as it's more explicit (.spec.rpkg is always loaded first if it exists no matter what otherwise). I am going to release a new version shortly.
https://bodhi.fedoraproject.org/updates/FEDORA-2022-d164fbf2d2
Thanks a lot for noticing this and offering a patch!
Metadata Update from @clime: - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.