Skip to content

Commit

Permalink
Stop using deepcopy in primary.xml processing to speed up sync
Browse files Browse the repository at this point in the history
  • Loading branch information
goosemania committed Dec 6, 2016
1 parent de3b073 commit 9513991
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions plugins/pulp_rpm/plugins/importers/yum/repomd/primary.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

from copy import deepcopy
import os

from pulp.server import util
Expand Down Expand Up @@ -78,22 +77,6 @@
'sourcerpm': None,
'files': []}

# RPM entry dictionary ---------------------------------------------------------

# RPM entry dictionaries will make up the values in the requires and provides lists

RPM_ENTRY_SKEL = {'name': None,
'version': None,
'release': None,
'epoch': None,
'flags': None}

# file information dictionary --------------------------------------------------

# file information dictionaries will make up the values in the files lists

FILE_INFO_SKEL = {'path': None}

# element processing methods ---------------------------------------------------


Expand All @@ -107,9 +90,6 @@ def process_package_element(package_element):
:return: package information dictionary
:rtype: pulp_rpm.plugins.db.models.RPM
"""
# NOTE the use of deepcopy relies on cpython's very sensible policy of never
# duplicating string literals, this may not hold up in other implementations
# the python interpreter.
package_info = dict()

name_element = package_element.find(NAME_TAG)
Expand Down Expand Up @@ -195,9 +175,6 @@ def _process_format_element(format_element):
:return: package format dictionary
:rtype: dict
"""
# NOTE the use of deepcopy relies on cpython's very sensible policy of never
# duplicating string literals, this may not hold up in other implementations
# the python interpreter.
package_format = dict()

if format_element is None:
Expand Down Expand Up @@ -254,10 +231,7 @@ def _process_rpm_entry_element(rpm_entry_element):
:return: RPM entry dictionary
:rtype: dict
"""
# NOTE the use of deepcopy relies on cpython's very sensible policy of never
# duplicating string literals, this may not hold up in other implementations
# the python interpreter.
rpm_entry = deepcopy(RPM_ENTRY_SKEL)
rpm_entry = dict()

rpm_entry['name'] = rpm_entry_element.attrib['name']
rpm_entry['version'] = rpm_entry_element.attrib.get('ver', None)
Expand All @@ -277,10 +251,7 @@ def _process_file_element(file_element):
:return: file information dictionary
:rtype: dict
"""
# NOTE the use of deepcopy relies on cpython's very sensible policy of never
# duplicating string literals, this may not hold up in other implementations
# the python interpreter.
file_info = deepcopy(FILE_INFO_SKEL)
file_info = dict()

file_info['path'] = file_element.text

Expand Down

0 comments on commit 9513991

Please sign in to comment.