rpm-software-management / spec-cleaner

spec-cleaner
BSD 3-Clause "New" or "Revised" License
27 stars 33 forks source link

Wrong bracketing of ldconfig_scriptlets with parameters #324

Open djz88 opened 1 month ago

djz88 commented 1 month ago

Hi, using spec-cleaner 1.2.2. from PyPI I have found this weird behaviour. After I run ~/.local/bin/spec-cleaner --no-copyright libreport.spec -o libreport.spec2 It cleaned the spec file but build failed on rpmbuild:

[    4s] + exec rpmbuild --with bugzilla -ba --define '_srcdefattr (-,root,root)' --nosignature --undefine _enable_debug_packages /home/abuild/rpmbuild/SOURCES/libreport.spec
[    4s] error: line 417: Second %post

After investigation I had found the cause. Curly brackets were put right after "scriplets".

-%ldconfig_scriptlets
-%ldconfig_scriptlets web_2
-%ldconfig_scriptlets gtk_1
-%ldconfig_scriptlets -n libreport_2
+%{ldconfig_scriptlets}
+%{ldconfig_scriptlets} web_2
+%{ldconfig_scriptlets} gtk_1
+%{ldconfig_scriptlets} -n libreport_2

When moved after the arguments it passed build.

+%{ldconfig_scriptlets}
+%{ldconfig_scriptlets web_2}
+%{ldconfig_scriptlets gtk_1}
+%{ldconfig_scriptlets -n libreport_2}
danigm commented 1 month ago

I can't reproduce this in my tumbleweed installation, this macro is not embraced in my case because is part of rpm --showrc. https://github.com/rpm-software-management/spec-cleaner/blob/master/spec_cleaner/rpmcleaner.py#L168

If this is an usual case with different environments maybe we can add to the whitelist