or use %triggerpost/postun on package name/version. This will ensure the code is only run in those cases.