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(): ...@@ -48,15 +48,15 @@ def parse_options():
koji_options.add_argument('--target', default=__target__, koji_options.add_argument('--target', default=__target__,
help='Koji tag to tag (%s)' % __target__) help='Koji tag to tag (%s)' % __target__)
source_options = parser.add_argument_group('Source Options') 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 # parse options
args = parser.parse_args() args = parser.parse_args()
# check that source-rpm exists # check that source-rpm exists
srpm = pathlib.Path(args.srpm) source = pathlib.Path(args.source)
if not srpm.is_file(): if not source.is_file():
print('File %s does not exist.' % args.srpm) print('File %s does not exist.' % args.source)
sys.exit(1) sys.exit(1)
return args return args
...@@ -74,10 +74,10 @@ def check_connection_to_koji(): ...@@ -74,10 +74,10 @@ def check_connection_to_koji():
return return
# method to get the package name from the source rpm # method to get the package name from the source
def get_package_name_from_source_rpm(srpm): def get_package_name_from_source_rpm(source):
try: try:
cmd = ['rpm', '--queryformat', '%{NAME}', '-qp', srpm] cmd = ['rpm', '--queryformat', '%{NAME}', '-qp', source]
pkg_name = subprocess.check_output(cmd) pkg_name = subprocess.check_output(cmd)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print('Unable to determine package name, %s' % e) print('Unable to determine package name, %s' % e)
...@@ -92,14 +92,14 @@ def get_package_name_from_source_rpm(srpm): ...@@ -92,14 +92,14 @@ def get_package_name_from_source_rpm(srpm):
def main(): def main():
args = parse_options() args = parse_options()
if args.verbose: if args.verbose:
print('source-rpm = %s' % args.srpm) print('source = %s' % args.source)
print('target tag = %s' % args.target) print('target tag = %s' % args.target)
# check that we can authenticate to koji # check that we can authenticate to koji
check_connection_to_koji() check_connection_to_koji()
# get pkg name from source rpm # 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: if args.verbose:
print('package name = %s' % pkg_name) 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