backend/satellite_tools/disk_dumper/dumper.py | 3 -
backend/satellite_tools/disk_dumper/iss.py | 2
backend/satellite_tools/exporter/exportLib.py | 2
backend/satellite_tools/xmlSource.py | 61 +++++++-------------------
backend/server/importlib/errataImport.py | 3 -
backend/server/importlib/importLib.py | 27 ++++++++---
6 files changed, 42 insertions(+), 56 deletions(-)
New commits:
commit 005e7841f7ab0fc6bf5cf535760d3887cae8b342
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 15:52:28 2010 +0100
removed redundant tags
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index d42c53a..a8c0930 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -601,19 +601,6 @@ class FileItem(BaseChecksummedItem):
item_name = 'rhn-package-file'
item_class = importLib.File
tagMap = {
- 'rhn-package-file-device' : 'device',
- 'rhn-package-file-inode' : 'inode',
- 'rhn-package-file-file_mode': 'file_mode',
- 'rhn-package-file-username' : 'username',
- 'rhn-package-file-groupname': 'groupname',
- 'rhn-package-file-rdev' : 'rdev',
- 'rhn-package-file-file_size': 'file_size',
- 'rhn-package-file-mtime' : 'mtime',
- 'rhn-package-file-md5' : 'md5sum',
- 'rhn-package-file-linkto' : 'linkto',
- 'rhn-package-file-flags' : 'flags',
- 'rhn-package-file-verifyflags': 'verifyflags',
- 'rhn-package-file-lang' : 'lang',
'md5' : 'md5sum',
}
addItem(FileItem)
@@ -704,7 +691,6 @@ class ErrataFileItem(BaseChecksummedItem):
# Specific to XML
'package' : 'package',
'source-package' : 'source-package',
- 'checksum' : 'checksum',
'checksum-type' : 'checksum_type',
}
addItem(ErrataFileItem)
@@ -743,7 +729,6 @@ class KickstartFileItem(BaseChecksummedItem):
'relative-path' : 'relative_path',
'file-size' : 'file_size',
'last-modified' : 'last_modified',
- 'checksum' : 'checksum',
'checksum-type' : 'checksum_type',
}
addItem(KickstartFileItem)
commit 19644c46be3536a9c485523a29e75936501e2ad7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 15:34:45 2010 +0100
fixed md5sum -> checksum rewrite condition
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index a151393..d42c53a 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -468,12 +468,12 @@ addItem(ChannelItem)
class BaseChecksummedItem(BaseItem):
def populate(self, attributes, elements):
item = BaseItem.populate(self, attributes, elements)
- if ('md5sum' in item and item['md5sum']
- and ('checksum' not in item or not item['checksum'])):
- # xml dumps < 3.5 (aka pre-sha256)
- item['checksum_type'] = 'md5'
- item['checksum'] = item['md5sum']
- del(item['md5sum'])
+ if 'md5sum' in item:
+ if type(item['checksum']) != types.StringType:
+ # xml dumps < 3.5 (aka pre-sha256)
+ item['checksum_type'] = 'md5'
+ item['checksum'] = item['md5sum']
+ del(item['md5sum'])
return item
addItem(BaseChecksummedItem)
@@ -614,6 +614,7 @@ class FileItem(BaseChecksummedItem):
'rhn-package-file-flags' : 'flags',
'rhn-package-file-verifyflags': 'verifyflags',
'rhn-package-file-lang' : 'lang',
+ 'md5' : 'md5sum',
}
addItem(FileItem)
diff --git a/backend/server/importlib/importLib.py
b/backend/server/importlib/importLib.py
index 260b726..289b935 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -238,7 +238,7 @@ class File(Item):
'verifyflags' : IntType,
'lang' : StringType,
# those attributes are mutualy exclusive
- 'md5' : StringType, # xml dumps < 3.5
+ 'md5sum' : StringType, # xml dumps < 3.5
'filedigest' : StringType, # spacewalk-repo-sync
'checksum' : StringType, # xml dumps >= 3.5
'checksum_type' : StringType, # xml dumps >= 3.5
@@ -335,7 +335,6 @@ class Package(IncompletePackage):
'source_rpm' : StringType,
'package_size' : IntType,
'last_modified' : DateType,
- 'md5sum' : StringType,
'sigmd5' : StringType,
'sigpgp' : StringType,
'siggpg' : StringType,
@@ -343,6 +342,10 @@ class Package(IncompletePackage):
'header_start' : IntType,
'header_end' : IntType,
'path' : StringType,
+ # these attributes are mutualy exclusive
+ 'md5sum' : StringType, # xml dumps < 3.5
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
# These attributes are lists of objects
'files' : [File],
'requires' : [Dependency],
@@ -373,9 +376,12 @@ class SourcePackage(IncompletePackage):
'vendor' : StringType,
'cookie' : StringType,
'package_size' : IntType,
- 'md5sum' : StringType,
'path' : StringType,
'last_modified' : DateType,
+ # these attributes are mutualy exclusive
+ 'md5sum' : StringType, # xml dumps < 3.5
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
}
def __init__(self):
# Inherit from IncompletePackage
@@ -392,9 +398,12 @@ class SourcePackage(IncompletePackage):
class SourcePackageFile(Information):
attributeTypes = {
'file_size' : IntType,
- 'md5sum' : StringType,
'path' : StringType,
'org_id' : IntType,
+ # these attributes are mutualy exclusive
+ 'md5sum' : StringType, # xml dumps < 3.5
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
}
@@ -407,11 +416,14 @@ class Bug(Information):
class ErrataFile(Information):
attributeTypes = {
- 'md5sum' : StringType,
'filename' : StringType,
'file_type' : StringType,
'channel_list' : [StringType],
'package_id' : IntType,
+ # these attributes are mutualy exclusive
+ 'md5sum' : StringType, # xml dumps < 3.5
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
}
@@ -520,7 +532,10 @@ class KickstartFile(Information):
'relative_path' : StringType,
'last_modified' : DateType,
'file_size' : IntType,
- 'md5sum' : StringType,
+ # these attributes are mutualy exclusive
+ 'md5sum' : StringType, # xml dumps < 3.5
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
}
class KickstartableTree(Information):
commit 2da6e9eab66d7e6e84b3ede96217d1786cb58985
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 14:33:43 2010 +0100
simplified md5sum handling
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index a617e71..a151393 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -465,8 +465,19 @@ class ChannelItem(BaseItem):
}
addItem(ChannelItem)
+class BaseChecksummedItem(BaseItem):
+ def populate(self, attributes, elements):
+ item = BaseItem.populate(self, attributes, elements)
+ if ('md5sum' in item and item['md5sum']
+ and ('checksum' not in item or not item['checksum'])):
+ # xml dumps < 3.5 (aka pre-sha256)
+ item['checksum_type'] = 'md5'
+ item['checksum'] = item['md5sum']
+ del(item['md5sum'])
+ return item
+addItem(BaseChecksummedItem)
-class IncompletePackageItem(BaseItem):
+class IncompletePackageItem(BaseChecksummedItem):
item_name = 'rhn-package-short'
item_class = importLib.IncompletePackage
tagMap = {
@@ -477,15 +488,6 @@ class IncompletePackageItem(BaseItem):
'org-id' : 'org_id',
'checksum-type' : 'checksum_type', # xml dump 3.5
(sha256)
}
-
- def populate(self, attributes, elements):
- item = BaseItem.populate(self, attributes, elements)
- if item['md5sum']:
- # xml dumps < 3.5 (pre-sha256)
- item['checksum_type'] = 'md5'
- item['checksum'] = item['md5sum']
- del(item['md5sum'])
- return item
addItem(IncompletePackageItem)
class PackageItem(IncompletePackageItem):
@@ -595,7 +597,7 @@ class ObsoletesItem(BaseItem):
}
addItem(ObsoletesItem)
-class FileItem(BaseItem):
+class FileItem(BaseChecksummedItem):
item_name = 'rhn-package-file'
item_class = importLib.File
tagMap = {
@@ -607,21 +609,12 @@ class FileItem(BaseItem):
'rhn-package-file-rdev' : 'rdev',
'rhn-package-file-file_size': 'file_size',
'rhn-package-file-mtime' : 'mtime',
- 'rhn-package-file-md5' : 'md5',
+ 'rhn-package-file-md5' : 'md5sum',
'rhn-package-file-linkto' : 'linkto',
'rhn-package-file-flags' : 'flags',
'rhn-package-file-verifyflags': 'verifyflags',
'rhn-package-file-lang' : 'lang',
}
- def populate(self, attributes, elements):
- item = BaseItem.populate(self, attributes, elements)
- if 'md5' in item and type(item['md5']) == types.StringType:
- # xml dumps < 3.5 (pre-sha256)
- # if md5 is empty set empty checksum - e.g. for dirs and links
- item['checksum_type'] = 'md5'
- item['checksum'] = item['md5']
- del(item['md5'])
- return item
addItem(FileItem)
class DistItem(BaseItem):
@@ -701,7 +694,7 @@ class ErrorItem(BaseItem):
tagMap = {}
addItem(ErrorItem)
-class ErrataFileItem(BaseItem):
+class ErrataFileItem(BaseChecksummedItem):
item_name = 'rhn-erratum-file'
item_class = importLib.ErrataFile
tagMap = {
@@ -713,14 +706,6 @@ class ErrataFileItem(BaseItem):
'checksum' : 'checksum',
'checksum-type' : 'checksum_type',
}
- def populate(self, attributes, elements):
- item = BaseItem.populate(self, attributes, elements)
- if item['md5sum']:
- # xml dumps < 3.5 (pre-sha256)
- item['checksum_type'] = 'md5'
- item['checksum'] = item['md5sum']
- del(item['md5sum'])
- return item
addItem(ErrataFileItem)
class BlacklistObsoleteItem(BaseItem):
@@ -750,7 +735,7 @@ class KickstartableTreeItem(BaseItem):
}
addItem(KickstartableTreeItem)
-class KickstartFileItem(BaseItem):
+class KickstartFileItem(BaseChecksummedItem):
item_name = 'rhn-kickstart-file'
item_class = importLib.KickstartFile
tagMap = {
@@ -760,14 +745,6 @@ class KickstartFileItem(BaseItem):
'checksum' : 'checksum',
'checksum-type' : 'checksum_type',
}
- def populate(self, attributes, elements):
- item = BaseItem.populate(self, attributes, elements)
- if item['md5sum']:
- # xml dumps < 3.5 (pre-sha256)
- item['checksum_type'] = 'md5'
- item['checksum'] = item['md5sum']
- del(item['md5sum'])
- return item
addItem(KickstartFileItem)
#
commit 719c0c637a646f6b26e1ff27504328a633d6d4a6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 14:10:37 2010 +0100
fixed errata import over ISS
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index 51ceb5f..a617e71 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -710,7 +710,17 @@ class ErrataFileItem(BaseItem):
# Specific to XML
'package' : 'package',
'source-package' : 'source-package',
+ 'checksum' : 'checksum',
+ 'checksum-type' : 'checksum_type',
}
+ def populate(self, attributes, elements):
+ item = BaseItem.populate(self, attributes, elements)
+ if item['md5sum']:
+ # xml dumps < 3.5 (pre-sha256)
+ item['checksum_type'] = 'md5'
+ item['checksum'] = item['md5sum']
+ del(item['md5sum'])
+ return item
addItem(ErrataFileItem)
class BlacklistObsoleteItem(BaseItem):
diff --git a/backend/server/importlib/errataImport.py
b/backend/server/importlib/errataImport.py
index 74cfa56..b16c568 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -76,9 +76,6 @@ class ErrataImport(GenericPackageImport):
def _preprocessErratumFiles(self, erratum):
for f in (erratum['files'] or []):
- if 'md5sum' in f: # old pre-sha256 export
- f['checksum_type'] = 'md5'
- f['checksum'] = f['md5sum']
checksumTuple = (f['checksum_type'], f['checksum'])
if not self.checksums.has_key(checksumTuple):
self.checksums[checksumTuple] = None
commit 05cc9a45177d0f4d6bc97139ce5e83d7e9c3b397
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 13:43:23 2010 +0100
attribute name have to be 'checksum-type' in the dump
diff --git a/backend/satellite_tools/exporter/exportLib.py
b/backend/satellite_tools/exporter/exportLib.py
index 9bdc2a7..dd833bf 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -1031,7 +1031,7 @@ class _ErratumFilesDumper(BaseDumper):
def dump_subelement(self, data):
attributes = {
- 'checksum_type' : data['checksum_type'],
+ 'checksum-type' : data['checksum_type'],
'checksum' : data['checksum'],
# XXX: band-aid - truncate to 128 chars for olde satellites.
'filename' : data['filename'][:128],
commit 4a86b6abcfe83d723df914290c8f901db083d70e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 13:21:20 2010 +0100
fixed typo
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index 745eb19..dbc9e99 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -211,7 +211,7 @@ class Dumper(dumper.XML_Dumper):
###BINARY RPM INFO###
try:
query = """
- select rcp.package_id id, rp.path path,
+ select rcp.package_id id, rp.path path
from rhnChannelPackage rcp, rhnPackage rp
where rcp.package_id = rp.id
and rcp.channel_id = :channel_id
commit c7116f98bed2658e57bcfb53530ceed6fbe3eefc
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 13 11:44:32 2010 +0100
fixed ISS error
Traceback (most recent call last):
...
File "/usr/share/rhn/satellite_tools/disk_dumper/dumper.py", line 869, in
+set_attributes
attributes = SatelliteDumper.set_attributes(self)
File "/usr/share/rhn/satellite_tools/disk_dumper/dumper.py", line 862, in
+set_attributes
attributes['version'] = CFG.XML_DUMP_VERSION
File "/usr/share/rhn/common/rhnConfig.py", line 336, in __getattr__
raise AttributeError(key)
AttributeError: XML_DUMP_VERSION
diff --git a/backend/satellite_tools/disk_dumper/dumper.py
b/backend/satellite_tools/disk_dumper/dumper.py
index daef8ed..cc01592 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -866,8 +866,9 @@ class SatelliteDumper(exportLib.SatelliteDumper):
class SatelliteDumperEx(SatelliteDumper):
def set_attributes(self):
""" Overriding with our own version """
- attributes = SatelliteDumper.set_attributes(self)
+ attributes = exportLib.SatelliteDumper.set_attributes(self)
attributes['version'] = constants.PROTOCOL_VERSION
+ attributes['generation'] = CFG.SAT_CERT_GENERATION
return attributes
class QueryIterator: