Report manifest error 33/141033/2
authorhyokeun <hyokeun.jeon@samsung.com>
Fri, 28 Jul 2017 01:27:38 +0000 (10:27 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Fri, 28 Jul 2017 03:15:20 +0000 (12:15 +0900)
Problem: Duplicated rpms generated for the same source.
Cause: Not removing the old package after renaming the package name.
Action: Send e-mail notification to the mailing list.

Change-Id: Iadf1c2a89e0d51684809fde82ec47963f58c64a8

common/repomaker.py
job_create_snapshot.py

index 4d4fcc1..812f5c9 100644 (file)
@@ -28,6 +28,7 @@ import rpm
 from common.builddata import BuildData, BuildDataError
 from common.imagedata import ImageData
 from common import manifest
+import xml.etree.cElementTree as ElementTree
 
 # arch map table:
 # key->val: map the arch from 'key' to 'val' to make the url unify
@@ -347,6 +348,15 @@ class RepoMaker(object):
                   'w') as manifest_fh:
             manifest_fh.write(manifest_string)
 
+        manifest_items = []
+        try:
+            tree = ElementTree.fromstring(manifest_string)
+            for project in tree.findall('project'):
+                manifest_items.append({project.get('path'): project.get('revision')})
+        except Exception as err:
+            print repr(err)
+        return manifest_items
+
     def get_rpm_vcs_from(self, rpm_file):
         """Returns rpm information by querying a rpm"""
         ts = rpm.ts()
index 062f8bb..d7a5ea7 100644 (file)
@@ -32,6 +32,7 @@ from common.buildservice import BuildService
 from common.backenddb import BackendDB
 from common.snapshot import Snapshot, SnapshotError, snapshot_project_enabled
 from common.utils import make_latest_link
+from common.send_mail import prepare_mail
 
 class LocalError(Exception):
     """Local error exception."""
@@ -266,6 +267,15 @@ def make_repo(project, backenddb, base_path, live_repo_base):
                                     os.getenv('GERRIT_FETCH_URL'),
                                     os.getenv('GERRIT_REVIEW_URL'),
                                     live_repo_path, repo['Architectures'])
+        # Check duplicated items
+        path_list = [ t.keys()[0] for t in manifest_items ]
+        duplicated = set([x for x in path_list if path_list.count(x) > 1])
+        if len(duplicated) >= 1:
+            prepare_mail('error_report_manifest.env', \
+                         'Snapshot %s have duplicated packages' % (snapshot.build_id), \
+                         '\nDuplicated items: %s' % duplicated, \
+                         os.getenv('NOREPLY_EMAIL_SENDER'), \
+                         os.getenv('MAILINGLIST_SYSTEM').split(','))
 
     return {'project': project,
             'repo': repos,