backend/satellite_tools/reposync.py | 11 +++----
backend/satellite_tools/satsync.py | 46 +++++++++++++++---------------
backend/server/basePackageUpload.py | 2 -
backend/server/importlib/backend.py | 9 +++++
backend/server/importlib/errataImport.py | 1
backend/server/importlib/headerSource.py | 3 +
backend/server/importlib/importLib.py | 5 +++
backend/server/importlib/packageImport.py | 4 +-
backend/server/rhnLib.py | 12 +++----
backend/server/rhnPackage.py | 10 +++---
10 files changed, 61 insertions(+), 42 deletions(-)
New commits:
commit b67449784acfe44a4915102ae80de4a617f662cd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 19 16:23:06 2009 +0200
fixed ORA-06553: PLS-306: wrong number or types of arguments in call to LOOKUP_CHECKSUM
SQLError: (6553, "ORA-06553: PLS-306: wrong number or types of arguments in call to
'LOOKUP_CHECKSUM'\n", 'select lookup_checksum(:checksum) id from dual')
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index aa84f02..d362750 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -374,10 +374,10 @@ class Backend:
def lookupChecksums(self, checksumHash):
if not checksumHash:
return
- sql = "select lookup_checksum(:checksum) id from dual"
+ sql = "select lookup_checksum(:checksumtype, :checksum) id from dual"
h = self.dbmodule.prepare(sql)
for k in checksumHash.keys():
- h.execute(checksum=k)
+ h.execute(checksumtype=k[0], checksum=k[1])
checksumHash[k] = h.fetchone_dict()['id']
def ovalFileMD5sumCheck(self, erratum):
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index c5e8488..0dffc11 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -153,6 +153,7 @@ class ChannelPackageSubscription(GenericPackageImport):
'release' : package.evr[2],
'arch' : package.arch,
'org_id' : package.org_id,
+ 'checksum' : package.checksum,
}
channels = package.channels or []
l = []
commit a1a862a136d504532fd0f3e144652cd9c6d2e3e8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 19 14:55:56 2009 +0200
fixed SQLError: (1008, 'Not all variables bound', 'CHECKSUM')
File "/usr/share/rhn/server/rhnSQL/driver_cx_Oracle.py", line 144, in _execute_
raise sql_base.SQLError(1008, 'Not all variables bound', k)
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index c0fb874..aa84f02 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -377,7 +377,7 @@ class Backend:
sql = "select lookup_checksum(:checksum) id from dual"
h = self.dbmodule.prepare(sql)
for k in checksumHash.keys():
- h.execute(name=k)
+ h.execute(checksum=k)
checksumHash[k] = h.fetchone_dict()['id']
def ovalFileMD5sumCheck(self, erratum):
commit 01ea2d835a0f1cdb797a6b76078973dc4147b44d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 19 14:26:31 2009 +0200
fixed AttributeError: rpmBinaryPackage instance has no attribute 'checksum'
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 145,
in handler
relative_path=self.rel_package_path, org_id=self.org_id)
File "/usr/share/rhn/server/rhnPackageUpload.py", line 168, in push_package
importer.run()
File "/usr/share/rhn/server/importlib/importLib.py", line 626, in run
self.preprocess()
File "/usr/share/rhn/server/importlib/packageImport.py", line 50, in preprocess
self._processPackage(package)
File "/usr/share/rhn/server/importlib/packageImport.py", line 224, in _processPackage
ChannelPackageSubscription._processPackage(self, package)
File "/usr/share/rhn/server/importlib/packageImport.py", line 167, in _processPackage
GenericPackageImport._processPackage(self, package)
File "/usr/share/rhn/server/importlib/importLib.py", line 679, in _processPackage
if not self.checksums.has_key(package.checksum):
AttributeError: rpmBinaryPackage instance has no attribute 'checksum'
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 503ad73..452d4c2 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -282,6 +282,7 @@ class IncompletePackage(BaseInformation):
self.evr = None
self.arch = None
self.org_id = None
+ self.checksum = None
def toDict(self):
dict = BaseInformation.toDict(self)
commit 710724ca8bbf134259de371113bdd739800d5def
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 16 15:10:23 2009 +0200
fixed TypeError: Unknown field checksum
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 145, in handler
relative_path=self.rel_package_path, org_id=self.org_id)
File "/usr/share/rhn/server/rhnPackageUpload.py", line 168, in push_package
importer.run()
File "/usr/share/rhn/server/importlib/importLib.py", line 628, in run
self.submit()
File "/usr/share/rhn/server/importlib/packageImport.py", line 308, in submit
transactional=self.transactional)
File "/usr/share/rhn/server/importlib/backend.py", line 744, in processPackages
transactional=transactional)
File "/usr/share/rhn/server/importlib/backend.py", line 1473, in __processObjectCollection__
lookup = TableLookup(self.tables[parentTable], self.dbmodule)
File "/usr/share/rhn/server/importlib/backendLib.py", line 229, in __init__
BaseTableLookup.__init__(self, table, dbmodule)
File "/usr/share/rhn/server/importlib/backendLib.py", line 166, in __init__
self._buildWhereClauses()
File "/usr/share/rhn/server/importlib/backendLib.py", line 181, in _buildWhereClauses
if self.table.isNullable(col):
File "/usr/share/rhn/server/importlib/backendLib.py", line 118, in isNullable
raise TypeError("Unknown field %s" % field)
TypeError: Unknown field checksum
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index 7153216..c0fb874 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -371,6 +371,15 @@ class Backend:
return row['id']
+ def lookupChecksums(self, checksumHash):
+ if not checksumHash:
+ return
+ sql = "select lookup_checksum(:checksum) id from dual"
+ h = self.dbmodule.prepare(sql)
+ for k in checksumHash.keys():
+ h.execute(name=k)
+ checksumHash[k] = h.fetchone_dict()['id']
+
def ovalFileMD5sumCheck(self, erratum):
"""
When oval file is dumped on to RHN filesystem
diff --git a/backend/server/importlib/errataImport.py b/backend/server/importlib/errataImport.py
index b7b9c0d..c79251f 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -109,6 +109,7 @@ class ErrataImport(GenericPackageImport):
self.backend.lookupPackageNames(self.names)
self.backend.lookupEVRs(self.evrs)
self.backend.lookupPackageArches(self.package_arches)
+ self.backend.lookupChecksums(self.checksums)
for erratum in self.batch:
if erratum.ignored:
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 225b5d2..503ad73 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -661,6 +661,7 @@ class GenericPackageImport(Import):
self.package_arches = {}
self.channels = {}
self.channel_package_arch_compat = {}
+ self.checksums = {}
def _processPackage(self, package):
Import._processPackage(self, package)
@@ -675,6 +676,9 @@ class GenericPackageImport(Import):
if not self.package_arches.has_key(package.arch):
self.package_arches[package.arch] = None
+ if not self.checksums.has_key(package.checksum):
+ self.checksums[package.checksum] = None
+
def _postprocessPackageNEVRA(self, package):
arch = self.package_arches[package.arch]
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index fe5d89c..c5e8488 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -63,6 +63,7 @@ class ChannelPackageSubscription(GenericPackageImport):
self.backend.lookupChannelPackageArchCompat(self.channel_package_arch_compat)
self.backend.lookupPackageNames(self.names)
self.backend.lookupEVRs(self.evrs)
+ self.backend.lookupChecksums(self.checksums)
# Fix the package information up, and uniquify the packages too
uniqdict = {}
@@ -84,7 +85,7 @@ class ChannelPackageSubscription(GenericPackageImport):
package['evr_id'],
package['package_arch_id'],
package['org_id'],
- package['checksum'])
+ package['checksum_id'])
if not uniqdict.has_key(nevrao):
# Uniquify the channel names
commit 66a81cc9fc89e016b5b4de0c8a8e00f9cbb1f593
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 16 14:10:21 2009 +0200
fixed KeyError: 'unknown header tag'
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", lin
e 145, in handler
relative_path=self.rel_package_path, org_id=self.org_id)
File "/usr/share/rhn/server/rhnPackageUpload.py", line 152, in push_package
header_end=header_end, channels=channels)
File "/usr/share/rhn/server/importlib/mpmSource.py", line 210, in create_packa
ge
header_end=header_end, channels=channels)
File "/usr/share/rhn/server/importlib/headerSource.py", line 377, in createPac
kage
# to expand correctly
File "/usr/share/rhn/server/importlib/headerSource.py", line 139, in populate
header_start=None, header_end=None, channels=[]):
File "/usr/share/rhn/server/importlib/headerSource.py", line 51, in populate
File "/usr/share/rhn/common/rhn_rpm.py", line 154, in __getitem__
return self.hdr[name]
KeyError: 'unknown header tag'
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index 8c14edb..9bda12a 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -31,6 +31,7 @@ class rpmPackage(IncompletePackage):
tagMap = {
# Ignoring these tags
'last_modified' : None,
+ 'sigchecksum' : 'sigmd5', # FIXME: this has to be fixed for sha256
}
def populate(self, header, size, checksum, path=None, org_id=None,
@@ -280,7 +281,7 @@ class rpmFile(File, ChangeLog):
'rdev' : 'filerdevs',
'file_size' : 'filesizes',
'mtime' : 'filemtimes',
- 'checksum' : 'filechecksum',
+ 'checksum' : 'filemd5s', # FIXME: this has to fixed for sha256
'linkto' : 'filelinktos',
'flags' : 'fileflags',
'verifyflags' : 'fileverifyflags',
commit a9ab41f8338bbab8c4d91b824ca3093ee614f37d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 16 00:09:37 2009 +0200
fixed AttributeError: PackagePush instance has no attribute 'file_checksum'
Traceback (most recent call last):
File "/usr/share/rhn/server/apacheUploadServer.py", line 107, in _wrapper
ret = function(req)
e 137, in handler
if checksum != self.file_checksum:
AttributeError: PackagePush instance has no attribute 'file_checksum'
diff --git a/backend/server/basePackageUpload.py b/backend/server/basePackageUpload.py
index ad05f93..64db608 100644
--- a/backend/server/basePackageUpload.py
+++ b/backend/server/basePackageUpload.py
@@ -85,7 +85,7 @@ class BasePackageUpload:
self.package_version = self.field_data["Package-Version"]
self.package_release = self.field_data["Package-Release"]
self.package_arch = self.field_data["Package-Arch"]
- self.file_md5sum = self.field_data["File-MD5sum"]
+ self.file_checksum = self.field_data["File-MD5sum"]
#4/18/05 wregglej. if 1051 is in the header's keys, then it's a nosrc package.
self.is_source = (self.package_arch == 'src' or self.package_arch == 'nosrc')
return apache.OK
commit 9f0c0f1571fd50c4d001d1f6e40653aba2401366
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 23:48:33 2009 +0200
replaced one more forgotten md5sum with checksum
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 74555fd..b6159f0 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -165,7 +165,7 @@ class RepoSync:
package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
package_dict, diff_level = rhnPackageUpload.push_package(header,
- payload_stream, md5sum, force=False,
+ payload_stream, checksum, force=False,
header_start=header_start, header_end=header_end,
relative_path=rel_package_path,
org_id=self.channel['org_id'])
commit 299ff17ddae46c889cfadef0bfc9d241b20eae19
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 23:38:52 2009 +0200
fixed TypeError: get_package_path() got an unexpected keyword argument 'checksum'
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 122, in handler
self.rel_package_path = rhnPackageUpload.relative_path_from_header(
File "/usr/share/rhn/server/rhnPackageUpload.py", line 111, in relative_path_from_header
org_id=org_id, package_type=header.packaging, checksum=checksum)
File "/usr/share/rhn/server/rhnPackageUpload.py", line 122, in relative_path_from_nevra
checksum=checksum)
TypeError: get_package_path() got an unexpected keyword argument 'checksum'
diff --git a/backend/server/rhnLib.py b/backend/server/rhnLib.py
index 3695630..d8cadaf 100644
--- a/backend/server/rhnLib.py
+++ b/backend/server/rhnLib.py
@@ -165,11 +165,11 @@ def transpose_to_hash(arr, column_names):
return rh
def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
- package_type='rpm', md5sum=None):
+ package_type='rpm', checksum=None):
""" Computes a package path, optionally prepending a prefix
The path will look like
- <prefix>/<org_id>/md5sum[:3]/n/e:v-r/a/md5sum/n-v-r.a.rpm if not omit_epoch
- <prefix>/<org_id>/md5sum[:3]/n/v-r/a/md5sum/n-v-r.a.rpm if omit_epoch
+ <prefix>/<org_id>/checksum[:3]/n/e:v-r/a/checksum/n-v-r.a.rpm if not omit_epoch
+ <prefix>/<org_id>/checksum[:3]/n/v-r/a/checksum/n-v-r.a.rpm if omit_epoch
"""
name = nevra[0]
release = nevra[3]
@@ -194,7 +194,7 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
# normpath sanitizes the path (removing duplicated / and such)
template = os.path.normpath(prepend +
"/%s/%s/%s/%s-%s/%s/%s/%s-%s-%s.%s.%s")
- return template % (org, md5sum[:3], name, version, release, dirarch, md5sum,
+ return template % (org, checksum[:3], name, version, release, dirarch, checksum,
name, nevra[2], release, pkgarch, package_type)
@@ -205,10 +205,10 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
# This enables us to append an arbitrary file name that is not restricted to the
# form: name-version-release.arch.type
def get_package_path_without_package_name(nevra, org_id, prepend="",
- md5sum=None):
+ checksum=None):
"""return a package path without the package name appended"""
return os.path.dirname(get_package_path(nevra, org_id, prepend=prepend,
- md5sum=md5sum))
+ checksum=checksum))
class CallableObj:
commit f706ac1f0379f1b4518544e03dd3f9c559312db8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 17:11:19 2009 +0200
replaced md5sum with checksum
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 5598665..39e0ace 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -908,22 +908,22 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
if ul:
raise RhnSyncException, 'ERROR: incremental dump skipped'
- def _get_rel_package_path(self, nevra, org_id, source=0, md5sum=None):
+ def _get_rel_package_path(self, nevra, org_id, source=0, checksum=None):
return get_package_path(nevra, org_id, prepend=CFG.PREPENDED_DIR,
- source=source, md5sum=md5sum)
+ source=source, checksum=checksum)
- def _verify_file(self, path, mtime, size, md5sum):
+ def _verify_file(self, path, mtime, size, checksum):
"""Verifies if the file is on the filesystem and matches the mtime and
- md5sum
- Computing the md5sum is costly, that's why we rely on mtime
+ checksum
+ Computing the checksum is costly, that's why we rely on mtime
comparisons.
Returns a tuple (error_code, ret_path) where:
- if the file has the specified mtime and md5sum, error_code is 0
+ if the file has the specified mtime and checksum, error_code is 0
and ret_path is None
- if the file has the md5sum, the function sets mtime, error_code is
+ if the file has the checksum, the function sets mtime, error_code is
0 and ret_path is path
- if the file exists but has a different md5sum, error_code is the
- file's current md5sum and ret_path is path
+ if the file exists but has a different checksum, error_code is the
+ file's current checksum and ret_path is path
if the file does not exist at all, error_code is 1 and ret_path is
null
The idea is that error_code is 0 if the file exists or something else
@@ -942,11 +942,11 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Same mtime, and size, assume identity
return (0, None)
- # Have to check md5sum
- l_md5sum = rhnLib.getFileMD5(filename=abs_path)
- if l_md5sum != md5sum:
- # Different md5sums
- return (l_md5sum, path)
+ # Have to check checksum
+ l_checksum = rhnLib.getFileMD5(filename=abs_path)
+ if l_checksum != checksum:
+ # Different checksums
+ return (l_checksum, path)
# Set the mtime
os.utime(abs_path, (mtime, mtime))
@@ -957,7 +957,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
nevra = []
for t in ['name', 'epoch', 'version', 'release', 'arch']:
nevra.append(package[t])
- md5sum = package['checksum']
+ checksum = package['checksum']
package_size = package['package_size']
if package['org_id'] is not None:
@@ -965,12 +965,12 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
else:
orgid = package['org_id']
- path = self._get_rel_package_path(nevra, orgid, source=source, md5sum=md5sum)
+ path = self._get_rel_package_path(nevra, orgid, source=source, checksum=checksum)
if not row:
# Package is missing completely from the DB
m_channel_packages.append((package_id, path))
(errcode, ret_path) = self._verify_file(path,
- l_timestamp, package_size, md5sum)
+ l_timestamp, package_size, checksum)
if errcode == 0:
# Package on the filesystem, and matches
return
@@ -980,7 +980,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Package found in the DB
db_timestamp = int(rhnLib.timestamp(row['last_modified']))
- db_md5sum = row['checksum']
+ db_checksum = row['checksum']
db_package_size = row['package_size']
db_path = row['path']
final_path = db_path
@@ -988,7 +988,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Check the filesystem
# This is one ugly piece of code
(errcode, ret_path) = self._verify_file(db_path, l_timestamp,
- package_size, md5sum)
+ package_size, checksum)
if errcode != 0:
if errcode != 1 or path == db_path:
# Package is modified; fix it
@@ -997,7 +997,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Package is missing, and the DB path is, for some
# reason, not the same as the computed path.
(errcode, ret_path) = self._verify_file(path,
- l_timestamp, package_size, md5sum)
+ l_timestamp, package_size, checksum)
if errcode != 1:
# Use the computed path
final_path = path
@@ -1005,7 +1005,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# file is modified too; re-download
m_fs_packages.append((package_id, final_path))
- if (l_timestamp <= db_timestamp and md5sum == db_md5sum and
+ if (l_timestamp <= db_timestamp and checksum == db_checksum and
package_size == db_package_size and final_path == db_path):
# Same package
return
@@ -1416,10 +1416,10 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
relative_path = f['relative_path']
dest_path = os.path.join(base_path, relative_path)
timestamp = rhnLib.timestamp(f['last_modified'])
- md5sum = f['checksum']
+ checksum = f['checksum']
file_size = f['file_size']
(errcode, ret_path) = self._verify_file(dest_path,
- timestamp, file_size, md5sum)
+ timestamp, file_size, checksum)
if errcode != 0:
# Have to download it
val = (kt_label, base_path, relative_path,
commit 7f5e17201d62118df4216ae4da3ebbb45dec022b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 16:08:44 2009 +0200
removed redundant else; we call associate_package anyway
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 5db42d0..74555fd 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -144,9 +144,7 @@ class RepoSync:
self.channel['org_id'], checksum_type, checksum)
if pid is None:
self.upload_package(pack, path)
- self.associate_package(pack, checksum_type, checksum)
- else:
- self.associate_package(pack, checksum_type, checksum) #package is already on the satellite, lets just associate
+ self.associate_package(pack, checksum_type, checksum)
if self.url.find("file://") < 0:
os.remove(path)
commit d3977896a4ccc48447fc7fdc212dc38b5be0e599
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 16:07:03 2009 +0200
replaced get_package_for_md5sum with get_package_for_checksum
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index a62d85a..5db42d0 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -139,13 +139,14 @@ class RepoSync:
pack.getNVREA())
path = self.plugin.get_package(pack)
checksum = rhnLib.getFileMD5(filename=path)
- pid = rhnPackage.get_package_for_md5sum(
- self.channel['org_id'], checksum)
+ checksum_type = 'md5'
+ pid = rhnPackage.get_package_for_checksum(
+ self.channel['org_id'], checksum_type, checksum)
if pid is None:
self.upload_package(pack, path)
- self.associate_package(pack, 'md5', checksum)
+ self.associate_package(pack, checksum_type, checksum)
else:
- self.associate_package(pack, 'md5', checksum) #package is already on the satellite, lets just associate
+ self.associate_package(pack, checksum_type, checksum) #package is already on the satellite, lets just associate
if self.url.find("file://") < 0:
os.remove(path)
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index 0b77e02..e40eaf8 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -432,18 +432,20 @@ def get_channels_for_package(pkg):
return []
return map(lambda c: c['label'], ret)
-def get_package_for_md5sum(org_id, checksum):
+def get_package_for_checksum(org_id, checksum_type, checksum):
statement = """
select
p.id
from
- rhnPackage p, rhnChecksum c
+ rhnPackage p, rhnChecksum c, rhnChecksumType t
where p.org_id = :org_id
and p.checksum_id = c.id
and c.checksum = :checksum
+ and c.checksum_type_id = t.id
+ and t.label = :checksum_type
"""
h = rhnSQL.prepare(statement)
- h.execute(org_id=org_id, checksum=checksum)
+ h.execute(org_id=org_id, checksum=checksum, checksum_type=checksum_type)
ret = h.fetchone_dict()
if not ret:
return None
commit b55538227c2e90af0980ac07b1a882776b8a3540
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 16:00:06 2009 +0200
fixed ORA-00904: "P"."CHECKSUM": invalid identifier
Traceback (most recent call last):
File "/usr/share/rhn/satellite_tools/reposync.py", line 142, in import_packages
pid = rhnPackage.get_package_for_md5sum(
File "/usr/share/rhn/server/rhnPackage.py", line 446, in get_package_for_md5sum
h.execute(org_id=org_id, checksum=checksum)
File "/usr/share/rhn/server/rhnSQL/sql_base.py", line 168, in execute
return apply(self._execute_wrapper, (self._execute, ) + p, kw)
File "/usr/share/rhn/server/rhnSQL/driver_cx_Oracle.py", line 108, in _execute_wrapper
raise apply(sql_base.SQLStatementPrepareError, args)
SQLStatementPrepareError: ('ORA-00904: "P"."CHECKSUM": invalid identifier\n', 904, 'select p.id from rhnPackage p, rhnChecksum c where p.org_id = :org_id and p.checksum_id = c.id and p.checksum = :checksum')
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index e57ec50..0b77e02 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -440,7 +440,7 @@ def get_package_for_md5sum(org_id, checksum):
rhnPackage p, rhnChecksum c
where p.org_id = :org_id
and p.checksum_id = c.id
- and p.checksum = :checksum
+ and c.checksum = :checksum
"""
h = rhnSQL.prepare(statement)
h.execute(org_id=org_id, checksum=checksum)