Index: libtaskotron/directives/yumrepoinfo_directive.py
===================================================================
--- /dev/null
+++ libtaskotron/directives/yumrepoinfo_directive.py
@@ -0,0 +1,84 @@
+# Copyright 2014, Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Authors:
+#       Josef Skladanka <jskladan@redhat.com>
+
+from libtaskotron.directives import BaseDirective
+
+from libtaskotron import config
+from libtaskotron import yumrepoinfo
+
+from libtaskotron.exceptions import TaskotronDirectiveError, TaskotronValueError
+from libtaskotron.logger import log
+
+directive_class = 'YumrepoinfoDirective'
+
+class YumrepoinfoDirective(BaseDirective):
+    """A directive for translating koji tag into a set of yum repos.
+    The directive returns a dictionary having koji_tag as the key, and
+    URL for the respective repo as a value.
+    If the koji tag specified by koji_tag argument has any parent repos
+    (e.g. f20-updates is a child of f20), all the repos from the koji_tag
+    and up are returned.
+    If the koji_tag is '-pending', the '-pending' is stripped (as it is not
+    a repo), and then the code works the same.
+    It is also possible to assing koji_tag to 'rawhide'.
+
+    format: "yumrepoinfo:
+                koji_tag=<tag>
+                arch=<arch>
+    """
+
+    def __init__(self, repoinfo = None):
+        self.conf = config.get_config()
+        if repoinfo is not None:
+            self.repoinfo = repoinfo
+        else:
+            self.repoinfo = yumrepoinfo.get_yumrepoinfo()
+
+
+    def process(self, input_data, env_data):
+
+        conf = config.get_config()
+
+        if 'koji_tag' not in input_data or 'arch' not in input_data:
+            raise TaskotronDirectiveError("The yumrepoinfo directive requires "\
+                    "koji_tag and arch arguments.")
+
+        arch = input_data.get('arch', 'noarch')
+        koji_tag = input_data['koji_tag']
+
+        output = {}
+
+        if koji_tag.endswith('-pending'):
+           koji_tag = koji_tag[:-len('-pending')]
+
+        if koji_tag == 'rawhide':
+            koji_tag = self.repoinfo.repo('rawhide')['tag']
+
+        while koji_tag:
+            repo = self.repoinfo.repo_by_tag(koji_tag)
+            if repo is None:
+                raise TaskotronDirectiveError('Repo with tag'\
+                        '%r not found.' % koji_tag)
+
+            output[repo['name']] = repo['url']
+            koji_tag = repo['parent']
+
+        log.debug("Found %s repos for %s: %r" % (len(output), input_data['koji_tag'], output))
+        return output
+
Index: testing/test_yumrepoinfo_directive.py
===================================================================
--- /dev/null
+++ testing/test_yumrepoinfo_directive.py
@@ -0,0 +1,103 @@
+import pytest
+import StringIO
+import ConfigParser
+
+from libtaskotron.directives import yumrepoinfo_directive
+from libtaskotron.exceptions import TaskotronDirectiveError
+
+from libtaskotron import yumrepoinfo
+
+
+TEST_CONF='''\
+[DEFAULT]
+baseurl = http://download.fedoraproject.org/pub/fedora/linux
+goldurl = %(baseurl)s/releases/%(path)s/Everything/%(arch)s/os
+updatesurl = %(baseurl)s/updates/%(path)s/%(arch)s
+rawhideurl = %(baseurl)s/%(path)s/%(arch)s/os
+arches = i386, x86_64
+parent =
+tag = %(__name__)s
+supported = no
+
+[rawhide]
+path = development/rawhide
+url = %(rawhideurl)s
+tag = f21
+
+[f20]
+url = %(goldurl)s
+path = 20
+supported = yes
+
+[f20-updates]
+url = %(updatesurl)s
+path = 20
+parent = f20
+arches = x86_64
+
+[f20-updates-testing]
+url = %(updatesurl)s
+path = testing/20
+parent = f20-updates
+'''
+
+
+class TestYumrepoinfoDirective(object):
+
+    @classmethod
+    def setup_class(cls):
+        '''One-time class initialization'''
+        # create YumRepoInfo initialized with TEST_CONF
+        cls.repoinfo = yumrepoinfo.YumRepoInfo(filelist=[])
+        cls.repoinfo.parser.readfp(StringIO.StringIO(TEST_CONF))
+
+    def test_missing_kojitag(self):
+        directive = yumrepoinfo_directive.YumrepoinfoDirective(self.repoinfo)
+        ref_input = {"arch":"x86_64"}
+
+        with pytest.raises(TaskotronDirectiveError):
+            directive.process(ref_input, None)
+
+    def test_missing_arch(self):
+        directive = yumrepoinfo_directive.YumrepoinfoDirective(self.repoinfo)
+        ref_input = {"koji_tag":"rawhide"}
+
+        with pytest.raises(TaskotronDirectiveError):
+            directive.process(ref_input, None)
+
+    def test_pending(self):
+        directive = yumrepoinfo_directive.YumrepoinfoDirective(self.repoinfo)
+        ref_input = {"koji_tag": "f20-pending", "arch": "x86_64"}
+
+        output = directive.process(ref_input, None)
+
+        assert output == {"f20": "http://download.fedoraproject.org/pub/fedora/linux/releases/20/Everything/x86_64/os"}
+
+    def test_rawhide(self):
+        directive = yumrepoinfo_directive.YumrepoinfoDirective(self.repoinfo)
+        ref_input = {"koji_tag": "rawhide", "arch": "x86_64"}
+
+        output = directive.process(ref_input, None)
+
+        assert output == {"rawhide": "http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os"}
+
+    def test_bad_kojitag(self):
+        directive = yumrepoinfo_directive.YumrepoinfoDirective(self.repoinfo)
+        ref_input = {"koji_tag": "my random tag"}
+
+        with pytest.raises(TaskotronDirectiveError):
+            directive.process(ref_input, None)
+
+    def test_repo_path(self):
+
+        directive = yumrepoinfo_directive.YumrepoinfoDirective(self.repoinfo)
+        ref_input = {"koji_tag": "f20-updates", "arch": "x86_64"}
+
+        output = directive.process(ref_input, None)
+
+        assert output == {
+                "f20": "http://download.fedoraproject.org/pub/fedora/linux/releases/20/Everything/x86_64/os",
+                "f20-updates": "http://download.fedoraproject.org/pub/fedora/linux/updates/20/x86_64",
+                }
+
+
