If you ever want to build and RPM, you need to make sure that the things it requires are installed. These are listed in the SPEC file on lines that begin with BuildRequires. Installing these by hand is time consuming enough that it should be automated. Here’s a first hack in Python.
#!/usr/bin/python import sys import re build_re = re.compile('BuildRequires:.*') compare_re = re.compile('.*=.*') def main(): if (len(sys.argv) > 1): spec = open(sys.argv) for line in spec: if build_re.match(line): for token in line.rsplit(" "): if build_re.match(token): continue if compare_re.match(token): break token = token.rstrip(" ,\n\r") if len(token) > 0: print token if __name__ == "__main__": main()
To use it, save in a file called buildreqs.py and run:
sudo yum install `./buidreqs.py ~/rpmbuild/SPECS/krb5.spec`