summaryrefslogtreecommitdiffstats
path: root/rpmbuild-remote.py
diff options
context:
space:
mode:
authorAbhishek Mukherjee <linkinpark342@gmail.com>2009-02-08 01:47:19 -0500
committerAbhishek Mukherjee <linkinpark342@gmail.com>2009-02-08 01:47:19 -0500
commit4d3c07df9cfcb59e1c6f8b4f6a510431cf62398d (patch)
tree9ec4cedd7d9cf117340c3c2e42b39cd64e5d8d10 /rpmbuild-remote.py
parent9b0ebb9109e1082bc34ab6ffd84deadd53106c25 (diff)
downloadrpmbuild-remote-4d3c07df9cfcb59e1c6f8b4f6a510431cf62398d.zip
rpmbuild-remote-4d3c07df9cfcb59e1c6f8b4f6a510431cf62398d.tar.gz
rpmbuild-remote-4d3c07df9cfcb59e1c6f8b4f6a510431cf62398d.tar.xz
Fixed some logger code that was removed from the merge
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()