9 commits - backend/server backend/spacewalk-backend.spec rel-eng/packages

Michael Mraka mmraka at fedoraproject.org
Mon Jun 18 15:09:22 UTC 2012


 backend/server/handlers/xmlrpc/up2date.py |  202 ------------------------------
 backend/server/rhnChannel.py              |   70 ----------
 backend/server/rhnPackage.py              |  114 ----------------
 backend/spacewalk-backend.spec            |    5 
 rel-eng/packages/spacewalk-backend        |    2 
 5 files changed, 5 insertions(+), 388 deletions(-)

New commits:
commit a03f865cc4d70364cd5cead7c74b87d47eb46cdc
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Jun 18 17:09:11 2012 +0200

    Automatic commit of package [spacewalk-backend] release [1.8.36-1].

diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index b7ff9c2..5aa2985 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -12,7 +12,7 @@ Name: spacewalk-backend
 Summary: Common programs needed to be installed on the Spacewalk servers/proxies
 Group: Applications/Internet
 License: GPLv2
-Version: 1.8.35
+Version: 1.8.36
 Release: 1%{?dist}
 URL:       https://fedorahosted.org/spacewalk
 Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -663,6 +663,9 @@ rm -f %{rhnconf}/rhnSecret.py*
 
 # $Id$
 %changelog
+* Mon Jun 18 2012 Michael Mraka <michael.mraka at redhat.com> 1.8.36-1
+- removed API for v1 clients
+
 * Fri Jun 15 2012 Michael Mraka <michael.mraka at redhat.com> 1.8.35-1
 - fixed Instance of 'deb_Header' has no 'keys' member
 - removed unreachable code
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index deb64f0..55b2a23 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.8.35-1 backend/
+1.8.36-1 backend/


commit 03f1297f8507a946d75d8bcace3dbad743d317f1
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:53:14 2012 +0200

    list_packages_from_channels() was dead after list_packages_for_server() removal

diff --git a/backend/server/rhnChannel.py b/backend/server/rhnChannel.py
index e3a85e1..14b1514 100644
--- a/backend/server/rhnChannel.py
+++ b/backend/server/rhnChannel.py
@@ -1302,61 +1302,7 @@ def _list_packages(channel, cache_prefix, function):
     rhnCache.set(cache_entry, ret, c_info["last_modified"])
     return ret
 
-# list packages in a channel list and compute the latest packages
-# across the whole selection
-# channel_list is an array of hashes as returned by channel_info
-def list_packages_from_channels(channel_list):
-    if not channel_list:
-        return []
-    
-    # look it up in the cache first
-    labels = map(lambda a: a["label"], channel_list)
-    labels.sort()
-    log_debug(3, labels)
-    labels = string.join(labels, "-")
-    # get the latest channel timestamp and use it as a cache entry timestamp
-    timestamp = max(map(lambda a: a["last_modified"], channel_list))
-    cache_entry = "list_packages_from_channels-%s" % labels
-    ret = rhnCache.get(cache_entry, timestamp)   
-    if ret: # we scored a cache hit
-        log_debug(4, "Scored cache hit", labels)
-        return ret
 
-    # select the latest version of a package from the union of all channels
-    # this server is subscribed to
-    ret = {}   
-    for c in channel_list:
-        packages = list_packages_sql(c["id"])
-        for pkg in packages:
-            p = list(pkg[:4])
-            # Old client versions expect the size to be sent as an integer,
-            # not as a string; so make sure we convert it to int
-            p.append(int(pkg[5]))
-            package_name = p[0] # for readability
-            if ret.has_key(package_name):
-                # already there, need to do a version compare
-                # Compare the current package with the already stored one
-                # XXX: do we really need to use this here instead of having
-                #      the DB do the dirty work?
-                if rhn_rpm.nvre_compare(ret[package_name], p) < 0:
-                    ret[package_name] = p # Replace the stored package
-            else:
-                ret[package_name] = p
-            # XXX Should try to pick the matching architecture but this is
-            # a PITA; otherwise, for multiarched packages, we may return
-            # the wrong size. If we really care this can be done
-    # return the package list in a sorted order
-    packages = ret.values()
-    packages.sort(lambda a, b: cmp(a[0], b[0]))
-    # Save to cache and return
-    rhnCache.set(cache_entry, packages, timestamp)
-    return packages 
-
-         
-                
-        
-        
-    
 
 
 # list the obsoletes for a channel


