This uses the 'dist' RPM macro instead of relying on the version information of CentOS packages. This approach works on CentOS 7 and 8 as well.