From b84c7df48418a213e306a777df1fc2fc9c1e77f6 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Oct 06 2017 21:16:03 +0000 Subject: importImageInternal: use nextval() and InsertProcessor --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 95360cf..2391488 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -6148,7 +6148,7 @@ def import_archive_internal(filepath, buildinfo, type, typeInfo, buildroot_id=No build_type=type, filepath=filepath, fileinfo=fileinfo) # XXX verify that the buildroot is associated with a task that's associated with the build - archive_id = _singleValue("SELECT nextval('archiveinfo_id_seq')", strict=True) + archive_id = nextval('archiveinfo_id_seq') archiveinfo['id'] = archive_id insert = InsertProcessor('archiveinfo', data=archiveinfo) insert.execute() @@ -8380,15 +8380,16 @@ def importImageInternal(task_id, build_id, imgdata): rpm_ids.append(data['id']) # associate those RPMs with the image - q = """INSERT INTO archive_rpm_components (archive_id,rpm_id) - VALUES (%(archive_id)i,%(rpm_id)i)""" + insert = InsertProcessor('archive_rpm_components') for archive in archives: logger.info('working on archive %s', archive) if archive['filename'].endswith('xml'): continue + insert.set(archive_id = archive['id']) logger.info('associating installed rpms with %s', archive['id']) for rpm_id in rpm_ids: - _dml(q, {'archive_id': archive['id'], 'rpm_id': rpm_id}) + insert.set(rpm_id = rpm_id) + insert.execute() koji.plugin.run_callbacks('postImport', type='image', image=imgdata, build=build_info, fullpath=fullpath)