
Hi spec-cleaner (v1.2.1) changes %python_libalternatives_reset_alternative to %{python_libalternatives_reset_alternative} However, this creates error when building the package, for example, I get the following errors: [ 37s] /var/tmp/rpm-tmp.NzXnJa: line 7: jupyter-execute: command not found [ 37s] error: %prein(python39-nbclient-0.5.11-36.1.noarch) scriptlet failed, exit status 127 [ 37s] error: python39-nbclient-0.5.11-36.1.noarch: install failed [ 37s] /var/tmp/rpm-tmp.kNTQwJ: line 7: jupyter-execute: command not found [ 37s] error: %prein(python310-nbclient-0.5.11-36.1.noarch) scriptlet failed, exit status 127 [ 37s] error: python310-nbclient-0.5.11-36.1.noarch: install failed [ 37s] /var/tmp/rpm-tmp.AzKILp: line 7: jupyter-execute: command not found [ 37s] error: %prein(python38-nbclient-0.5.11-36.1.noarch) scriptlet failed, exit status 127 [ 37s] error: python38-nbclient-0.5.11-36.1.noarch: install failed [ 37s] failed to install rpms, aborting build Is this an error with spec-cleaner or with some other tool? Happy to file a bug report and perhaps try to get a PR to fix this, once I know where the issue comes from. Arun

Am 17.02.22 um 17:47 schrieb Arun Persaud:
I think that %python_libalternatives_reset_alternative takes an argument, i.e. it should be something like %python_libalternatives_reset_alternative foo How do we know? Well, "rpm -E %python_libalternatives_reset_alternative" produces something with an argument placeholder %1. Since it takes an argument, it's not the same [1] as %{python_libalternatives_reset_alternative} foo which is the expansion with %1 still there, followed by foo, instead of %1 being replaced by foo. You could write %{python_libalternatives_reset_alternative foo} though according to my understanding. Now we don't see an argument in your example, perhaps that argument is on the next line? Then perhaps spec-cleaner thinks it's a macro without argument and suggests the braces? That would be my guess. Perhaps you can just try to have the argument on the same line. Is that a bug in spec-cleaner? I'd guess that spec-cleaner doesn't look into your local rpm macros, so it probably doesn't know that this has an argument and guesses based on some conventions. Breaking before arguments seems rather unconventional to me. But I'm not an expert, so feel free to file a bug. Best regards, Aaron [1] <https://rpm-software-management.github.io/rpm/manual/macros.html#using-a-macro>

Am 17.02.22 um 17:47 schrieb Arun Persaud:
I think that %python_libalternatives_reset_alternative takes an argument, i.e. it should be something like %python_libalternatives_reset_alternative foo How do we know? Well, "rpm -E %python_libalternatives_reset_alternative" produces something with an argument placeholder %1. Since it takes an argument, it's not the same [1] as %{python_libalternatives_reset_alternative} foo which is the expansion with %1 still there, followed by foo, instead of %1 being replaced by foo. You could write %{python_libalternatives_reset_alternative foo} though according to my understanding. Now we don't see an argument in your example, perhaps that argument is on the next line? Then perhaps spec-cleaner thinks it's a macro without argument and suggests the braces? That would be my guess. Perhaps you can just try to have the argument on the same line. Is that a bug in spec-cleaner? I'd guess that spec-cleaner doesn't look into your local rpm macros, so it probably doesn't know that this has an argument and guesses based on some conventions. Breaking before arguments seems rather unconventional to me. But I'm not an expert, so feel free to file a bug. Best regards, Aaron [1] <https://rpm-software-management.github.io/rpm/manual/macros.html#using-a-macro>
participants (2)
-
Aaron Puchert
-
Arun Persaud