Index: .arcconfig
===================================================================
--- /dev/null
+++ .arcconfig
@@ -0,0 +1,6 @@
+{
+    "project_id" : "task-rpmdeplint",
+    "conduit_uri" : "https://phab.qadevel.cloud.fedoraproject.org",
+    "arc.land.onto.default" : "master",
+    "arc.feature.start.default" : "master"
+}
Index: .gitignore
===================================================================
--- /dev/null
+++ .gitignore
@@ -0,0 +1,4 @@
+*.py[co]
+.*.swp
+/env/
+.cache/
Index: LICENSE
===================================================================
--- /dev/null
+++ LICENSE
@@ -0,0 +1,86 @@
+GNU GENERAL PUBLIC LICENSE
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.  
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. 
+    b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. 
+    c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) 
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 
+    b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 
+    c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) 
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
Index: README.rst
===================================================================
--- /dev/null
+++ README.rst
@@ -0,0 +1,22 @@
+Setting Up Development Environment
+----------------------------------
+::
+  dnf copr enable dcallagh/rpmdeplint
+  dnf install rpmdeplint python-virtualenv
+  virtualenv --system-site-packages env
+  source env/bin/activate
+  pip install -e /path/to/libtaskotron/checkout
+
+
+Running the task through libtaskotron
+-------------------------------------
+::
+  runtask -i f24-updates-testing-pending -t koji_tag runtask.yml
+
+Running Functional Test Suite
+-----------------------------
+::
+  pip install pytest dingus progressbar
+  py.test --functional tests/
+
+Read ``tests/scenarios/README.md`` for more details.
Index: pytest.ini
===================================================================
--- /dev/null
+++ pytest.ini
@@ -0,0 +1,4 @@
+[pytest]
+minversion = 2.0
+python_functions=test should
+python_files=test_* functest_*
Index: run_rpmdeplint.py
===================================================================
--- /dev/null
+++ run_rpmdeplint.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+import os
+import sys
+from rpmdeplint.repodata import Repo
+
+sys.path.insert(0, os.path.realpath(os.path.dirname(__file__)))
+from utils import squash_results
+from utils import log
+from utils import check_sat
+
+
+def run(rpms_dir, repos, arch, report_format='builds', artifactsdir='.'):
+    '''Run rpmdeplint check-sat on the given RPM packages in `rpms_dir`
+       against the given `repos` repositories.
+
+    @param list rpms_dir list of rpm files and/or directories containing rpm files
+    @param dict repos dictionary or list of dictionaries in format: {'name': {'arch': 'url'}}
+    @param str arch arch of the packages in the repo
+    @param str report_format 'builds', 'updates' or a string containing both
+    @param str artifactsdir directory to store the artifacts in
+    '''
+
+    repositories = {}
+
+    if isinstance(repos, list):
+        for repo in repos:
+            for name, val in repo.iteritems():
+                while name in repositories:
+                    name += "_"
+                repositories[name] = val
+    elif isinstance(repos, dict):
+        repositories = repos
+    else:
+        raise Exception("Repos should be in the following format {'name': {'arch': 'url'}}")
+
+    Repos = [Repo(name, val[arch]) for name, val in repositories.iteritems()]
+
+    results = check_sat(rpms_dir, Repos)
+
+    output = squash_results.format_output(results, arch, report_format, artifactsdir)
+    log.info(output)
+
+    return output
Index: runtask.yml
===================================================================
--- /dev/null
+++ runtask.yml
@@ -0,0 +1,90 @@
+name: rpmdeplint
+namespace: dist
+desc: "Checks for unmet dependencies with the given RPM packages against the given repositories."
+maintainer: mkrizek
+
+environment:
+    rpm:
+        - rpmdeplint
+
+input:
+    args:
+        - koji_tag
+
+actions:
+    # === i386
+    - name: download koji tag
+      koji:
+          action: download_tag
+          koji_tag: ${koji_tag}
+          arch: ['i386']
+          target_dir: "${workdir}/downloaded_tag/"
+
+    - name: mash downloaded rpms
+      mash:
+          rpmdir: "${workdir}/downloaded_tag/"
+          dodelta: "false"
+          arch: ['i386']
+
+    - name: get yum repos
+      yumrepoinfo:
+          koji_tag: ${koji_tag}
+          arch: ['i386']
+      export: yumrepos_i386
+
+    - name: run rpmdeplint
+      python:
+          file: run_rpmdeplint.py
+          callable: run
+          rpms_dir: "${workdir}/downloaded_tag/"
+          arch: i386
+          artifactsdir: "${artifactsdir}"
+          report_format: "builds+updates"
+          repos:
+              - ${yumrepos_i386}
+              - "workdir_repo": {"i386": "${workdir}/downloaded_tag/"}
+      export: output_i386
+
+    # === x86_64
+    - name: download koji tag
+      koji:
+          action: download_tag
+          koji_tag: ${koji_tag}
+          arch: ['x86_64']
+          target_dir: "${workdir}/downloaded_tag/"
+
+    - name: mash downloaded rpms
+      mash:
+          rpmdir: "${workdir}/downloaded_tag/"
+          dodelta: "false"
+          arch: ['x86_64']
+
+    - name: get yum repos
+      yumrepoinfo:
+          koji_tag: ${koji_tag}
+          arch: ['x86_64']
+      export: yumrepos_x86_64
+
+    - name: run rpmdeplint
+      python:
+          file: run_rpmdeplint.py
+          callable: run
+          rpms_dir: "${workdir}/downloaded_tag/"
+          arch: x86_64
+          artifactsdir: "${artifactsdir}"
+          report_format: "builds+updates"
+          repos:
+              - ${yumrepos_x86_64}
+              - "workdir_repo": {"x86_64": "${workdir}/downloaded_tag/"}
+      export: output_x86_64
+
+    # === report results
+    - name: report i386 results to resultsdb
+      resultsdb:
+          results: ${output_i386}
+      export: output_i386
+
+    - name: report x86_64 results to resultsdb
+      resultsdb:
+          results: ${output_x86_64}
+      export: output_x86_64
Index: tests/conftest.py
===================================================================
--- /dev/null
+++ tests/conftest.py
@@ -0,0 +1,53 @@
+#
+# conftest.py - utils for py.test
+#
+# Copyright 2011, 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.
+#
+# Author: Tim Flink <tflink@redhat.com>
+
+import pytest
+import re
+
+
+def pytest_addoption(parser):
+    """
+    Add an option to the py.test parser to detect when the functional tests
+    should be detected and run
+    """
+
+    parser.addoption('--functional', action='store_true', default=False,
+                     help='Add functional tests')
+
+
+def pytest_ignore_collect(path, config):
+    """Prevents collection of any files named functest* to speed up non
+        integration tests"""
+    if path.fnmatch('*functest*'):
+        try:
+            is_functional = config.getvalue('functional')
+        except KeyError:
+            return True
+
+        return not is_functional
+
+
+def pytest_configure(config):
+    """This is a bit of a hack to detect whether or not we are running inside
+        a test environment"""
+    import sys
+
+    sys._called_from_test = True
Index: tests/functest_scenarios.py
===================================================================
--- /dev/null
+++ tests/functest_scenarios.py
@@ -0,0 +1,71 @@
+import os
+import pytest
+import yaml
+import pprint
+
+from .scenarios import yaml_to_repos
+
+from rpmdeplint.repodata import Repo
+
+from utils import PASS, FAIL, check_sat
+
+
+def get_scenarios():
+    """assuming that the scenarios repo is checked out in the tests/
+    directory, scan the directory structure for scenarios that should pass or
+    fail.
+
+    :returns: list of tuples of the form (should_pass, path_to_scenario_yaml)
+    """
+    yamlfiles = []
+    for scenario_type in ['pass', 'fail']:
+        scenario_path = os.path.join(os.path.dirname(__file__),
+                                     'scenarios/scenarios/%s' % scenario_type)
+        dircontents = os.walk(scenario_path)
+        for dircontent in dircontents:
+            if len(dircontent[2]) == 0:
+                continue
+            if dircontent[1] == 'known_broken':
+                continue
+            for infile in dircontent[2]:
+                filename = '%s/%s' % (dircontent[0], infile)
+                if infile.split('.')[-1] in ['yml', 'yaml']:
+                    yamlfiles.append((scenario_type == 'pass', filename))
+    return yamlfiles
+
+
+@pytest.fixture(params=get_scenarios())
+def scenario(request):
+    return request.param
+
+
+def is_output_pass(output):
+    result = True
+    for key, value in output.items():
+        result = result and (value['result'] == PASS)
+    return result
+
+def read_yamldata(filename):
+    with open(filename, 'r') as filedata:
+        return yaml.load(filedata)
+
+
+def test_scenarios(scenario, tmpdir, monkeypatch):
+    # decode the input tuple for readability
+    scenario_pass = scenario[0]
+    scenario_path = scenario[1]
+    print scenario_pass
+    print "\n### Running scenario %s" % scenario_path
+
+    # convert the yaml scenario to fake rpms and repos
+    scenario_data = read_yamldata(scenario_path)
+    current_repo, update_repo, dummy = \
+        yaml_to_repos.create_repos(scenario_data, outdir=str(tmpdir))
+
+    repos = [Repo('current', str(current_repo)), Repo('update', str(update_repo))]
+
+    results = check_sat(str(update_repo), repos)
+
+    pprint.pprint(results)
+
+    assert is_output_pass(results) is scenario_pass
Index: tests/scenarios/README.md
===================================================================
--- /dev/null
+++ tests/scenarios/README.md
@@ -0,0 +1,69 @@
+# Test Suite
+
+Scripts that generate repositories for testing.
+
+These repos contain specially crafted RPMs, which's combinations should either PASS or FAIL.
+
+# Running the code
+
+## Running from command line
+
+In order to initiate the script from command line run the command `yaml_to_repos.py $YAML_FILE [$OUTPUT_DIR]`.
+
+The `$YAML_FILE` is a path to the YAML description file (see below), the `$OUTPUT_DIR` specifies the parent directory
+in which the repos will be created. If the `$OUTPUT_DIR` is not set, temporary directory is created automatically.
+
+## Running programatically
+
+After importing `yaml_to_repos.py`, run `yaml_to_repos.create_repos($YAML_DATA, [$OUTPUT_DIR])`. The only difference here is,
+that you need to pass the parsed yaml file as the first argument, not just a file name.
+
+You can use this snippet to parse a yaml file:
+
+```
+import yaml
+data = yaml.load(open('my_yaml_file.yaml'))
+```
+
+# Creating YAML description files
+
+First of all, you need to create a file describing the 'testcase', the file might look like this:
+
+```
+name: Simple happy path
+description:
+    This is a simple case in which an update does not cause problems
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+  -
+    envra: moo-0.2-3.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    requires: foo
+```
+
+`name`, `description`, and `expected_outcome` are metadata for the 'testsuite', and are of no significance for the repo creation.
+
+`current_repo`, and `update_repo` are YAML lists of package descriptions. The `current_repo` describes the state of the 'stable' repository,
+and the `update_repo` the available update.
+
+Each package is represented by `envra`. To describe dependencies, you can add `requires`, `provides`, `conflicts`, and `obsoletes`.
+Thus creating descriptions like these:
+```
+...
+
+  -
+    envra: foo-0.1-1.fc19.noarch
+    requires: libbar.so
+  -
+    envra: bar-0.1-1.fc19.noarch
+    provides: libbar.so
+    conflicts: moo
+
+...
+```
Index: tests/scenarios/scenarios/fail/01_version.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/fail/01_version.yaml
@@ -0,0 +1,16 @@
+name: Simple version conflict
+description:
+    Unfulfilled version requirements
+expected_outcome: fail
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+  -
+    envra: bar-0.1-1.fc19.noarch
+    requires: foo == 0.1-1
+
+update_repo:
+  -
+    envra: bar-0.2-1.fc19.noarch
+    requires: foo == 0.2-1
Index: tests/scenarios/scenarios/fail/02_multilib.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/fail/02_multilib.yaml
@@ -0,0 +1,15 @@
+name: Basic Multilib Fail
+description:
+    Missing update for one of the arches.
+expected_outcome: fail
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.i386
+  -
+    envra: foo-0.1-1.fc19.x86_64
+
+update_repo:
+  -
+    envra: bar-0.2-1.fc19.x86_64
+    requires: foo == 0.2-1.x86_64
Index: tests/scenarios/scenarios/fail/03_package_requires.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/fail/03_package_requires.yaml
@@ -0,0 +1,13 @@
+name: Missing Package Requires
+description:
+    Updated package requires another package, which is not available.
+expected_outcome: fail
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.i386
+
+update_repo:
+  -
+    envra: foo-0.2-1.fc19.x86_64
+    requires: bar
Index: tests/scenarios/scenarios/fail/04_file_requires.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/fail/04_file_requires.yaml
@@ -0,0 +1,13 @@
+name: Missing File Requires
+description:
+    Updated package requires a file, which is not provided by any package.
+expected_outcome: fail
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.i386
+
+update_repo:
+  -
+    envra: foo-0.2-1.fc19.x86_64
+    requires: libbar.so
Index: tests/scenarios/scenarios/known_broken/05_removing_provides.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/known_broken/05_removing_provides.yaml
@@ -0,0 +1,18 @@
+name: Removing Provides
+description:
+    Existing package requires something which an update removes while the requiring package is not updated
+expected_outcome: fail
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.x86_64
+    provides: cannedunicorn
+
+  -
+    envra: bar-0.1-1.fc19.x86_64
+    requires: cannedunicorn
+
+update_repo:
+  -
+    envra: foo-0.2-1.fc19.x86_64
+    obsoletes: foo-0.1-1.fc19.x86_64
Index: tests/scenarios/scenarios/known_broken/06_removing_subpackage.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/known_broken/06_removing_subpackage.yaml
@@ -0,0 +1,15 @@
+name: Broken dep for an existing package
+description:
+    Library got updated but the dependant app didn't
+expected_outcome: fail
+
+current_repo:
+  - envra: mojito-1.0-1.fc19.noarch
+    requires: libmint = 1.0
+
+  - envra: libmint-1.0-1.fc19.noarch
+    provides: libmint = 1.0
+
+update_repo:
+  - envra: libmint-2.0-1.fc19.noarch
+    provides: libmint = 2.0
Index: tests/scenarios/scenarios/pass/01_simple.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/01_simple.yaml
@@ -0,0 +1,13 @@
+name: Simple happy path
+description:
+    This is a simple case in which an update does not cause problems
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    requires: foo
Index: tests/scenarios/scenarios/pass/02_conflicts_1.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/02_conflicts_1.yaml
@@ -0,0 +1,15 @@
+name: Conflicts 1
+description:
+    When two packages conflict, they aren't supposed to be installed together
+    but this does not constitute a depsolving error.
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+    conflicts: bar
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    conflicts: foo
Index: tests/scenarios/scenarios/pass/03_conflicts_2.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/03_conflicts_2.yaml
@@ -0,0 +1,14 @@
+name: Conflicts 2
+description:
+    When two packages conflict, they aren't supposed to be installed together
+    but this does not constitute a depsolving error.
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+    conflicts: bar
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
Index: tests/scenarios/scenarios/pass/04_conflicts_3.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/04_conflicts_3.yaml
@@ -0,0 +1,14 @@
+name: Conflicts 4
+description:
+    When two packages conflict, they aren't supposed to be installed together
+    but this does not constitute a depsolving error.
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    conflicts: foo
Index: tests/scenarios/scenarios/pass/05_strange_conflict.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/05_strange_conflict.yaml
@@ -0,0 +1,22 @@
+# TODO: Check for the correct "conflicts" syntax
+name: Strange Conflict
+description:
+    This is a bit of a corner case that we've hit before where one arch's
+    package conflicts with a subpackage of another arch. This shouldn't
+    fail because you can't actually install them at the same time.
+
+    See https://fedorahosted.org/autoqa/ticket/328
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.x86_64
+    conflicts: foo-extras(x86-32)
+
+update_repo:
+  -
+    envra: foo-0.1-1.fc19.i386
+  -
+    envra: foo-extras-0.1-1.fc19.x86_64
+  -
+    envra: foo-extras-0.1-1.fc19.i386
Index: tests/scenarios/scenarios/pass/06_multilib.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/06_multilib.yaml
@@ -0,0 +1,16 @@
+name: Happy Path Multilib
+description:
+    This is a normal multilib update.
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.x86_64
+  -
+    envra: foo-0.1-1.fc19.i386
+
+update_repo:
+  -
+    envra: foo-0.2-1.fc19.x86_64
+  -
+    envra: foo-0.2-1.fc19.i386
Index: tests/scenarios/scenarios/pass/07_codependencies.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/07_codependencies.yaml
@@ -0,0 +1,32 @@
+name: Happy Path Codependencies
+description:
+    This is a normal update where the rpms in an update depend on eachother's provides
+expected_outcome: pass
+
+current_repo:
+
+  -
+    envra: kernel-tools-3.17.1-302.fc21.x86_64
+
+  -
+    envra: kernel-tools-libs-3.17.1-302.fc21.x86_64
+
+  -
+    envra: kernel-tools-libs-devel-3.17.1-302.fc21.x86_64
+    requires: 
+        - kernel-tools = 3.17.1-302.fc21
+        - kernel-tools-libs = 3.17.1-302.fc21
+
+update_repo:
+
+  -
+    envra: kernel-tools-libs-devel-3.17.1-303.fc21.x86_64
+    requires:
+        - kernel-tools = 3.17.1-303.fc21
+        - kernel-tools-libs = 3.17.1-303.fc21
+
+  -
+    envra: kernel-tools-3.17.1-303.fc21.x86_64
+
+  -
+    envra: kernel-tools-libs-3.17.1-303.fc21.x86_64
Index: tests/scenarios/scenarios/pass/08_recommends_present.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/08_recommends_present.yaml
@@ -0,0 +1,13 @@
+name: weak dependency recommends
+description:
+    This is a simple case in which the rpm recommends foo as a dep
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    recommends: foo
Index: tests/scenarios/scenarios/pass/09_recommends_not_present.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/09_recommends_not_present.yaml
@@ -0,0 +1,13 @@
+name: weak dependency recommends not present
+description:
+    This is a simple case in which the rpm recommends foo as a dep
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: bar-0.1-0.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    recommends: foo
Index: tests/scenarios/scenarios/pass/10_suggests_present.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/10_suggests_present.yaml
@@ -0,0 +1,13 @@
+name: weak dependency suggests
+description:
+    This is a simple case in which the rpm suggests foo as a dep
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: foo-0.1-1.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    suggests: foo
Index: tests/scenarios/scenarios/pass/11_suggests_not_present.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/11_suggests_not_present.yaml
@@ -0,0 +1,13 @@
+name: weak dependency suggests not present
+description:
+    This is a simple case in which the rpm suggests foo as a dep
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: bar-0.1-0.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    suggests: foo
Index: tests/scenarios/scenarios/pass/12_supplements_present.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/12_supplements_present.yaml
@@ -0,0 +1,13 @@
+name: weak dependency supplements
+description:
+    This is a simple case in which the rpm supplements foo
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: baz-0.1-1.fc19.noarch
+
+update_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+    supplements: foo
Index: tests/scenarios/scenarios/pass/13_supplements_not_present.yaml
===================================================================
--- /dev/null
+++ tests/scenarios/scenarios/pass/13_supplements_not_present.yaml
@@ -0,0 +1,13 @@
+name: weak dependency supplements not present
+description:
+    This is a simple case in which the rpm supplements foo
+expected_outcome: pass
+
+current_repo:
+  -
+    envra: bar-0.1-1.fc19.noarch
+
+update_repo:
+  -
+    envra: baz-0.1-1.fc19.noarch
+    supplements: foo
Index: tests/scenarios/yaml_to_repos.py
===================================================================
--- /dev/null
+++ tests/scenarios/yaml_to_repos.py
@@ -0,0 +1,200 @@
+# Copyright 2013, 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.
+#
+# Author: Josef Skladanka <jskladan@redhat.com>
+
+import os
+import yaml
+import tempfile
+import rpmfluff
+import rpmUtils.arch
+import rpmUtils.miscutils
+import subprocess
+
+
+__all__ = ['create_repos']
+
+def parseENVRA(envra, fmt = "envra"):
+    """
+    @param envra string to be 'manipulated' - can be standard style rpm filename,
+      envra, envr, nvr
+    @param fmt desired format of the string to be returned. Allowed options are:
+      envra, envr, nvra, nvr, e, n, v, r, a. If arch is not present in envra,
+      'noarch' is returned wherever needed.
+    @returns list of strings based on the specified format; if epoch is requested but not
+      present, it is se to empty string
+    """
+    fmt = fmt.lower()
+    supported_formats = ['envra', 'envr', 'nvra', 'nvr', 'e', 'n', 'v', 'r', 'a']
+    if fmt not in supported_formats:
+        raise ValueError("Format '%s' not in supported formats (%s)" % (fmt, ', '.join(supported_formats)))
+
+    # prepare envra so it can be used with rpmUtils.miscutils.splitFilename()
+    parts = envra.split('.')
+    if parts[-1].lower() != 'rpm':
+        parts.append('rpm')
+    if parts[-2].lower() not in rpmUtils.arch.arches.keys() + ['noarch', 'src']:
+        parts.insert(-1, 'noarch')
+
+    # split the filename
+    (n, v, r, e, a) = rpmUtils.miscutils.splitFilename('.'.join(parts))
+
+    if len(fmt) == 1:
+        return {'e':e, 'n':n, 'v':v, 'r':r, 'a':a}[fmt]
+
+    return {'envra': (e, n, v, r, a),
+            'envr' : (e, n, v ,r),
+            'nvra' : (n, v, r ,a),
+            'nvr'  : (n, v, r),
+           }[fmt]
+
+class MySimpleRpmBuild(rpmfluff.SimpleRpmBuild):
+    """Derivative of SimpleRpmBuild which allows setting output directory"""
+
+    def __init__(self, name, version, release, buildArchs=None, basedir = None):
+        rpmfluff.SimpleRpmBuild.__init__(self, name, version, release, buildArchs)
+        self._base_dir = basedir
+
+    def get_base_dir(self):
+        if self._base_dir is None:
+            return rpmfluff.SimpleRpmBuild.get_base_dir(self)
+        else:
+            if not os.path.exists(self._base_dir):
+                os.makedirs(self._base_dir)
+            return os.path.join(self._base_dir, "test-rpmbuild-%s-%s-%s"%(self.name, self.version, self.release))
+
+
+def package_to_SimpleRpmBuild(package, rpmdir = None):
+    """
+    @param package dictionary representing a 'build' parsed from the yaml data
+    @param rpmdir path in filesystem specifying destination dir for rpms
+    @returns instance of MySimpleRpmBuild
+    """
+
+    e,n,v,r,a = parseENVRA(package['envra'])
+    p = MySimpleRpmBuild(n, v, r, [a], rpmdir)
+    p.epoch = e
+
+    requires = package.get('requires', None)
+    provides = package.get('provides', None)
+    conflicts = package.get('conflicts', None)
+    obsoletes = package.get('obsoletes', None)
+    recommends = package.get('recommends', None)
+    suggests = package.get('suggests', None)
+    supplements = package.get('supplements', None)
+    enhances = package.get('enhances', None)
+
+    if requires:
+        if isinstance(requires, list):
+            for require in requires:
+                p.add_requires(require)
+        else:
+            p.add_requires(requires)
+    if recommends:
+        if isinstance(recommends, list):
+            for recommendation in recommends:
+                p.add_recommends(recommendation)
+        else:
+            p.add_recommends(recommends)
+    if suggests:
+        if isinstance(suggests, list):
+            for suggestion in suggests:
+                p.add_suggests(suggestion)
+        else:
+            p.add_suggests(suggests)
+    if supplements:
+        if isinstance(supplements, list):
+            for supplement in supplements:
+                p.add_supplements(supplement)
+        else:
+            p.add_supplements(supplements)
+
+    if provides:
+        if isinstance(provides, list):
+            for provide in provides:
+                p.add_provides(provide)
+        else:
+            p.add_provides(provides)
+    if conflicts:
+        if isinstance(conflicts, list):
+            for conflict in conflicts:
+                p.add_conflict(conflict)
+        else:
+            p.add_conflicts(conflicts)
+    if obsoletes:
+        if isinstance(obsoletes, list):
+            for obsolete in obsoletes:
+                p.add_obsoletes(obsolete)
+        else:
+            p.add_obsoletes(obsoletes)
+
+    return p
+
+
+def create_repos(data, outdir = None):
+    """
+    @param data structure parsed from the yaml file
+    @param outdir path in filesystem specifying destination directory
+        default value None creates tempdir
+    @returns tuple with three items representing paths to directories
+        'current repo', 'updates repo', 'outdir'
+    """
+
+    # prepare directories
+    if outdir is None:
+        outdir = tempfile.mkdtemp(prefix = "scenarios")
+
+    cur_dir = os.path.join(outdir, 'repo_current')
+    upd_dir = os.path.join(outdir, 'repo_updates')
+    crpm_dir = os.path.join(outdir, 'crpms')
+    urpm_dir = os.path.join(outdir, 'urpms')
+    for dirname in [outdir, cur_dir, upd_dir, crpm_dir, urpm_dir]:
+        if not os.path.isdir(dirname):
+            os.makedirs(dirname)
+
+    # build the rpms
+    for package in data['current_repo']:
+        p = package_to_SimpleRpmBuild(package, crpm_dir)
+        p.make()
+
+    for package in data['update_repo']:
+        p = package_to_SimpleRpmBuild(package, urpm_dir)
+        p.make()
+
+    # crate repos
+    for rpmdir, repodir in [(crpm_dir, cur_dir), (urpm_dir, upd_dir)]:
+        # each directory represents one rpm
+        for directory in os.listdir(rpmdir):
+            # copy all "*.rpm" files from the RPMS directory (we do not want SRCRPMS)
+            for root, dirs, files in os.walk(os.path.join(rpmdir, directory, 'RPMS')):
+                for file in [f for f in files if f.endswith('.rpm')]:
+                    subprocess.check_call(['cp', os.path.join(root, file), repodir])
+                    print "copied %s to %s" % (file, repodir)
+        # create repo
+        subprocess.check_call(['createrepo', repodir])
+
+    return (cur_dir, upd_dir, outdir)
+
+
+if __name__ == "__main__":
+    import sys
+    try:
+        data = yaml.load(open(sys.argv[1]).read())
+    except:
+        print >> sys.stderr, ("\n\nMust supply valid yaml.")
+        sys.exit(1)
+
+    create_repos(data)
Index: tests/test_squash_results.py
===================================================================
--- /dev/null
+++ tests/test_squash_results.py
@@ -0,0 +1,227 @@
+import pytest
+from dingus import Dingus
+import __builtin__
+
+from utils import squash_results
+from utils.squash_results import _squash_builds_to_updates, _squash_rpms_to_builds
+from utils import PASS, FAIL
+
+
+class TestSquashResults(object):
+    def test_rpms_to_builds_pass(self):
+        """
+        Checks whether _squash_rpms_to_builds provides correct output
+        when all rpms are 'PASS'.
+        """
+        run_results = {
+                'rpm1': {'result': PASS, 'details': []},
+                'rpm2': {'result': PASS, 'details': ["moo"]},
+                }
+        fake_koji = Dingus(rpms_to_build__returns = [{'nvr': 'nvr1'},
+                                                     {'nvr': 'nvr1'}])
+        outcome = _squash_rpms_to_builds(run_results, fake_koji)
+
+        assert len(outcome.keys()) == 1
+        assert outcome['nvr1']['result'] == PASS
+        assert outcome['nvr1']['details'] == []
+
+    def test_rpms_to_builds_fail(self):
+        """
+        Checks _squash_rpms_to_builds outcome for a `FAIL` rpm.
+        """
+        run_results = {
+                'rpm1': {'result': PASS, 'details': []},
+                'rpm2': {'result': FAIL, 'details': ["foo bar"]},
+                'rpm3': {'result': PASS, 'details': ["moo"]},
+                }
+        fake_koji = Dingus(rpms_to_build__returns = [{'nvr': 'nvr1'},
+                                                     {'nvr': 'nvr1'},
+                                                     {'nvr': 'nvr1'}])
+        outcome = _squash_rpms_to_builds(run_results, fake_koji)
+
+        assert len(outcome.keys()) == 1
+        assert outcome['nvr1']['result'] == FAIL
+        assert outcome['nvr1']['details'] == ["foo bar"]
+
+
+    def test__squash_builds_to_updates_all_ok(self):
+        """
+        Checks whether __squash_builds_to_updates provides correct output
+        when all the builds in an update passed deplinting.
+        """
+
+        run_results = {
+                'nvr1': {'result': PASS, 'details': []},
+                'nvr2': {'result': PASS, 'details': []},
+                }
+        update = {'alias': 'update_name',
+                  'builds': [{'nvr': k} for k in run_results.keys()],
+                  'release': {'name': 'F20'},
+                  'request': 'stable',
+                 }
+        build_2_update = (
+                {
+                    'nvr1': update,
+                    'nvr2': update,
+                }, {})
+
+        fake_bodhi = Dingus(build2update__returns = build_2_update)
+
+        cds = _squash_builds_to_updates(run_results, fake_bodhi)
+        assert len(cds) == 1
+
+        detail = cds[0]
+        assert detail.item == update['alias']
+        assert detail.outcome == 'PASSED'
+
+    def test__squash_builds_to_updates_build_failed(self):
+        """
+        Checks whether __squash_builds_to_updates provides correct output
+        when some of the builds in an update failed deplinting.
+        """
+        run_results = {
+                'nvr1': {'result': PASS, 'details': []},
+                'nvr2': {'result': FAIL, 'details': ['### TEST @@@']},
+                }
+        update = {'alias': 'update_name',
+                  'builds': [{'nvr': k} for k in run_results.keys()],
+                  'release': {'name': 'F20'},
+                  'request': 'stable',
+                 }
+        build_2_update = (
+                {
+                    'nvr1': update,
+                    'nvr2': update,
+                }, {})
+
+        fake_bodhi = Dingus(build2update__returns = build_2_update)
+
+        cds = _squash_builds_to_updates(run_results, fake_bodhi)
+        assert len(cds) == 1
+
+        detail = cds[0]
+        assert detail.item == update['alias']
+        assert detail.outcome == 'FAILED'
+        assert '### TEST @@@' in detail.output
+
+    def test__squash_builds_to_updates_incomplete_update(self):
+        """
+        Checks whether __squash_builds_to_updates provides correct output
+        when some update is incomplete (i.e. present in the second return-value
+        from the build2update method).
+        """
+        run_results = {
+                'nvr1': {'result': PASS, 'details': []},
+                'nvr2': {'result': PASS, 'details': []},
+                }
+        update = {'alias': 'update_name',
+                  'builds': [{'nvr': k} for k in run_results.keys()],
+                  'release': {'name': 'F20'},
+                  'request': 'stable',
+                 }
+        update['builds'].append({'nvr':'nvr3'})
+        build_2_update = ({},
+                {
+                    'nvr1': update,
+                    'nvr2': update,
+                })
+
+        fake_bodhi = Dingus(build2update__returns = build_2_update)
+
+        cds = _squash_builds_to_updates(run_results, fake_bodhi)
+        assert len(cds) == 1
+
+        detail = cds[0]
+        assert detail.item == update['alias']
+        assert detail.outcome == 'ABORTED'
+        assert any('Update was incomplete' in line for line in detail.output)
+
+    def test__squash_builds_to_updates_incomplete_update_missing_first(self):
+        """
+        Checks whether __squash_builds_to_updates provides correct output
+        when some update is incomplete (i.e. present in the second return-value
+        from the build2update method) and the missing build is the first one
+        to process (https://phab.qadevel.cloud.fedoraproject.org/T476).
+        """
+        run_results = {
+                'nvr1': {'result': PASS, 'details': []},
+                'nvr2': {'result': PASS, 'details': []},
+                }
+        update = {'alias': 'update_name',
+                  'builds': [{'nvr': k} for k in run_results.keys()],
+                  'release': {'name': 'F20'},
+                  'request': 'stable',
+                 }
+        # the builds are processed alphabetically in _squash_build_to_updates(),
+        # so naming it 'abc1' ensures it is processed before 'nvr*'
+        update['builds'].append({'nvr':'abc1'})
+        build_2_update = ({},
+                {
+                    'nvr1': update,
+                    'nvr2': update,
+                })
+
+        fake_bodhi = Dingus(build2update__returns = build_2_update)
+
+        cds = _squash_builds_to_updates(run_results, fake_bodhi)
+        assert len(cds) == 1
+
+        detail = cds[0]
+        assert detail.item == update['alias']
+        assert detail.outcome == 'ABORTED'
+        assert any('Update was incomplete' in line for line in detail.output)
+
+    def test__squash_builds_to_updates_missing_update(self):
+        """
+        Checks whether __squash_builds_to_updates provides correct output
+        when there is no update for a certain build.
+        """
+        run_results = {
+                'nvr1': {'result': PASS, 'details': []},
+                'nvr2': {'result': PASS, 'details': []},
+                }
+        update = {'alias': 'update_name',
+                  'builds': [{'nvr': 'nvr1'}],
+                  'release': {'name': 'F20'},
+                  'request': 'stable',
+                 }
+        build_2_update = (
+                { 'nvr1': update, },
+                { 'nvr2': None, },
+                )
+
+        fake_bodhi = Dingus(build2update__returns = build_2_update)
+
+        cds = _squash_builds_to_updates(run_results, fake_bodhi)
+        # 'nvr2' got ignored (just logged), so only one CheckDetail got returned
+        assert len(cds) == 1
+        detail = cds[0]
+        assert detail.item == update['alias']
+        assert detail.outcome == 'PASSED'
+
+    def test__squash_builds_to_updates_missing_alias(self):
+        """
+        Checks to make sure that missing alias is properly handled
+        """
+        run_results = {
+                'nvr1': {'result': PASS, 'details': []},
+                'nvr2': {'result': PASS, 'details': []},
+                }
+        update = {'title': 'update_name',
+                  'alias': None,
+                  'builds': [{'nvr': 'nvr1'}],
+                  'release': {'name': 'F20'},
+                  'request': 'stable',
+                 }
+        build_2_update = (
+                { 'nvr1': update, },
+                { 'nvr2': None, },
+                )
+
+        fake_bodhi = Dingus(build2update__returns = build_2_update)
+
+        cds = _squash_builds_to_updates(run_results, fake_bodhi)
+        detail = cds[0]
+        assert detail.item == update['title']
+        assert detail.outcome == 'PASSED'
+
Index: utils/__init__.py
===================================================================
--- /dev/null
+++ utils/__init__.py
@@ -0,0 +1,46 @@
+import logging
+
+if __name__ == '__main__':
+    # Set up logging ASAP to see potential problems during import.
+    # Don't set it up when not running as the main script, someone else handles
+    # that then.
+    logging.basicConfig()
+
+import glob
+import os.path
+
+from rpmdeplint import DependencyAnalyzer
+from libtaskotron.ext.fedora import rpm_utils
+
+
+PASS = 'PASSED'
+FAIL = 'FAILED'
+
+
+log = logging.getLogger('task-rpmdeplint')
+log.setLevel(logging.DEBUG)
+log.addHandler(logging.NullHandler())
+
+
+def check_sat(rpms_dir, repos):
+    '''Run rpmdeplint check-sat on the given RPM packages in `rpms_dir`
+       against the given `repos` repositories.
+
+    @param list rpms_dir list of rpm files and/or directories containing rpm files
+    @param list repos list of rpmdeplint.repodata.Repo objects
+    '''
+
+    results = {}
+    rpms = glob.glob(os.path.join(rpms_dir, '*.rpm'))
+    with DependencyAnalyzer(repos, rpms) as analyzer:
+        ok, deps_set = analyzer.try_to_install_all()
+
+        for pkg in deps_set.packages_with_problems:
+            problems = deps_set.package_dependencies[pkg]['problems']
+            nvr = rpm_utils.rpmformat(pkg)
+            results[nvr+'.rpm'] = {'details': problems, 'result': FAIL}
+        for pkg in set(deps_set.packages) - set(deps_set.packages_with_problems):
+            nvr = rpm_utils.rpmformat(pkg)
+            results[nvr+'.rpm'] = {'details': [], 'result': PASS}
+
+    return results
Index: utils/squash_results.py
===================================================================
--- /dev/null
+++ utils/squash_results.py
@@ -0,0 +1,196 @@
+import os
+import json
+
+from libtaskotron.ext.fedora.koji_utils import KojiClient
+from libtaskotron.ext.fedora.bodhi_utils import BodhiUtils
+from libtaskotron import check
+
+from . import PASS, FAIL, log
+
+def _squash_rpms_to_builds(run_result, koji_client = None):
+    """
+    Converts the per-rpm results created by check_rpm_deps into per-build.
+    :param run_result: output of the check_rpm_deps method
+    :type run_result: dict
+    :returns: dict containing per-nvr results
+    """
+    if koji_client is None:
+        koji_client = KojiClient()
+
+    per_nvr = {}
+    rpms = run_result.keys()
+
+    # rpms_to_build guarantees that order of buildinfos in list will be the
+    # same as the order of their respective rpms
+    buildinfos = koji_client.rpms_to_build(rpms)
+    for rpm, buildinfo in zip(rpms, buildinfos):
+        nvr = buildinfo['nvr']
+
+        if nvr in per_nvr:
+            if per_nvr[nvr]['result'] == PASS and \
+                            run_result[rpm]['result'] == FAIL:
+                per_nvr[nvr]['result'] = FAIL
+        else:
+            per_nvr[nvr] = {
+                    'result': run_result[rpm]['result'],
+                    'details': run_result[rpm]['details'],
+                    }
+
+        if run_result[rpm]['result'] == FAIL:
+            per_nvr[nvr]['details'].extend(run_result[rpm]['details'])
+
+    return per_nvr
+
+
+def _squash_builds_to_updates(results_nvr, bodhi_client = None):
+    """
+    Converts the per-build results created by _squash_rpms_to_builds into
+    per-update results.
+    :param results_nvr: output of the _squash_rpms_to_builds
+    :type results_nvr: dict
+    :returns: list of CheckDetail
+    """
+    if bodhi_client is None:
+        bodhi_client = BodhiUtils()
+
+    pending_ok, pending_fail = bodhi_client.build2update(results_nvr.keys(), strict = True)
+
+    updates = {}
+    for _, update in pending_ok.items():
+        update_name = update.get('alias') or update['title']
+        updates[update_name] = update
+
+
+    for build, update in pending_fail.items():
+        if update is None:
+            log.error("Build without an update: %r" % build)
+            continue
+        update_name = update.get('alias') or update['title']
+        if update_name not in updates:
+            updates[update_name]= update
+
+
+    updates_results = []
+    for update_alias, update in updates.items():
+        cd = check.CheckDetail(update_alias, check.ReportType.BODHI_UPDATE, outcome = 'PASSED',
+                               checkname='rpmdeplint')
+        updates_results.append(cd)
+
+        builds = sorted([build['nvr'] for build in update['builds']])
+
+        if set(builds).intersection(set(pending_fail.keys())):
+            # A build is in pending_fail either when it has no assigned
+            #  update (that can not happen, as we traverse builds of
+            #  a specific update), or when an update was incomplete
+            #  (e.g. missing some builds).
+            # If an update is incomplete, all its builds are put
+            #  into the pending_fail.
+            cd.update_outcome('ABORTED')
+            cd.store('Update was incomplete as downloaded at execution '
+                     'time and not all builds have been tested. This can '
+                     'happen if the update is edited in Bodhi during check '
+                     'execution.', printout=False)
+            expected = set(builds)
+            tested = set([bld for bld, upd in pending_fail.items() if upd is update])
+            missing = expected.difference(tested)
+            cd.store("Builds which haven't been tested:", printout=False)
+            for bld in sorted(missing):
+                cd.store('  %s' % bld, printout=False)
+        else:
+            for build in builds:
+                if results_nvr[build]['result'] != PASS:
+                    cd.update_outcome(results_nvr[build]['result'])
+                    cd.store('Build %s failed rpmdeplint' % build, printout=False)
+                    cd.output.extend(results_nvr[build]['details'])
+
+        # set note
+        cd.note = '%s %s' % (update['release']['name'],
+                             update['request'] if 'request' in update else update['status'])
+
+    return updates_results
+
+
+def squash_results(run_result, bodhi_client = None, koji_client = None):
+    per_nvr = _squash_rpms_to_builds(run_result, koji_client)
+    per_update = _squash_builds_to_updates(per_nvr, bodhi_client)
+
+    return per_update
+
+def format_output(run_result, arch, report_format="rpms", artifactsdir=None):
+    if not run_result:
+        return check.export_YAML([])
+
+    if 'updates' or 'builds' in report_format:
+        results = []
+
+        build_results = _squash_rpms_to_builds(run_result)
+        if 'builds' in report_format:
+            for name, status in build_results.iteritems():
+                cd = check.CheckDetail(name, check.ReportType.KOJI_BUILD, status['result'])
+                cd.output.extend(status['details'])
+                results.append(cd)
+
+        if 'updates' in report_format:
+            update_results = _squash_builds_to_updates(build_results)
+            results.extend(update_results)
+
+        # remove the arch conversion to be consistent with cmdline arch
+        if arch == 'i686':
+            arch = 'i386'
+        for result in results:
+            result.keyvals['arch'] = arch
+
+        store_artifacts(results, artifactsdir)
+        output = check.export_YAML(results)
+
+    else:
+        output = json.dumps(run_result, indent=4, separators=(',', ': '))
+
+    return output
+
+def store_artifacts(results, artifactsdir=None):
+    '''Take a list of CheckDetails and save it as inidividual log files in
+    the artifactsdir directory, provided it is defined.
+    The method also sets the artifact attribute for each result item as
+    a side effect.
+    '''
+
+    if not artifactsdir:
+        log.debug('Not writing individual logs, not requested')
+        return
+
+    try:
+        storedir = os.path.abspath(artifactsdir)
+        log.debug('Writing individual logs into: %s', storedir)
+
+        if not os.path.exists(storedir):
+            os.makedirs(storedir)
+
+        # save logs
+        for result in results:
+            item = result.item
+            filename = "%s.%s.log" % (item, result.keyvals['arch'])
+
+            # Bodhi update titles can be very long, we need to trim them
+            if len(filename) > 255:  # the max file name length for most Linux filesystems
+                exceed_len = len(filename) - 255
+                # length of ellipsis, .log and arch to make total length 255 char
+                extra_bits = 3 + 4 + len(result.keyvals['arch'])
+                item = item[:-exceed_len-extra_bits] + '...'
+                # don't need . separating item and arch since item ends with ... now
+                filename = "%s%s.log" % (item, result.keyvals['arch'])
+                assert len(filename) <= 255
+
+            filepath = os.path.join(storedir, filename)
+            fout = open(filepath, 'w')
+            fout.write(check.export_YAML(result))
+            fout.write('\n\n')
+            fout.write('\n'.join(result.output))
+            fout.close()
+            result.artifact = filepath
+
+    except OSError as e:
+        log.error('Individual logs not saved into %s, an error occured. '
+                        'Raising.', artifactsdir)
+        raise e
+
