[opensuse-packaging] update-alternatives: Conflict between wiki and rpmlint
Hi, I added support for update-alternatives to a package by following this page: http://en.opensuse.org/openSUSE:Packaging_Multiple_Version_guidelines When built, rpmlint complains about suse-alternative-link-missing and suse- alternative-generic-name-missing, even that they are there. The problem is that I used the update-alternatives command exactly as it is in the wiki page - with quotation marks around it: "%_sbindir/update-alternatives" --install /bin/vim vim /bin/vim-normal 15 Rpmlint doesn't parse this correctly (it takes the first thing after update- alternatives that doesn't start with "--", in this case it is the closing quotation mark instead of /bin/vim). Should this be reported as bug of rpmlint, or should I just change the wiki page? Isn't it too paranoid to put the quotation marks there? Michal -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Tuesday 2014-06-03 22:00, Michal Srb wrote:
"%_sbindir/update-alternatives" --install /bin/vim vim /bin/vim-normal 15
Rpmlint doesn't parse this correctly (it takes the first thing after update- alternatives that doesn't start with "--"
If I read the python code correctly, it uses any *arbitrary occurrence* of the substring "update-alternatives" to look for an "--install" string. To me, that is just too fuzzy a match. I would instead suggest to: * Split the script by '\n', and _join back_ lines that are \\-continued. It is not unheard of %post scripts to use that. * Dequote each line into arguments according to well-known double-quoting rules, that is, a state machine that tracks whether or not it is inside a "string" or 'string' and recognizes \"escapes. * When done, check first argument of the so-split line for - trailing portion being equal to "/update-alternatives" (/update-alternatives$ for regex fanatics, but substr will do just fine) - equality to "update-alternatives" (^update-alternatives$) * And since the line was already split per DQ rules, checking for "--install" is easy too. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (2)
-
Jan Engelhardt
-
Michal Srb