summaryrefslogtreecommitdiffstats
path: root/rpmbuild-remote.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpmbuild-remote.py')
-rw-r--r--rpmbuild-remote.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/rpmbuild-remote.py b/rpmbuild-remote.py
index a01f617..5f09631 100644
--- a/rpmbuild-remote.py
+++ b/rpmbuild-remote.py
@@ -1,17 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from iniparse import INIConfig
+#from iniparse import INIConfig
import logging
import paramiko
import optparse
import sys
import os
+LOG = logging.getLogger('rpmbuild-remote')
+LOG.addHandler(logging.StreamHandler())
+
def get_parser():
"""Return a commandline parser"""
parser = optparse.OptionParser(usage="%prog [options]... <files>...")
- home=os.path.expanduser("~")
+ home = os.path.expanduser("~")
parser.set_conflict_handler("resolve")
parser.add_option("-c", "--config",
action="store", type="string", dest="config",
@@ -44,23 +47,22 @@ def get_parser():
"builds (uses rpmbuild --rebuild otherwise)]")
return parser
-def main(argv):
+def main():
parser = get_parser()
opts, args = parser.parse_args()
+ jobs = []
for arg in args:
- ext = arg.split('.')[-1]
- if ext == 'srpm':
- jobs.append([arg])
- continue
- if ext == 'spec':
+ ext = os.path.splitext(arg)[1]
+ if ext == '.srpm' or ext == '.spec':
jobs.append([arg])
- continue
- if ext not in ['gz', 'tgz', 'bz2', 'patch']:
- log.warning("Uncommon source extension. Please double check files.")
- if not jobs:
- log.error("Source file given without spec file.")
+ elif ext not in ('.gz', '.tgz', '.bz2', '.patch'):
+ LOG.warning("Uncommon source extension %s for file %s. "
+ "Please double check files." % (ext, arg))
+ elif len(jobs) == 0:
+ LOG.error("Source file given without spec file.")
sys.exit(1)
- jobs[-1].append(arg)
+ else:
+ jobs[-1].append(arg)
if __name__ == '__main__':
- main(sys.argv[1:])
+ main()