backend/satellite_tools/satsync.py | 12 ++++++-----
backend/server/importlib/backendOracle.py | 4 +--
backend/server/importlib/kickstartImport.py | 13 ++++++++++++
backend/upload_server/handlers/package_push/package_push.py | 4 +--
web/modules/rhn/RHN/DB/AppInstall/Session.pm | 4 +--
5 files changed, 26 insertions(+), 11 deletions(-)
New commits:
commit c36ea4a58aab2a12e3808a10b7c683b7a5a8f6f3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 17 10:18:34 2009 +0100
satellite-sync - sha256 changes for kickstart import
diff --git a/backend/server/importlib/backendOracle.py
b/backend/server/importlib/backendOracle.py
index d97b625..8f47846 100644
--- a/backend/server/importlib/backendOracle.py
+++ b/backend/server/importlib/backendOracle.py
@@ -473,11 +473,11 @@ class OracleBackend(Backend):
fields = {
'kstree_id' : DBint(),
'relative_filename' : DBstring(256),
- 'md5sum' : DBstring(64),
+ 'checksum_id' : DBint(),
'file_size' : DBint(),
'last_modified' : DBdateTime()
},
- pk = ['kstree_id', 'relative_filename'],
+ pk = ['kstree_id', 'relative_filename',
'checksum_id'],
attribute = 'files',
map = {
'relative_filename' : 'relative_path',
diff --git a/backend/server/importlib/kickstartImport.py
b/backend/server/importlib/kickstartImport.py
index 36d1efc..9fdcf1f 100644
--- a/backend/server/importlib/kickstartImport.py
+++ b/backend/server/importlib/kickstartImport.py
@@ -27,6 +27,7 @@ class KickstartableTreeImport(Import):
self.kstree_types = {}
self.ks_install_types = {}
+ self.checksums = {}
def preprocess(self):
# Processes the batch to a form more suitable for database
@@ -46,11 +47,20 @@ class KickstartableTreeImport(Import):
ks_install_label = ent['install_type_label']
ks_install_name = ent['install_type_name']
self.ks_install_types[ks_install_label] = ks_install_name
+ for f in ent['files']:
+ if 'md5sum' in f: # old pre-sha256 export
+ checksum = ('md5', f['md5sum'])
+ else:
+ checksum = (f['checksum_type'], f['checksum'])
+ f['checksum'] = checksum
+ if checksum not in self.checksums:
+ self.checksums[checksum] = None
def fix(self):
self.backend.lookup_kstree_types(self.kstree_types)
self.backend.lookup_ks_install_types(self.ks_install_types)
self.backend.lookupChannels(self.channels)
+ self.backend.lookupChecksums(self.checksums)
for ent in self.batch:
if ent.ignored:
@@ -65,6 +75,9 @@ class KickstartableTreeImport(Import):
ks_install_label = ent['install_type_label']
ent['kstree_type'] = self.kstree_types[kstree_type_label]
ent['install_type'] = self.ks_install_types[ks_install_label]
+ for f in ent['files']:
+ f['checksum_id'] = self.checksums[f['checksum']]
+
def submit(self):
self.backend.processKickstartTrees(self.batch)
commit ca22d7dc41edfc7f7531c36d12a58e9657809c6a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 16 16:39:58 2009 +0100
fixed UnboundLocalError: local variable 'checksum' referenced before
assignment
Traceback (most recent call last):
File "/usr/share/rhn/server/apacheUploadServer.py", line 107, in _wrapper
ret = function(req)
File "/usr/share/rhn/upload_server/handlers/package_push/package_push.py",
line 118,
+in handler
checksum = (header.checksum_type(),
UnboundLocalError: local variable 'checksum' referenced before assignment
diff --git a/backend/upload_server/handlers/package_push/package_push.py
b/backend/upload_server/handlers/package_push/package_push.py
index f18c4b9..03840d3 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -27,7 +27,7 @@ from rhn import rpclib
from common import CFG, log_debug, log_error, rhnFault, rhnFlags
from server import rhnPackageUpload, rhnSQL, basePackageUpload
-from spacewalk.common import checksum
+from spacewalk.common.checksum import getFileChecksum
class PackagePush(basePackageUpload.BasePackageUpload):
def __init__(self, req):
@@ -116,7 +116,7 @@ class PackagePush(basePackageUpload.BasePackageUpload):
# Sanity check - removed, the package path can no longer be determined
# without the header
checksum = (header.checksum_type(),
- checksum.getFileChecksum(header.checksum_type(), file=temp_stream))
+ getFileChecksum(header.checksum_type(), file=temp_stream))
self.rel_package_path = rhnPackageUpload.relative_path_from_header(
header, org_id=self.org_id, checksum=checksum)
self.package_path = os.path.join(CFG.MOUNT_POINT,
commit 211dc74310a70eb4c2c61ecd80b790d752218615
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 16 15:05:32 2009 +0100
old export has md5sum key
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 38a50d9..ca92549 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -849,7 +849,7 @@ Please contact your RHN representative""" %
(generation, sat_cert.generation))
def _diff_packages(self):
package_collection = sync_handlers.ShortPackageCollection()
nvrea_keys = ['name', 'epoch', 'version', \
- 'release', 'arch', 'checksum']
+ 'release', 'arch', 'checksum',
'checksum_type']
h = rhnSQL.prepare(self._query_compare_packages)
missing_channel_packages = {}
@@ -876,6 +876,9 @@ Please contact your RHN representative""" %
(generation, sat_cert.generation))
package = package_collection.get_package(pid, p_timestamp)
assert package is not None
nevra = {}
+ if 'md5sum' in package: # old pre-sha256 export
+ package['checksum_type'] = 'md5'
+ package['checksum'] = package['md5sum']
for t in nvrea_keys:
nevra[t] = package[t] or ""
@@ -885,14 +888,13 @@ Please contact your RHN representative""" %
(generation, sat_cert.generation))
else:
nevra['org_id'] = package['org_id']
- params = nevra.copy()
- params['checksum_type'] = nevra['checksum'][0]
- params['checksum'] = nevra['checksum'][1]
- apply(h.execute, (), params)
+ apply(h.execute, (), nevra)
row = h.fetchone_dict()
# Update the progress bar
pb.addTo(1)
pb.printIncrement()
+ # make checksum tuple (type, string)
+ package['checksum'] = (package['checksum_type'],
package['checksum'])
self._process_package(pid, package, l_timestamp, row,
m_channel_packages, m_fs_packages, source=0)
pb.printComplete()
commit 131184357ec6a098bf547ce122c9abdc46674e68
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 16 14:58:17 2009 +0100
modified to fit sha256 schema changes
diff --git a/web/modules/rhn/RHN/DB/AppInstall/Session.pm
b/web/modules/rhn/RHN/DB/AppInstall/Session.pm
index 39db401..7c4e7c4 100644
--- a/web/modules/rhn/RHN/DB/AppInstall/Session.pm
+++ b/web/modules/rhn/RHN/DB/AppInstall/Session.pm
@@ -30,7 +30,7 @@ my %valid_fields = (id => 0,
app_instance => { isa => 'RHN::AppInstall::Instance',
optional => 1 },
instance_id => 0,
- md5sum => 0,
+ checksum_id => 0,
process_name => { type => SCALAR },
step_number => { type => SCALAR | UNDEF,
default => -1 },
@@ -69,7 +69,7 @@ sub sequence { return 'rhn_appinst_session_id_seq' }
my %db_fields = (id => 1,
instance_id => 1,
- md5sum => 1,
+ checksum_id => 1,
process_name => 1,
step_number => 1,
user_id => 1,