backend/satellite_tools/satsync.py | 22 ----------------------
backend/server/importlib/packageImport.py | 13 ++++++++++++-
2 files changed, 12 insertions(+), 23 deletions(-)
New commits:
commit f7d42e8e79aeca2c43da2cc47fd4b9f7ca3308b7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 28 13:27:03 2011 +0100
671465 - fixed signature import
and also moved signature / content provider import to PackageImport
where we already know package_id thus needn't go to database for it
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 0db1594..bf6fa44 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1600,30 +1600,8 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
self._import_packages_process,
_('Importing: '),
[sources])
- self._import_package_signatures(packages, channel)
return self._link_channel_packages()
- def _import_package_signatures(self, packages, channel):
- for pkg in packages:
- pkg_dicts = self._lookup_pkgs_by_path(pkg[1])
- if not pkg_dicts:
- continue
- for pkgd in pkg_dicts:
- full_path = os.path.join(CFG.MOUNT_POINT, pkgd['path'])
- if os.path.exists(full_path):
- header = rhn_rpm.get_package_header(filename=full_path)
- server_packages.processPackageKeyAssociations(header,
- pkgd['checksum_type'],
pkgd['checksum'])
-
- def _lookup_pkgs_by_path(self, path):
- h = rhnSQL.prepare("""select P.id, P.path, CV.checksum,
CV.checksum_type
- from rhnPackage P left join
- rhnPackageKeyAssociation PA on PA.package_id = P.id
inner join
- rhnChecksumView CV on CV.id = P.checksum_id
- where p.path = :path and PA.key_id is
null""")
- h.execute(path=path)
- return h.fetchall_dict()
-
def _link_channel_packages(self):
log(1, ["", messages.link_channel_packages])
short_package_collection = sync_handlers.ShortPackageCollection()
diff --git a/backend/server/importlib/packageImport.py
b/backend/server/importlib/packageImport.py
index 04fd3c4..f57fd30 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -17,11 +17,13 @@
#
import sys
+import os.path
from importLib import GenericPackageImport, IncompletePackage, \
Import, InvalidArchError, InvalidChannelError, \
IncompatibleArchError
+from spacewalk.common import CFG, rhn_rpm
from spacewalk.server import taskomatic
-from spacewalk.common import CFG
+from spacewalk.server.rhnServer import server_packages
class ChannelPackageSubscription(GenericPackageImport):
def __init__(self, batch, backend, caller=None, strict=0, repogen=True):
@@ -292,6 +294,7 @@ class PackageImport(ChannelPackageSubscription):
forceVerify=self.forceVerify,
ignoreUploaded=self.ignoreUploaded,
transactional=self.transactional)
+ self._import_signatures()
except:
# Oops
self.backend.rollback()
@@ -475,6 +478,14 @@ class PackageImport(ChannelPackageSubscription):
if object.ignored:
object.id = object.first_package.id
+ def _import_signatures(self):
+ for package in self.batch:
+ full_path = os.path.join(CFG.MOUNT_POINT, package['path'])
+ if os.path.exists(full_path):
+ header = rhn_rpm.get_package_header(filename=full_path)
+ server_packages.processPackageKeyAssociations(header,
+ package['checksum_type'],
package['checksum'])
+
class SourcePackageImport(Import):
def __init__(self, batch, backend, caller=None, update_last_modified=0):
Import.__init__(self, batch, backend)