backend/common/fileutils.py | 5
--
backend/common/rhnLog.py | 5
--
backend/common/rhnMail.py | 3
-
backend/common/rhnRepository.py | 13
++---
backend/common/rhnTB.py | 7
+-
backend/po/pygettext.py | 11
++--
backend/satellite_tools/exporter/exportLib.py | 25
++++------
backend/satellite_tools/geniso.py | 5
--
backend/satellite_tools/rhn-satellite-activate | 3
-
backend/satellite_tools/rhn-ssl-dbstore | 3
-
backend/satellite_tools/rhn_satellite_activate.py | 15
++----
backend/server/rhnKickstart.py | 4
-
backend/server/rhnUser.py | 13
++---
backend/upload_server/handlers/package_push/package_push.py | 5
--
java/code/src/com/redhat/rhn/taskomatic/task/repomd/PackageCapabilityIterator.java | 1
java/spacewalk-java.spec | 8
++-
rel-eng/packages/spacewalk-java | 2
17 files changed, 60 insertions(+), 68 deletions(-)
New commits:
commit 3edc1fcf34146cc8ed989c70ac48a4efac3ddb09
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jul 14 09:48:28 2011 +0200
Automatic commit of package [spacewalk-java] release [1.5.56-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 3e11996..846dd70 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.5.55
+Version: 1.5.56
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -546,6 +546,12 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Thu Jul 14 2011 Miroslav Suchý 1.5.56-1
+- changing query to cursor mode - avoid loading all records (4M+ records) into
+ memory (msuchy(a)redhat.com)
+- 720282 - fix some issues when spacewalk-koan needs to be installed for
+ systems to kickstart (tlestach(a)redhat.com)
+
* Wed Jul 13 2011 Jan Pazdziora 1.5.55-1
- 720533 - replacing rhnServerNeededView with custom subselect which is
generally equivalent, in the erratamailer_get_relevant_servers context.
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 57ed5b9..e5dbd0d 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.5.55-1 java/
+1.5.56-1 java/
commit b803f6ef78362eb34d2cfc07ca0c400e40b89dd9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jul 14 02:19:41 2011 +0200
changing query to cursor mode - avoid loading all records (4M+ records) into memory
diff --git
a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PackageCapabilityIterator.java
b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PackageCapabilityIterator.java
index d436230..58592bd 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PackageCapabilityIterator.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PackageCapabilityIterator.java
@@ -75,6 +75,7 @@ public class PackageCapabilityIterator {
PreparedStatement ps = HibernateFactory.getSession().connection()
.prepareStatement(query);
ps.setLong(1, ch.getId());
+ ps.setFetchSize(200);
rs = ps.executeQuery();
rsmd = rs.getMetaData();
}
commit a8ef8f68a4fff564acce02e7918f526396eae005
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jul 14 09:46:45 2011 +0200
do not use deprecated module "string"
diff --git a/backend/common/fileutils.py b/backend/common/fileutils.py
index b476533..5b8008f 100644
--- a/backend/common/fileutils.py
+++ b/backend/common/fileutils.py
@@ -19,7 +19,6 @@ import pwd
import grp
import types
import shutil
-import string
import subprocess
import select
import stat
@@ -55,10 +54,10 @@ def cleanupNormPath(path, dotYN=0):
os.path.expanduser(
os.path.expandvars(path)))
if dotYN and not (path and path[0] == '/'):
- dirs = string.split(path, '/')
+ dirs = path.split('/')
if dirs[:1] not in (['.'], ['..']):
dirs = ['.'] + dirs
- path = string.join(dirs, '/')
+ path = '/'.join(dirs)
return path
diff --git a/backend/common/rhnLog.py b/backend/common/rhnLog.py
index 462f5e0..0f990ec 100644
--- a/backend/common/rhnLog.py
+++ b/backend/common/rhnLog.py
@@ -32,7 +32,6 @@
# system module imports
import os
import sys
-import string
import traceback
import time
import fcntl
@@ -193,13 +192,13 @@ class rhnLog:
module = ''
try: # So one can debug from the commandline.
module = tbStack[callid][0]
- arr = string.split(module, '/')
+ arr = module.split('/')
if len(arr) > 1:
lastDir = arr[-2] + "/"
else:
lastDir = ""
filename = arr[-1]
- filename = filename[:string.rindex(filename, '.')]
+ filename = filename[:filename.rindex('.')]
module = lastDir + filename
del lastDir
except:
diff --git a/backend/common/rhnMail.py b/backend/common/rhnMail.py
index 93964bb..97bc229 100644
--- a/backend/common/rhnMail.py
+++ b/backend/common/rhnMail.py
@@ -17,7 +17,6 @@
import os
import sys
-import string
import smtplib
from rhnConfig import CFG
@@ -39,7 +38,7 @@ def __check_headers(h):
h["Content-Type"] = "text/plain; charset=utf-8"
if type(to) in [type([]), type(())]:
toaddrs = to
- to = string.join(to, ', ')
+ to = ', '.join(to)
else:
toaddrs = to.split(',')
h["To"] = to
diff --git a/backend/common/rhnRepository.py b/backend/common/rhnRepository.py
index 052a4bd..e8bcf84 100644
--- a/backend/common/rhnRepository.py
+++ b/backend/common/rhnRepository.py
@@ -17,7 +17,6 @@
import os
import stat
import types
-import string
import cStringIO
from rhn import rpclib
@@ -109,11 +108,11 @@ class Repository(RPC_Base):
""" Get srpm packrge. """
log_debug(3, pkgFilename)
# Sanity check:
- l = string.split(pkgFilename, '.')
+ l = pkgFilename.split('.')
#6/23/05 wregglej 154248, Don't mangle the filename if it's a nosrc
package.
if l[-2] != "nosrc":
l[-2] = 'src'
- pkgFilename = string.join(l, '.')
+ pkgFilename = '.'.join(l)
filePath = self.getSourcePackagePath(pkgFilename)
return self._getFile(filePath)
@@ -123,13 +122,13 @@ class Repository(RPC_Base):
change the function name, or version the protocol
"""
log_debug(3, pkgFilename)
- pkg = string.split(pkgFilename, '.')
+ pkg = pkgFilename.split('.')
# Basic sanity checks:
if pkg[-1] not in ["hdr", 'rpm']:
raise rhnFault(21, "'%s' not a valid RPM header name"
% pkgFilename)
- pkgFilename = string.join(pkg[:-1], ".") + '.rpm'
+ pkgFilename = ".".join(pkg[:-1]) + '.rpm'
filePath = self.getPackagePath(pkgFilename)
data = self._getHeaderFromFile(filePath)
# XXX: Interesting. Found that if returned just data, this
@@ -187,10 +186,10 @@ class Repository(RPC_Base):
del h # XXX: not neccessary?
pkgFilename = os.path.basename(filePath)
- pkg = string.split(pkgFilename, '.')
+ pkg = pkgFilename.split('.')
# Replace .rpm with .hdr
pkg[-1] = "hdr"
- pkgFilename = string.join(pkg, ".")
+ pkgFilename = ".".join(pkg)
extra_headers = {
'X-RHN-Package-Header' : pkgFilename,
}
diff --git a/backend/common/rhnTB.py b/backend/common/rhnTB.py
index fccc86d..b967815 100644
--- a/backend/common/rhnTB.py
+++ b/backend/common/rhnTB.py
@@ -18,7 +18,6 @@ import re
import os
import sys
import time
-import string
import traceback
from StringIO import StringIO
from rhn.connections import idn_pune_to_unicode
@@ -164,8 +163,8 @@ def Traceback(method = None, req = None, mail = 1, ostream =
sys.stderr,
to = CFG.TRACEBACK_MAIL
fr = to
if isinstance(to, type([])):
- fr = string.strip(to[0])
- to = string.join(map(string.strip, to), ', ')
+ fr = to[0].strip()
+ to = ', '.join(map(lambda x: x.strip(), to))
headers = {
"Subject" : "RHN TRACEBACK from %s" % unicode_hostname,
"From" : "%s <%s>" % (hostname, fr),
@@ -231,7 +230,7 @@ def censor_string(strval):
censorlist = get_seclist()
for c in censorlist:
#Censor it with a fixed length string. This way the length of the hidden string
isn't revealed.
- strval = string.replace(strval, c, "<CENSORED!>")
+ strval = strval.replace(c, "<CENSORED!>")
return strval
def add_to_seclist(obj):
diff --git a/backend/po/pygettext.py b/backend/po/pygettext.py
index 9e82482..dbad466 100755
--- a/backend/po/pygettext.py
+++ b/backend/po/pygettext.py
@@ -131,13 +131,12 @@ import os
import sys
import time
import getopt
-import string
import tokenize
__version__ = '1.1'
default_keywords = ['_']
-DEFAULTKEYWORDS = string.join(default_keywords, ', ')
+DEFAULTKEYWORDS = ', '.join(default_keywords)
EMPTYSTRING = ''
@@ -194,7 +193,7 @@ def escape(s):
s = list(s)
for i in range(len(s)):
s[i] = escapes[ord(s[i])]
- return string.join(s, '')
+ return ''.join(s)
def safe_eval(s):
@@ -205,7 +204,7 @@ def safe_eval(s):
def normalize(s):
# This converts the various Python string types into a format that is
# appropriate for .po files, namely much closer to C style.
- lines = string.split(s, '\n')
+ lines = s.split('\n')
if len(lines) == 1:
s = '"' + escape(s) + '"'
else:
@@ -215,7 +214,7 @@ def normalize(s):
for i in range(len(lines)):
lines[i] = escape(lines[i])
lineterm = '\\n"\n"'
- s = '""\n"' + string.join(lines, lineterm) +
'"'
+ s = '""\n"' + lineterm.join(lines) + '"'
return s
@@ -250,7 +249,7 @@ class TokenEater:
# of messages seen. Reset state for the next batch. If there
# were no strings inside _(), then just ignore this entry.
if self.__data:
- msg = string.join(self.__data,"")
+ msg = ''.join(self.__data)
if not msg in self.__options.toexclude:
entry = (self.__curfile, self.__lineno)
linenos = self.__messages.get(msg)
diff --git a/backend/satellite_tools/exporter/exportLib.py
b/backend/satellite_tools/exporter/exportLib.py
index 597c4c7..c45416e 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -14,7 +14,6 @@
#
import time
-import string
from types import StringType
from spacewalk.common import rhnLib
@@ -223,9 +222,9 @@ class _ChannelDumper(BaseRowDumper):
'label' : self._row['label'],
'org_id' : self._row['org_id'] or "",
'channel-arch' : self._row['channel_arch'],
- 'packages' : string.join(packages),
- 'channel-errata' : string.join(errata),
- 'kickstartable-trees' : string.join(ks_trees),
+ 'packages' : ' '.join(packages),
+ 'channel-errata' : ' '.join(errata),
+ 'kickstartable-trees' : ' '.join(ks_trees),
}
_query_channel_families = rhnSQL.Statement("""
@@ -638,15 +637,15 @@ class _ChannelFamilyDumper(BaseRowDumper):
log_debug(3, cf_virt_data, channel_family_id)
vsl_label = map(lambda x: x['label'], cf_virt_data)
- cf_vsl_label = string.join(vsl_label)
+ cf_vsl_label = ' '.join(vsl_label)
vsl_name = map(lambda x: x['name'], cf_virt_data)
- cf_vsl_name = string.join(vsl_name, ',')
+ cf_vsl_name = ','.join(vsl_name)
attributes = {
'id' : "rhn-channel-family-%s" %
channel_family_id,
'label' : self._row['label'],
- 'channel-labels': string.join(channels),
+ 'channel-labels': ' '.join(channels),
}
if not self._virt_filter and cf_virt_data != []:
attributes['virt-sub-level-label'] = cf_vsl_label
@@ -678,7 +677,7 @@ class _PackageDumper(BaseRowDumper):
'last-modified' :
_dbtime2timestamp(self._row['last_modified']),
}
for attr in attrs:
- dict[string.replace(attr, '_', '-')] = self._row[attr]
+ dict[attr.replace('_', '-')] = self._row[attr]
if self._row['checksum_type'] == 'md5':
# compatibility with older satellite
dict['md5sum'] = self._row['checksum']
@@ -807,7 +806,7 @@ class SourcePackagesDumper(BaseQueryDumper):
"cookie", "package_size", "checksum_type",
"checksum"
]
for attr in attrs:
- attributes[string.replace(attr, '_', '-')] = data[attr]
+ attributes[attr.replace('_', '-')] = data[attr]
attributes['id'] = "rhn-source-package-%s" %
data['id']
attributes['build-time'] = _dbtime2timestamp(data['build_time'])
attributes['last-modified'] =
_dbtime2timestamp(data['last_modified'])
@@ -917,9 +916,9 @@ class _ErratumDumper(BaseRowDumper):
'id' : 'rhn-erratum-%s' % self._row['id'],
'org_id' : self._row['org_id'] or "",
'advisory' : self._row['advisory'],
- 'channels' : string.join(channels),
- 'packages' : string.join(packages),
- 'cve-names' : string.join(cves),
+ 'channels' : ' '.join(channels),
+ 'packages' : ' '.join(packages),
+ 'cve-names' : ' '.join(cves),
}
type_id_column = ""
@@ -1034,7 +1033,7 @@ class _ErratumFileEntryDumper(BaseChecksumRowDumper):
and efc.channel_id = c.id
""")
h.execute(errata_file_id=self._row['errata_file_id'])
- channels = string.join(
+ channels = ' '.join(
map(lambda x: x['label'], h.fetchall_dict() or []))
if channels:
attributes['channels'] = channels
diff --git a/backend/satellite_tools/geniso.py b/backend/satellite_tools/geniso.py
index 9910041..3ef3a5f 100644
--- a/backend/satellite_tools/geniso.py
+++ b/backend/satellite_tools/geniso.py
@@ -17,7 +17,6 @@
import os
import sys
import time
-import string
from stat import ST_SIZE
from optparse import Option, OptionParser
@@ -147,7 +146,7 @@ def main(arglist):
grafts.append("%s/=%s" % (relpath, f))
# Generate the command line
- cmd = mkisofsTemplate % (string.join(opts), filename, i+1, cdcount,
+ cmd = mkisofsTemplate % (' '.join(opts), filename, i+1, cdcount,
empty_file_path)
# Write the path specs in pathfiles
@@ -196,7 +195,7 @@ def sizeStrToInt(s):
if s[-1] in ('k', 'K', 'm', 'M'):
# Specified a multiplier
- if string.lower(s[-1]) == 'k':
+ if s[-1].lower() == 'k':
mult = 1024
else:
mult = 1024 * 1024
diff --git a/backend/satellite_tools/rhn-satellite-activate
b/backend/satellite_tools/rhn-satellite-activate
index c650db7..c56f9b6 100755
--- a/backend/satellite_tools/rhn-satellite-activate
+++ b/backend/satellite_tools/rhn-satellite-activate
@@ -18,13 +18,12 @@
import sys
try:
import os
- import string
except KeyboardInterrupt:
sys.stderr.write("\nUser interrupted process.\n")
sys.exit(0)
-mod_name = string.replace(os.path.basename(sys.argv[0]), '-', '_')
+mod_name = os.path.basename(sys.argv[0]).replace('-', '_')
try:
mod = __import__("spacewalk.satellite_tools", globals(), locals(),
[mod_name])
except KeyboardInterrupt:
diff --git a/backend/satellite_tools/rhn-ssl-dbstore
b/backend/satellite_tools/rhn-ssl-dbstore
index 362b7fd..bfc75b0 100755
--- a/backend/satellite_tools/rhn-ssl-dbstore
+++ b/backend/satellite_tools/rhn-ssl-dbstore
@@ -19,13 +19,12 @@
import sys
try:
import os
- import string
except KeyboardInterrupt:
sys.stderr.write("\nUser interrupted process.\n")
sys.exit(0)
-mod_name = string.replace(os.path.basename(sys.argv[0]), '-', '_')
+mod_name = os.path.basename(sys.argv[0]).replace('-', '_')
try:
mod = __import__("spacewalk.satellite_tools", globals(), locals(),
[mod_name])
except KeyboardInterrupt:
diff --git a/backend/satellite_tools/rhn_satellite_activate.py
b/backend/satellite_tools/rhn_satellite_activate.py
index 7d2c6c9..eee7910 100644
--- a/backend/satellite_tools/rhn_satellite_activate.py
+++ b/backend/satellite_tools/rhn_satellite_activate.py
@@ -18,7 +18,6 @@ import os
import sys
import time
import gzip
-import string
from optparse import Option, OptionParser
from rhn import rpclib
from rhn.connections import idn_ascii_to_pune
@@ -114,7 +113,7 @@ def validateSatCert(certFilename, verbosity=0):
# doesn't like).
fd, certTmpFile = tempfile.mkstemp(prefix = DEFAULT_RHN_CERT_LOCATION + '-')
fo = os.fdopen(fd, 'wb')
- fo.write(string.strip(openGzippedFile(certFilename).read()))
+ fo.write(openGzippedFile(certFilename).read().strip())
fo.flush()
fo.close()
@@ -122,7 +121,7 @@ def validateSatCert(certFilename, verbosity=0):
DEFAULT_WEBAPP_GPG_KEY_RING, certTmpFile]
if verbosity:
- print "Checking cert XML sanity and GPG signature:",
repr(string.join(args))
+ print "Checking cert XML sanity and GPG signature:", repr('
'.join(args))
ret, out, err = fileutils.rhn_popen(args)
err = err.read()
@@ -131,7 +130,7 @@ def validateSatCert(certFilename, verbosity=0):
# nuke temp cert
os.unlink(certTmpFile)
- if string.find(err, 'verify err') != -1 or ret:
+ if err.find('verify err') != -1 or ret:
msg = "%s Entitlement Certificate failed to validate.\n" %
PRODUCT_NAME
msg = msg + "MORE INFORMATION:\n"
msg = msg + " Return value: %s\n" % ret +\
@@ -169,7 +168,7 @@ def prepRhnCert(options):
'could not be opened and read:\n%s') % (options.rhn_cert,
str(e))
sys.stderr.write(msg+'\n')
raise
- cert = string.strip(cert)
+ cert = cert.strip()
try:
writeRhnCert(options, cert)
except (IOError, OSError), e:
@@ -412,7 +411,7 @@ def populateChannelFamilies(options):
# args.extend(['--db', options.db])
if options.verbose:
- print "Executing: %s\n" % repr(string.join(args))
+ print "Executing: %s\n" % repr(' '.join(args))
ret, out_stream, err_stream = fileutils.rhn_popen(args)
if ret:
msg_ = "Population of the Channel Family permissions failed."
@@ -436,7 +435,7 @@ def expiredYN(certPath):
sys.stderr.write("ERROR: unable to open the cert: %s\n" % certPath)
sys.exit(1)
- cert = string.strip(fo.read())
+ cert = fo.read().strip()
fo.close()
## parse it and snag "expires"
@@ -502,7 +501,7 @@ def processCommandline():
if not CFG.RHN_PARENT:
sys.stderr.write("ERROR: rhn_parent is not set in
/etc/rhn/rhn.conf\n")
sys.exit(1)
- options.server =
idn_ascii_to_pune(string.split(rhnLib.parseUrl(CFG.RHN_PARENT)[1], ':')[0])
+ options.server =
idn_ascii_to_pune(rhnLib.parseUrl(CFG.RHN_PARENT)[1].split(':')[0])
print 'RHN_PARENT: %s' % options.server
options.http_proxy = idn_ascii_to_pune(CFG.HTTP_PROXY)
diff --git a/backend/server/rhnKickstart.py b/backend/server/rhnKickstart.py
index 2b9b23e..510fd57 100644
--- a/backend/server/rhnKickstart.py
+++ b/backend/server/rhnKickstart.py
@@ -13,8 +13,6 @@
# in this software or its documentation.
#
-import string
-
# common module
from spacewalk.common.rhnLog import log_debug
from spacewalk.common.rhnException import rhnFault
@@ -139,7 +137,7 @@ class Kickstart:
for channel_pkg in channel_pkgs:
# If we find the pkg, set found and break the loop.
- if string.find(string.lower(channel_pkg[0]), string.lower(pkg)) > 0:
+ if channel_pkg[0].lower().find(pkg.lower()) > 0:
found = 1
break
diff --git a/backend/server/rhnUser.py b/backend/server/rhnUser.py
index 1399a2e..3b48a89 100644
--- a/backend/server/rhnUser.py
+++ b/backend/server/rhnUser.py
@@ -18,7 +18,6 @@
import re
import crypt
-import string
# Global Modules
from rhn.UserDictCase import UserDictCase
@@ -131,7 +130,7 @@ class User:
def set_contact_perm(self, name, value):
""" handling of contact permissions """
if not name: return -1
- n = string.lower(name)
+ n = name.lower()
v = 'N'
if value:
v = 'Y'
@@ -153,9 +152,9 @@ class User:
}
if not name:
return -1
- name = string.lower(name)
+ name = name.lower()
if type(value) == type(""):
- value = string.strip(value)
+ value = value.strip()
# We have to watch over carefully for different field names
# being sent from rhn_register
changed = 0
@@ -600,7 +599,7 @@ def __new_user_db(username, password, email, org_id, org_password):
if not data: # wrong organization
raise rhnFault(2, _("Invalid Organization Credentials"))
# The org password is not encrypted, easy comparison
- if string.lower(org_password) != string.lower(data["password"]):
+ if org_password.lower() != data["password"].lower():
# Invalid org password
raise rhnFault(2, _("Invalid Organization Credentials"))
if is_real: # this is a real entry, don't clobber the org_id
@@ -661,7 +660,7 @@ def check_user_password(username, password):
def check_email(email):
""" Do some minimal checks on the e-mail address """
if email is not None:
- email = string.strip(email)
+ email = email.strip()
if not email:
# Still supported
@@ -779,6 +778,6 @@ def validate_new_username(username):
log_debug(4, "Disallowed suffixes", disallowed_suffixes)
for suffix in disallowed_suffixes:
- if string.upper(username[-len(suffix):]) == string.upper(suffix):
+ if username[-len(suffix):].upper() == suffix.upper():
raise rhnFault(106, _("Cannot register usernames ending with %s")
%
suffix)
diff --git a/backend/upload_server/handlers/package_push/package_push.py
b/backend/upload_server/handlers/package_push/package_push.py
index 97bf404..8fb49fb 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -20,7 +20,6 @@
import os
import base64
-import string
from rhn import rpclib
from spacewalk.common import apache, rhnFlags
@@ -163,7 +162,7 @@ class PackagePush(basePackageUpload.BasePackageUpload):
return apache.OK
def get_auth_token(self, value):
- s = string.join(map(string.strip, string.split(value, ',')), '')
- arr = map(base64.decodestring, string.split(s, ':'))
+ s = ''.join(map(lambda x: x.strip(), value.split('')))
+ arr = map(base64.decodestring, s.split(':'))
return arr