rpm - macros

Macros

Macros are important in RPM, they can tell RPM where the database is, amongst other things. You normally encounter macros in spec files %define foo bar

import rpm
rpm.addMacro("_dbPath","/usr/lib/rpmdb/i386-redhat-linux/redhat")
solvets = rpm.TransactionSet()
# We discuss transaction sets next
rpm.delMacro("_dbPath")
	  

RPM macros are a stack. Adding one pushes the new value onto the stack, removing it pops it. Thus in the above example %_dbPath is reset to the default value.