Index: libabigail.yml
===================================================================
--- /dev/null
+++ libabigail.yml
@@ -0,0 +1,77 @@
+name: libabigail
+desc: download updates and latest stable package from koji and compare ABI changes between them
+maintainer: sinnykumari
+
+input:
+    args:
+        - koji_build
+
+environment:
+    rpm:
+        - libabigail
+
+actions:
+    - name: download rpms for given build for all architetcures
+      koji:
+        action: download_latest_stable
+        koji_build: ${koji_build}
+        arch: ['all']
+        debuginfo: True
+        target_dir: ${workdir}/stable
+
+    - name: download bodhi updates rpms from koji for all arcitetcures
+      koji:
+        action: download
+        koji_build: ${koji_build}
+        arch: ['all']
+        debuginfo: True
+        target_dir: ${workdir}/update
+
+    - name: run libabigail's abipkgdiff tool between updates and latest stable package for x86_64
+      python:
+          file: run_abipkgdiff.py
+          callable: run_abipkgdiff
+          arch: 'x86_64'
+          koji_build: ${koji_build}
+          artifactsdir: ${artifactsdir}
+          stable_rpmsdir: ${workdir}/stable
+          update_rpmsdir: ${workdir}/update
+      export: abidiff_output_x86_64
+
+    - name: run libabigail's abipkgdiff tool between updates and latest stable package for i686
+      python:
+          file: run_abipkgdiff.py
+          callable: run_abipkgdiff
+          arch: 'i686'
+          koji_build: ${koji_build}
+          artifactsdir: ${artifactsdir}
+          stable_rpmsdir: ${workdir}/stable
+          update_rpmsdir: ${workdir}/update
+      export: abidiff_output_i686
+
+    - name: run libabigail's abipkgdiff tool between updates and latest stable package for armv7hl
+      python:
+          file: run_abipkgdiff.py
+          callable: run_abipkgdiff
+          arch: 'armv7hl'
+          koji_build: ${koji_build}
+          artifactsdir: ${artifactsdir}
+          stable_rpmsdir: ${workdir}/stable
+          update_rpmsdir: ${workdir}/update
+      export: abidiff_output_armv7hl
+
+
+    - name: report results to resultsdb
+      resultsdb:
+        results: ${abidiff_output_x86_64}
+      export: abidiff_output_x86_64
+     
+    - name: report results to resultsdb
+      resultsdb:
+          results: ${abidiff_output_i686}
+      export: abidiff_output_i686
+
+    - name: report results to resultsdb
+      resultsdb:
+          results: ${abidiff_output_armv7hl}
+      export: abidiff_output_armv7hl
Index: run_abipkgdiff.py
===================================================================
--- /dev/null
+++ run_abipkgdiff.py
@@ -0,0 +1,146 @@
+import os
+import sys
+import subprocess
+
+from rpmUtils.miscutils import splitFilename
+from libtaskotron import check
+
+def enum(**enums):
+    return type('Enum', (), enums)
+
+def run_abipkgdiff(koji_build, stable_rpmsdir, update_rpmsdir,
+                   arch, artifactsdir='artifacts'):
+    # Create artifacts directory if doesn't exist
+    if not os.path.exists(artifactsdir):
+        os.makedirs(artifactsdir)
+
+    update_debuginfo_rpm = []
+    stable_debuginfo_rpm = []
+    stable_rpms_detail = []
+    update_rpms_detail = []
+    output = []
+    result = 'PASSED'
+    log_path = os.path.join(artifactsdir, '%s.log' % koji_build)
+    update_rpms = []
+    stable_rpms = []
+    # abipkgdiff return status as menioned on libabigail wiki page
+    # https://sourceware.org/libabigail/manual/abidiff.html#return-values
+    abipkgdiff_status = enum(ABIDIFF_OK = 0, ABIDIFF_ERROR = 1,
+                         ABIDIFF_USAGE_ERROR = 2, ABIDIFF_ABI_CHANGE = 4,
+                         ABIDIFF_ABI_INCOMPATIBLE_CHANGE = 8)
+
+    # Get debuginfo rpm for specified architecture
+    for rpm in os.listdir(stable_rpmsdir):
+        if arch in rpm:
+            if 'debuginfo' in rpm:
+               stable_debuginfo_rpm.append(rpm)
+            else:
+                stable_rpms.append(rpm)
+                (n, v, r, e, a) = splitFilename(rpm)
+                rpm_details = {'rpm': rpm, 'name': n, 'version':v, 'release': r,
+                              'e': e, 'arch': a}
+                stable_rpms_detail.append(rpm_details)
+
+    '''
+    Extract and save NVER of rpms. Right now, Name field of rpm is used to
+    to find similar rpm in both update and stable rpm list for running
+    abipkgdiff on them
+    '''
+    for rpm in os.listdir(update_rpmsdir):
+        if arch in rpm:
+            if 'debuginfo' in rpm:
+                update_debuginfo_rpm.append(rpm)
+            else:
+                update_rpms.append(rpm)
+                (n, v, r, e, a) = splitFilename(rpm)
+                rpm_details = {'rpm': rpm, 'name': n, 'version':v,
+                               'release': r, 'e': e, 'arch': a}
+                update_rpms_detail.append(rpm_details)
+
+    # Prepare abipkgdiff command with required args
+    base_command = ['abipkgdiff']
+
+    if len(stable_debuginfo_rpm) == 1:
+        base_command.append('--d1')
+        base_command.append(stable_rpmsdir + '/' + stable_debuginfo_rpm[0])
+
+    if len(update_debuginfo_rpm) == 1:
+        base_command.append('--d2')
+        base_command.append(update_rpmsdir + '/' + update_debuginfo_rpm[0])
+
+    if not os.path.exists(log_path):
+        output.append("ABI changes report summary for pacakge update id %s"\
+                      " against latest stable pacakge in koji\n" % koji_build)
+        output.append("===================================================="\
+                      "=================================================\n\n")
+    output.append("On %s architecture\n" % arch)
+    output.append("-------------------------\n\n")
+    for update_rpm in update_rpms_detail:
+        for stable_rpm in stable_rpms_detail:
+            if stable_rpm['name'] == update_rpm['name']:
+                update_rpms.remove(update_rpm['rpm'])
+                stable_rpms.remove(stable_rpm['rpm'])
+                command = list(base_command)
+                command.append(stable_rpmsdir + '/' + stable_rpm['rpm'])
+                command.append(update_rpmsdir + '/' + update_rpm['rpm'])
+
+                # Execute abipkgdiff command with arguments
+                proc = subprocess.Popen(command, stdout=subprocess.PIPE,
+                                                stderr=subprocess.PIPE)
+                # Get error and abipkgdiff execution output
+                res = proc.communicate()
+                # Contains error information"
+                if res[1]:
+                    result = "FAILED"
+                    output.append("* Some error encountered while running"\
+                        " command %s\n\n" %(' '.join(command)))
+
+                else:
+                    # Check for abipkgdiff exit status
+                    if proc.returncode == abipkgdiff_status.ABIDIFF_OK:
+                        output.append("* No ABI change between RPM packages %s " \
+                                      "and %s\n\n" %(stable_rpm['rpm'],
+                                      update_rpm['rpm']))
+                    if proc.returncode & abipkgdiff_status.ABIDIFF_ERROR:
+                        output.append("* Error while running command %s\n" \
+                                      %(' '.join(command)))
+                        result = 'FAILED'
+                    if proc.returncode & abipkgdiff_status.ABIDIFF_USAGE_ERROR:
+                        output.append("* Insufficient arguments to command"\
+                            " abipkgdiff: %s\n" %(' '.join(command)))
+                        result = 'FAILED'
+                    if proc.returncode & abipkgdiff_status.ABIDIFF_ABI_CHANGE:
+                        output.append("* ABI changes found between" \
+                               " packages %s and %s. Please review them.\n\n" \
+                                   %(stable_rpm['rpm'], update_rpm['rpm']))
+                        output.append(res[0])
+                        if result != 'FAILED':
+                            result = 'NEEDS_INSPECTION'
+                    # Compared ABI are different and may be incompatible
+                    if proc.returncode & abipkgdiff_status.ABIDIFF_ABI_INCOMPATIBLE_CHANGE:
+                        output.append("* Incompatible ABI changes between" \
+                               " packages %s and %s. Please review them.\n\n" \
+                                   %(stable_rpm['rpm'], update_rpm['rpm']))
+                        output.append(res[0])
+                        result = 'FAILED'
+
+    if len(stable_rpms) > 0:
+        output.append("* Following rpms are no longer available:\n")
+        output.append("  %s\n\n" %('\n'.join(stable_rpms)))
+        passflag = False
+    if len(update_rpms) > 0:
+        output.append("* Additional rpms has been included in update:\n")
+        output.append("  %s\n\n" %('\n'.join(update_rpms)))
+
+    summary = 'ABI check for koji build %s on %s architecture' \
+              % (koji_build, arch)
+    detail = check.CheckDetail(koji_build, check.ReportType.BODHI_UPDATE,
+                               result, summary)
+
+    # Save logs
+    with open(log_path, 'a') as log_file:
+        log_file.writelines(output)
+    detail.artifact = log_path
+    output = check.export_YAML(detail)
+
+    return output