commit b6a7adb2882fde01b9fc6d6e1b0fd3019dab67d9
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:48:05 2012 +0200

    get_source_package_path_by_name() was dead after up2date.source_package_by_name() removal

diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index ad334f0..8405c70 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -187,47 +187,6 @@ def __query_source_package_path_by_name(server_id, pkgFilename, channel):
     return h.fetchone_dict()
 
 
-# Old client
-# get source package path via package name.
-def get_source_package_path_by_name(server_id, packageName):
-    log_debug(3, packageName)
-    statement = """
-    select
-            unique ps.path
-    from
-            rhnSourceRPM sr,
-            rhnPackageSource ps,
-            rhnPackage p,
-            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 = sr.id
-            and ((p.org_id is null and ps.org_id is null) 
-                or p.org_id = ps.org_id)
-            and sr.name = :name
-            and p.source_rpm_id = ps.source_rpm_id
-    """
-    h = rhnSQL.prepare(statement)
-    h.execute(name=packageName, server_id=server_id)
-    rs = h.fetchone_dict()
-    if not rs:
-        log_debug(4, "Error", "Non-existant package requested", server_id, 
-            packageName)
-        raise rhnFault(17, _("Invalid RPM package %s requested") % packageName)
-
-    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
-
 def get_info_for_package(pkg, channel_id, org_id):
     log_debug(3, pkg)
     pkg = map(str, pkg)
@@ -295,6 +254,3 @@ if __name__ == '__main__':
     print get_package_path(1000463284, 'kernel-2.4.2-2.i686.rpm', 'redhat-linux-i386-7.1')
     print get_source_package_path(1000463284, 'kernel-2.4.2-2.i686.rpm', 'redhat-linux-i386-7.1')
     
-    # old client
-    print get_source_package_path_by_name(1000463284, 'kernel-2.4.2-2.src.rpm')
-    


commit 3d1f217cd373d448713c41ed6719019525715549
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:48:05 2012 +0200

    get_source_package_path_by_nvre() was dead after up2date.source_package() removal

diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index ad8b964..ad334f0 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -188,14 +188,6 @@ def __query_source_package_path_by_name(server_id, pkgFilename, channel):
 
 
 # Old client
-# get source package path by [n,v,r,e]
-def get_source_package_path_by_nvre(server_id, pkg):
-    log_debug(3, pkg)
-    name = "%s-%s-%s.src.rpm" % tuple(pkg[:3])
-    return get_source_package_path_by_name(server_id, name)
-
-
-# Old client
 # get source package path via package name.
 def get_source_package_path_by_name(server_id, packageName):
     log_debug(3, packageName)
@@ -304,6 +296,5 @@ if __name__ == '__main__':
     print get_source_package_path(1000463284, 'kernel-2.4.2-2.i686.rpm', 'redhat-linux-i386-7.1')
     
     # old client
-    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')
     


commit f926cc13ce62e70bfd221492cd3233773939bd9d
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:38:53 2012 +0200

    check_package_spec() was dead after up2date.package() removal

diff --git a/backend/server/handlers/xmlrpc/up2date.py b/backend/server/handlers/xmlrpc/up2date.py
index bc56580..9452e30 100644
--- a/backend/server/handlers/xmlrpc/up2date.py
+++ b/backend/server/handlers/xmlrpc/up2date.py
@@ -304,50 +304,6 @@ class Up2date(rhnHandler):
                                                   deps, clientVersion, all, limit_operator, limit)
         return result
 
