How to inspect RPM packages

While working with RPM packages I had to compare the ones I created with old ones to check if my pipeline produces the same output. I found a few command that helped me to do that.

To list the contents and their timestamps, you can use: rpm -qlpv package.rpm

To extract all contents you can use: rpm2cpio package.rpm | cpio -idmv -D extract_folder

To get the scripts use: rpm -qp --scripts package.rpm > package.spec