#742 Use the spec name to guess the src.rpm name
Merged by onosek. Opened by sergiomb.
sergiomb/rpkg guess_src.rpm  into  master

Download 742.patch

The generated src.rpm has a greater chance of being the same as the name of the
spec than being the name of the directory where it is located

Without this patch just rename folder where is foo.spec and run fedpkg
mockbuild or fedpkg copr-build in the new folder to see the problem this patch
tries to solve

Signed-off-by: Sérgio M. Basto sergio@serjux.com

rebased onto 57cf67d074a1294bb85194a1485bb22672de5c2f

Note: Python 3.6 does not have removesuffix() or removeprefix().
These methods only appeared starting from Python 3.9.
is not compatible with Python 3.6.8 from EL8

@sergiomb. Please, would you provide more info about recreation? I experimented with renaming, but for me it went normal. Maybe it is valid for specific repos?

rebased onto 2c3ea5d3b04be82b558a927987b8cd567661e78a

OK the problem is when repo is not the same name of spec [1]
I will have to investigate further

meanwhile , I split this in two commits , the first I think that's still valid

[1]
remote.origin.url=git@github.com:sergiomb2/autenticacao.gov_rpms.git and pteid-mw.spec

rebased onto 2c3ea5d3b04be82b558a927987b8cd567661e78a

before I forget, this is related with https://pagure.io/rpkg/pull-request/592#request_diff

src.rpm shouldn't be based on spec name ? I'd like use rpkg and friends in git repos that aren't gitdist ... , my other case is https://github.com/sergiomb2/SambaAD , where I got several folder with specs

https://pagure.io/rpkg/pull-request/592

In this change, there is solved a situation with multiple specfiles. Some heuristic needs to be done, and in this approach specfile that matches the directory name is selected. When such a specfile is not present, the first name on the list is chosen.

Commit 4dc48985 fixes this pull-request

Pull-Request has been merged by onosek

@sergiomb At the end, I did few changes before the merge.

  • replaced .removesuffix, because I still keep old Python compatibility in rpkg.
  • added one more optimisation: self.repo_name, self.ver, self.rel --> self.nvr
  • fixed test

Thanks for bringing it up.

I'm happy to help, I read the message as a compliment, thank you

Metadata