backend/satellite_tools/diskImportLib.py | 2
backend/satellite_tools/xmlSource.py | 3
backend/server/rhnPackage.py | 112 -------------------------------
backend/server/rhnSQL/sql_row.py | 14 ---
4 files changed, 3 insertions(+), 128 deletions(-)
New commits:
commit acdc28bffc53e19a9f4d9ab4ced48fd0298990ae
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 21 22:00:39 2010 +0200
fixed NameError: name 'SourcePackageImport' is not defined
diff --git a/backend/satellite_tools/diskImportLib.py
b/backend/satellite_tools/diskImportLib.py
index 06cd255..555f815 100644
--- a/backend/satellite_tools/diskImportLib.py
+++ b/backend/satellite_tools/diskImportLib.py
@@ -26,7 +26,7 @@ from spacewalk.server.rhnSQL.const import ORACLE, POSTGRESQL
import xmlSource
import xmlDiskSource
from spacewalk.server.importlib.channelImport import ChannelImport, ChannelFamilyImport
-from spacewalk.server.importlib.packageImport import PackageImport
+from spacewalk.server.importlib.packageImport import PackageImport, SourcePackageImport
from spacewalk.server.importlib import archImport
from spacewalk.server.importlib import blacklistImport
from spacewalk.server.importlib import productNamesImport
commit 712f7b913ee1572d05b82ec604f71eb947cc6ce1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 21 14:34:56 2010 +0200
removed redundant empty tagMaps
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index 88bc8e8..4d333ec 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -708,7 +708,6 @@ addItem(ErratumItem)
class ErrorItem(BaseItem):
item_name = 'rhn-error'
item_class = importLib.Error
- tagMap = {}
addItem(ErrorItem)
class ErrataFileItem(BaseChecksummedItem):
@@ -727,13 +726,11 @@ addItem(ErrataFileItem)
class BlacklistObsoleteItem(BaseItem):
item_name = 'rhn-blacklist-obsolete'
item_class = importLib.BlacklistObsoletes
- tagMap = {}
addItem(BlacklistObsoleteItem)
class ProductNamesItem(BaseItem):
item_name = 'rhn-product-name'
item_class = importLib.ProductName
- tagMap = {}
addItem(ProductNamesItem)
class KickstartableTreeItem(BaseItem):
commit c89830b90cb36bd6a79641553c5091c57af8fb8e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 11 16:22:24 2010 +0200
reused load_sql() for load()
diff --git a/backend/server/rhnSQL/sql_row.py b/backend/server/rhnSQL/sql_row.py
index 0cc61c2..7edcff2 100644
--- a/backend/server/rhnSQL/sql_row.py
+++ b/backend/server/rhnSQL/sql_row.py
@@ -94,19 +94,9 @@ class Row(UserDictCase):
# load an entry
def load(self, hashval):
- h = self.db.prepare("select * from %s where %s = :hashval" %
(self.table, self.hashname))
- h.execute(hashval = hashval)
- ret = h.fetchone_dict()
- self.data = {}
- if not ret:
- self.real = 0
- return 0
- for k in ret.keys():
- self.data[k] = (ret[k], 0)
- self.real = 1
- return 1
+ return load_sql(self, "%s = :hashval" % self.hashname,
{'hashval': hashval})
- # kind of the same as load, but we load it from a sql clause instead
+ # load from a sql clause
def load_sql(self, sql, pdict = {}):
h = self.db.prepare("select * from %s where %s" % (self.table, sql))
apply(h.execute, (), pdict)
commit e6faded456561eadbb8b4d7a685a51a4c63d73f6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 8 16:16:41 2010 +0200
XXX: not used currently; removing
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index 303898f..e9bfdff 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -295,115 +295,6 @@ def get_source_package_path_by_name(server_id, packageName):
rhnFlags.set("Download-Accelerator-Path", rs['path'])
return filePath
-
-# get source package path from [n,v,r,e,a]
-# XXX: not used currently
-def get_source_package_path_by_nvrea(server_id, pkg):
- log_debug(3, pkg)
- pkg = map(str, pkg)
- # Build the param dict
- param_dict = {
- 'name' : pkg[0],
- 'ver' : pkg[1],
- 'rel' : pkg[2],
- 'arch' : pkg[4],
- 'server_id' : server_id
- }
- if pkg[3] == '':
- epochStatement = "is NULL"
- else:
- epochStatement = "= :epoch"
- param_dict['epoch'] = pkg[3]
-
- statement = """
- select
- unique ps.path
- from
- rhnPackage p,
- rhnPackageSource ps,
- rhnPackageName pn,
- rhnPackageEVR pe,
- rhnPackageArch pa,
- rhnChannelPackage cp,
- rhnServerChannel sc
- where
- sc.server_id = :server_id
- and sc.channel_id = cp.channel_id
- and cp.package_id = p.id
- and p.source_rpm_id = ps.source_rpm_id
- and ((p.org_id is null and ps.org_id is null)
- or (p.org_id = ps.org_id))
- and p.name_id = pn.id
- and pn.name = :name
- and p.evr_id = pe.id
- and pe.version = :ver
- and pe.release = :rel
- and pe.epoch %s
- and p.package_arch_id = pa.id
- and pa.label = :arch
- """ % epochStatement
- h = rhnSQL.prepare(statement)
- apply(h.execute, (), param_dict)
-
- rs = h.fetchone_dict()
- if not rs:
- log_debug(4, "Error", "Non-existant package requested",
server_id,
- pkg)
- raise rhnFault(17, _("Invalid RPM package %s requested") % pkg)
-
- filePath = "%s/%s" % (CFG.MOUNT_POINT, rs['path'])
- if not os.access(filePath, os.R_OK):
- # Package not found on the filesystem
- log_error("Package not found", filePath)
- raise rhnFault(17, _("Package not found"))
-
- # Set the flag for the proxy download accelerator
- rhnFlags.set("Download-Accelerator-Path", rs['path'])
- return filePath
-
-
-# get all channels that have this [n,v,r,e,a]
-# XXX: no use for this yet.
-def get_channels_for_package(pkg):
- log_debug(3, pkg)
- pkg = map(str, pkg)
- if pkg[3] == "":
- epochStatement = "is null"
- else:
- epochStatement = "= :epoch"
- statement = """
- select
- c.label
- from
- rhnChannel c,
- rhnPackage p,
- rhnPackageName pn,
- rhnPackageEVR pe,
- rhnPackageArch pa,
- rhnChannelPackage cp
- where
- p.name_id = pn.id
- and pn.name = :name
- and p.evr_id = pe.id
- and pe.version = :ver
- and pe.release = :rel
- and pe.epoch %s
- and p.package_arch_id = pa.id
- and pa.label = :arch
- and p.id = cp.package_id
- and cp.channel_id = c.id
- """ % epochStatement
- h = rhnSQL.prepare(statement)
- if pkg[3] == '':
- h.execute(name = pkg[0], ver = pkg[1], rel = pkg[2], arch = pkg[4])
- else:
- h.execute(name = pkg[0], ver = pkg[1], rel = pkg[2], arch = pkg[4],
epoch=pkg[3],)
-
- ret = h.fetchall_dict()
- if not ret:
- return []
- return map(lambda c: c['label'], ret)
-
def get_path_for_checksum(org_id, checksum_type, checksum):
statement = """
select
@@ -487,6 +378,3 @@ if __name__ == '__main__':
print get_source_package_path_by_nvre(1000463284, ['kernel', '2.4.2',
'2', ''])
print get_source_package_path_by_name(1000463284, 'kernel-2.4.2-2.src.rpm')
- # not used currently
- print get_source_package_path_by_nvrea(1000463284, ['kernel-headers',
'2.4.2', '2', '', 'i386'])
- print get_channels_for_package(['kernel', '2.4.9', '31',
'', 'i386'])