-def check_package_spec(package):
-    """ Check for a package spec correctness
-        Each package should be a list or a tuple of three or four members,
-        name, version, release, [epoch]
-        in case of lack of epoch we assume "" string
-        WARNING: we need to make sure we bound ALL values as strings because
-        the lack of epoch is suggested by the empty string (''), which is going
-        to cause problems if epoch gets bound as an integer.
-    """
-    # This one checks for sane values for name, version, release
-    def __check_Int_String(name, value, package = package):
-        if type(value) not in (StringType, IntType):
-            log_error("Field %s (%s)=`%s' in %s does not pass type checks" % (
-                name, type(value), str(value), str(package)))
-            raise rhnFault(30, _("Invalid value for %s in package tuple: "
-                                 "%s (%s)") % (name, value, type(value)))
-        value = str(value)
-        if not len(value):
-            log_error("Field %s has an EMPTY value in %s" % (value, package))
-        return value
-
-    log_debug(4, package)
-    # Checks if package is a proper package spec
-    if type(package) not in (ListType, TupleType) or len(package) < 3:
-        log_error("Package argument %s (len = %d) does not "
-                  "pass type checks" % (str(package), len(package)))
-        raise rhnFault(30, _("Invalid package parameter %s (%s)") %
-                       (package, type(package)))
-    name, version, release = package[:3]
-    # figure out the epoch
-    if len(package) > 3:
-        epoch = package[3]
-        if epoch in ["(none)", "None", None]:
-            epoch = ""
-        epoch = str(epoch)
-    else:
-        epoch = ""
-    # impose some validity checks on name, version, release
-    name = __check_Int_String("name", name)
-    version = __check_Int_String("version", version)
-    release = __check_Int_String("release", release)
-    # Fix up for safety
-    return [name, version, release, epoch]
-
 
 class Servers(rhnHandler):
     """ A class to handle the site selection... """


commit c0a836fbf1ae39f55ae9bf59b731d1fed622d108
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:36:19 2012 +0200

    get_package_path_compat_arches() was dead after up2date.header() removal

diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index fe7790f..ad8b964 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -122,66 +122,6 @@ def unlink_package_file(path):
                 raise
         dirname = os.path.dirname(dirname)
 
-# Old client
-# Get a package by [n,v,r,e] and compat arch
-# Returns the path to the matching [n,v,r,e] with the max arch compatible w/ours,
-def get_package_path_compat_arches(server_id, pkg, server_arch):
-    log_debug(3, pkg, server_arch)
-    # Ugly but effective
-    pkg = map(str, pkg)
-    # Build the param dict
-    param_dict = {
-        'name'      : pkg[0], 
-        'ver'       : pkg[1],
-        'rel'       : pkg[2], 
-        'server_arch': server_arch,
-        'server_id' : server_id
-    }
-    if pkg[3] == '':
-        epochStatement = "is NULL"
-    else:
-        epochStatement = "= :epoch"
-        param_dict['epoch'] = pkg[3]
-
-    statement = """
-    select
-        p.id, p.path path, p.package_arch_id
-    from
-        rhnPackage p,
-        rhnPackageName pn,
-        rhnPackageEvr pe,
-        rhnServerArch sa,
-        rhnChannelPackage cp,
-        rhnServerPackageArchCompat spac,
-        rhnServerChannel sc
-    where
-            sc.server_id = :server_id
-        and sc.channel_id = cp.channel_id
-        and cp.package_id = p.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 = spac.package_arch_id
-        and spac.server_arch_id = sa.id
-        and sa.label = :server_arch
-        order by spac.preference
-    """ % epochStatement
-    h = rhnSQL.prepare(statement)
-    apply(h.execute, (), param_dict)
-        
-    # Because of the ordering, we have to retrieve only the first row in the
-    # result set - that should be the best one
-    row = h.fetchone_dict()
-    if not row:
-        log_debug(4, "Error", "Non-existant package requested", server_id, 
-            pkg, server_arch)
-        raise rhnFault(17, _("Invalid RPM package %s requested") % str(pkg))
-
-    return check_package_file(row['path'], row['id'], str(pkg))
-
 def get_all_package_paths(server_id, pkg_spec, channel):
     """
     return the remote path if available and localpath
@@ -361,7 +301,6 @@ if __name__ == '__main__':
     print
     # new client
     print get_package_path(1000463284, 'kernel-2.4.2-2.i686.rpm', 'redhat-linux-i386-7.1')
-    print get_package_path_compat_arches(1000463284, ['kernel', '2.4.2', '2', ''], 'i686')
     print get_source_package_path(1000463284, 'kernel-2.4.2-2.i686.rpm', 'redhat-linux-i386-7.1')
     
     # old client


commit bf6a64df496ab85fcd22e5065b70efc6cf88a038
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:33:42 2012 +0200

    list_packages_for_server() was dead since up2date.listall*() removal

diff --git a/backend/server/rhnChannel.py b/backend/server/rhnChannel.py
index a48bbf2..e3a85e1 100644
--- a/backend/server/rhnChannel.py
+++ b/backend/server/rhnChannel.py
@@ -1359,22 +1359,6 @@ def list_packages_from_channels(channel_list):
     
 
 
-# build the listall variants for the channels a server is subscribed to
-# this one uses list_packages_from_channels, which does its own caching
-def list_packages_for_server(server_id, need_size = 0):
-    log_debug(3, server_id, "need_size = %s" % need_size)
-    channel_list = channels_for_server(server_id)
-    if not channel_list:
-        return []
-    ret = list_packages_from_channels(channel_list)
-    if not ret:
-        return []
-    if need_size:
-        return ret
-    # we don't need the size in there, take it out
-    ret = map(lambda a: a[:-1], ret)
-    return ret
-
 # list the obsoletes for a channel
 def list_obsoletes(channel):
     log_debug(3, channel)


commit bf7ae6b40083e83a799644bf819fccae17302220
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:31:54 2012 +0200

    removed functions which were orphaned by client v1 API removal

diff --git a/backend/server/handlers/xmlrpc/up2date.py b/backend/server/handlers/xmlrpc/up2date.py
index 94d6bf0..bc56580 100644
--- a/backend/server/handlers/xmlrpc/up2date.py
+++ b/backend/server/handlers/xmlrpc/up2date.py
@@ -176,156 +176,6 @@ class Up2date(rhnHandler):
                                            username, passwd)
         return 0
 
-
-    def listall(self, system_id):
-        """ Clients v1-
-            Package listing in [[n,v,r,e],...] format.
-        
-            NOTE: format weirdness: epoch returned is either an integer or ''.
-        """
-        log_debug(5, system_id)
-        # Authenticate the system certificate
-        self.auth_system('listall', system_id)
-        # log the entry
-        log_debug(1, self.server_id)
-        # and now call into rhnChannel to find the data
-        return rhnChannel.list_packages_for_server(self.server_id)
-
-    def listall_size(self, system_id):
-        """ Clients v1-
-            Package listing in [[n,v,r,e,s],...] format.
-
-            NOTE: format weirdness: epoch returned is either an integer or ''.
-                                 size is an integer.
-        """
-        log_debug(5, system_id)
-        # Authenticate the system certificate
-        self.auth_system('listall_size', system_id)
-        # log the entry
-        log_debug(1, self.server_id)
-        # call into rhnChannel to find the data
-        return rhnChannel.list_packages_for_server(self.server_id,
-                                                   need_size = 1)
-
-    def header(self, system_id, pkgList):
-        """ Clients v1-
-
-            IN:  system_id: ....
-                  a package identifier (or a list of them)
-                    [n,v,r,e] or
-                    [[n,v,r,e],...]
-            OUT: If Proxy:
-                If Client:
-        """
-        log_debug(5, system_id, pkgList)
-        if type(pkgList) not in (ListType, TupleType) or not len(pkgList):
-            log_error("Invalid package list spec", type(pkgList),
-                      "len = %d" % len(pkgList))
-            raise rhnFault(30, _("Invalid value %s (type %s)") % (
-                pkgList, type(pkgList)))
-        # Okay, it's a list; is it a list of lists?
-        if type(pkgList[0]) is StringType:
-            # Wrap it in a list
-            pkgList = [pkgList]
-        # Now check all params
-        req_list = []
-        for p in pkgList:
-            req_list.append(check_package_spec(p))
-        # Authenticate the system certificate
-        server = self.auth_system('header', system_id)
-        # log the entry
-        log_debug(1, self.server_id, "items: %d" % len(req_list))
-
-        rpmHeaders = []
-        for pkg in pkgList:
-            # Authorize this package fetch.
-            # XXX: a bit heavy-handed I think... but old client stuff.
-            #      NOTE: pkg for old client is [n,v,r,e]
-            path = rhnPackage.get_package_path_compat_arches(
-                self.server_id, pkg, server.archname)
-
-            # read the header from the file on disk
-            h = rhn_rpm.get_package_header(filename=path)
-            if h is None:
-                log_error("Unable to read package header", pkg)
-                raise rhnFault(17,
-                        _("Unable to retrieve package header %s") % str(pkg))
-            rpmHeaders.append(rpclib.xmlrpclib.Binary(h.unload()))
-            del h
-
-        # Reset the flag for the proxy download accelerator
-        # This gets set by default in rhnPackage
-        rhnFlags.set("Download-Accelerator-Path", None)
-        if CFG.COMPRESS_HEADERS:
-            # Compress
-            rhnFlags.set("compress_response", 1)
-        return rpmHeaders
-
-
-    def package(self, system_id, package):
-        """ Clients v1-
-            Get rpm package.
-        """
-        log_debug(5, "Begin", package)
-
-        # Have package in canonical form
-        package = check_package_spec(package)
-
-        # Authenticate the system certificate and set the QoS data
-        # according to the user type
-        self.set_qos = 1
-        server = self.auth_system('package', system_id)
-
-        # log the entry (avoiding to fill the log in case of abuse)
-        log_debug(1, self.server_id, str(package)[:100])
-
-        filePath = rhnPackage.get_package_path_compat_arches(self.server_id,
-            package, server.archname)
-        return rpclib.transports.File(open(filePath, "r"), name=filePath)
-
-
-    def source_package(self, system_id, package):
-        """ Clients v1-
-            Get a source rpm package.
-        """
-        log_debug(5, "Begin", package)
-
-        # Have package in canonical form
-        package = check_package_spec(package)
-
-        # Authenticate the system certificate and set the QoS data
-        # according to the user type
-        self.set_qos = 1
-        server = self.auth_system('source_package', system_id)
-
-        # log the entry (avoiding to fill the log in case of abuse)
-        log_debug(1, self.server_id, str(package)[:100])
-
-        filePath = rhnPackage.get_source_package_path_by_nvre(self.server_id,
-            package)
-        return rpclib.transports.File(open(filePath, "r"), name=filePath)
-
-
-    def source_package_by_name(self, system_id, filename):
-        """ Clients v1-
-            Get a source rpm package by its human readable filename.
-            Just like source_package, but we get a package by filename.
-        """
-        log_debug(5, "Begin", filename)
-
-        # Authenticate the system certificate and set the QoS data
-        # according to the user type
-        self.set_qos = 1
-        server = self.auth_system('source_package_by_name', system_id)
-
-        # log the entry (avoiding to fill the log in case of abuse)
-        log_debug(1, self.server_id, str(filename)[:100])
-
-        filePath = rhnPackage.get_source_package_path_by_name(self.server_id,
-            filename)
-        return rpclib.transports.File(open(filePath, "r"), name=filePath)
-
-
     def solvedep(self, system_id, deps):
         """ Clients v1-
             Solve dependencies for a given dependency problem list.


commit bbb17e64c55823da94bc62c879eed4bf182c9215
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Fri Jun 15 16:25:36 2012 +0200

    removed support for v1 clients
    
    they are dead more than 10 years; even rhel3 was v2 client

diff --git a/backend/server/handlers/xmlrpc/up2date.py b/backend/server/handlers/xmlrpc/up2date.py
index c529f29..94d6bf0 100644
--- a/backend/server/handlers/xmlrpc/up2date.py
+++ b/backend/server/handlers/xmlrpc/up2date.py
@@ -53,14 +53,6 @@ class Up2date(rhnHandler):
         self.functions.append('subscribeChannels')
         self.functions.append('unsubscribeChannels')
         self.functions.append('history')
-        # --- Clients v1- ---
-        self.functions.append('listall')
-        self.functions.append('listall_size')
-        self.functions.append('header')
-        self.functions.append('package')
-        self.functions.append('source_package')
-        self.functions.append('source_package_by_name')
-        # --- All clients ---
         self.functions.append('solvedep')
         self.functions.append('solveDependencies')
         self.functions.append('solveDependencies_arch')




More information about the spacewalk-commits mailing list