98N/A#!/usr/bin/env python
98N/A#
98N/A# Extract build dependencies from an RPM .spec file.
98N/A#
1265N/A# Copyright (C) 2014 Red Hat
98N/A#
98N/A# This program is free software; you can redistribute it and/or modify
919N/A# it under the terms of the GNU General Public License as published by
919N/A# the Free Software Foundation; either version 3 of the License, or
919N/A# (at your option) any later version.
919N/A#
919N/A# This program is distributed in the hope that it will be useful,
919N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of
919N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
919N/A# GNU General Public License for more details.
919N/A#
919N/A# You should have received a copy of the GNU General Public License
919N/A# along with this program. If not, see <http://www.gnu.org/licenses/>.
919N/A
919N/Aimport sys
919N/Aimport re
919N/Aimport rpm
919N/A
919N/Adef usage(file):
98N/A file.write(("Usage: %s SPEC\n" +
98N/A "Extract build dependencies from an RPM .spec file.\n") %
98N/A re.match(".*?([^/]+)$", sys.argv[0]).group(1))
98N/A
98N/Aif len(sys.argv) != 2:
98N/A usage(sys.stderr)
1265N/A sys.exit(1)
493N/A
98N/Aspec = rpm.spec(sys.argv[1])
911N/Afor d in rpm.ds(spec.sourceHeader, 'requires'):
1276N/A print d.DNEVR()[2:]
1276N/A