Redmine #6441: Fix software_packages.csv being regenerated every time.

Do not allow '\r' to make it into the package string. If the package
manager puts '\r' at the end of the lines, it will cause later
comparisons to fail, so make sure to filter it out.
(cherry picked from commit 6b3e4608cff3624592ea7e0e901a0f0634f31a2b)