Verified Commit df8690a2 authored by Adam Mercer's avatar Adam Mercer
Browse files

use source instead of srpm for variable

parent 45f6f441
......@@ -48,15 +48,15 @@ def parse_options():
koji_options.add_argument('--target', default=__target__,
help='Koji tag to tag (%s)' % __target__)
source_options = parser.add_argument_group('Source Options')
source_options.add_argument('srpm', help='Source RPM to build with Koji')
source_options.add_argument('source', help='Source to build with Koji')
# parse options
args = parser.parse_args()
# check that source-rpm exists
srpm = pathlib.Path(args.srpm)
if not srpm.is_file():
print('File %s does not exist.' % args.srpm)
source = pathlib.Path(args.source)
if not source.is_file():
print('File %s does not exist.' % args.source)
sys.exit(1)
return args
......@@ -74,10 +74,10 @@ def check_connection_to_koji():
return
# method to get the package name from the source rpm
def get_package_name_from_source_rpm(srpm):
# method to get the package name from the source
def get_package_name_from_source_rpm(source):
try:
cmd = ['rpm', '--queryformat', '%{NAME}', '-qp', srpm]
cmd = ['rpm', '--queryformat', '%{NAME}', '-qp', source]
pkg_name = subprocess.check_output(cmd)
except subprocess.CalledProcessError as e:
print('Unable to determine package name, %s' % e)
......@@ -92,14 +92,14 @@ def get_package_name_from_source_rpm(srpm):
def main():
args = parse_options()
if args.verbose:
print('source-rpm = %s' % args.srpm)
print('source = %s' % args.source)
print('target tag = %s' % args.target)
# check that we can authenticate to koji
check_connection_to_koji()
# get pkg name from source rpm
pkg_name = get_package_name_from_source_rpm(args.srpm)
pkg_name = get_package_name_from_source_rpm(args.source)
if args.verbose:
print('package name = %s' % pkg_name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment