Read Koji config via Koji API
authorChenxiong Qi <cqi@redhat.com>
Mon, 19 Dec 2016 11:09:53 +0000 (12:09 +0100)
committerDodji Seketeli <dodji@redhat.com>
Mon, 19 Dec 2016 11:29:22 +0000 (12:29 +0100)
Besides reading Koji config via Koji API read_config, option --topdir is
also renamed to --topurl that is the correct one should be used.

* tools/fedabipkgdiff: Read DEFAULT_KOJI_TOPURL and
DEFAULT_KOJI_SERVER from Koji config via Koji API read_config.
(build_commandline_args_parser): --topdir is renamed to
--topurl.
* doc/manuals/fedabipkgdiff.rst: Rename --topdir to --topurl.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
doc/manuals/fedabipkgdiff.rst
tools/fedabipkgdiff

index dec560d1b7d35121a886fd971097493ba9ffe4d9..76564103c75659574ad9b36778a5ffd0fb628f32 100644 (file)
@@ -85,7 +85,7 @@ Options
     Specifies the URL of the `Koji`_ XMLRPC service the tool talks to.
     The default value of this option is http://koji.fedoraproject.org/kojihub.
 
-  * ``--topdir`` <URL>
+  * ``--topurl`` <URL>
 
     Specifies the URL of the package store the tool downloads RPMs
     from.  The default value of this option is https://kojipkgs.fedoraproject.org.
index 4fdffdd3d3a89534c7523484fffe308f7216ab16..9a7f8eade8373028561171c6a78e0fa4cd2edd22 100755 (executable)
@@ -56,8 +56,9 @@ import koji
 # something wrong.
 
 
-DEFAULT_KOJI_SERVER = 'http://koji.fedoraproject.org/kojihub'
-DEFAULT_KOJI_TOPDIR = 'https://kojipkgs.fedoraproject.org'
+koji_config = koji.read_config('koji')
+DEFAULT_KOJI_SERVER = koji_config['server']
+DEFAULT_KOJI_TOPURL = koji_config['topurl']
 
 # The working directory where to hold all data including downloaded RPM
 # packages Currently, it's not configurable and hardcode here. In the future
@@ -1207,11 +1208,11 @@ def build_commandline_args_parser():
         help='URL of koji XMLRPC service. Default is {0}'.format(
             DEFAULT_KOJI_SERVER))
     parser.add_argument(
-        '--topdir',
+        '--topurl',
         required=False,
         metavar='URL',
-        dest='koji_topdir',
-        default=DEFAULT_KOJI_TOPDIR,
+        dest='koji_topurl',
+        default=DEFAULT_KOJI_TOPURL,
         help='URL for RPM files access')
     parser.add_argument(
         '--abipkgdiff',
@@ -1257,7 +1258,7 @@ def main():
     global_config = args
 
     global pathinfo
-    pathinfo = koji.PathInfo(topdir=global_config.koji_topdir)
+    pathinfo = koji.PathInfo(topdir=global_config.koji_topurl)
 
     global session
     session = get_session()