diff -ur createrepo-0.9.8.orig/createrepo/__init__.py createrepo-0.9.8/createrepo/__init__.py
--- createrepo-0.9.8.orig/createrepo/__init__.py	2009-08-28 18:36:29.000000000 +0200
+++ createrepo-0.9.8/createrepo/__init__.py	2010-08-23 10:21:37.000000000 +0200
@@ -44,8 +44,8 @@
 except ImportError:
     pass
 
-from utils import _gzipOpen, bzipFile, checkAndMakeDir, GzipFile, \
-                  checksum_and_rename
+from utils import _gzipOpen, _lzmaOpen, bzipFile, checkAndMakeDir, \
+                  GzipFile, LzmaFile, HybridFile, checksum_and_rename
 import deltarpms
 
 __version__ = '0.9.8'
@@ -124,6 +124,12 @@
         else:
             self.callback = callback    
         
+        if self.conf.lzma or self.conf.xz:
+            suffix = self.conf.lzma and ".lzma" or ".xz"
+            if self.conf.nogzip:
+                self.conf.primaryfile = self.conf.primaryfile[:-3] + suffix
+                self.conf.filelistsfile = self.conf.filelistsfile[:-3] + suffix
+                self.conf.otherfile = self.conf.otherfile[:-3] + suffix
                     
         self.ts = rpmUtils.transaction.initReadOnlyTransaction()
         self.pkgcount = 0
@@ -379,11 +385,23 @@
         if self.conf.deltas:
             self.deltafile = self._setupDelta()
 
+    def _fileOpen(self, filepath, mode):
+        if self.conf.lzma or self.conf.xz:
+            if self.conf.nogzip:
+                format = self.conf.lzma and 'alone' or 'xz'
+                fo = LzmaFile(filepath, mode, options={'format':format})
+            else:
+                type = self.conf.lzma and 'lzma' or 'xz'
+                fo = HybridFile(filepath, mode, type=type)
+        else:
+            fo = GzipFile(filepath, mode, compresslevel=9)
+        return fo
+
     def _setupPrimary(self):
         # setup the primary metadata file
         primaryfilepath = os.path.join(self.conf.outputdir, self.conf.tempdir, 
                                        self.conf.primaryfile)
-        fo = _gzipOpen(primaryfilepath, 'w')
+        fo = self._fileOpen(primaryfilepath, 'w')
         fo.write('<?xml version="1.0" encoding="UTF-8"?>\n')
         fo.write('<metadata xmlns="http://linux.duke.edu/metadata/common"' \
             ' xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="%s">' %
@@ -394,7 +412,7 @@
         # setup the filelist file
         filelistpath = os.path.join(self.conf.outputdir, self.conf.tempdir, 
                                     self.conf.filelistsfile)
-        fo = _gzipOpen(filelistpath, 'w')
+        fo = self._fileOpen(filelistpath, 'w')
         fo.write('<?xml version="1.0" encoding="UTF-8"?>\n')
         fo.write('<filelists xmlns="http://linux.duke.edu/metadata/filelists"' \
                  ' packages="%s">' % self.pkgcount)
@@ -404,7 +422,7 @@
         # setup the other file
         otherfilepath = os.path.join(self.conf.outputdir, self.conf.tempdir, 
                                      self.conf.otherfile)
-        fo = _gzipOpen(otherfilepath, 'w')
+        fo = self._fileOpen(otherfilepath, 'w')
         fo.write('<?xml version="1.0" encoding="UTF-8"?>\n')
         fo.write('<otherdata xmlns="http://linux.duke.edu/metadata/other"' \
                  ' packages="%s">' %
@@ -736,6 +754,16 @@
                 sfile = '%s.bz2' % sfile
                 outfn = os.path.join(outdir, sfile)
                 output = BZ2File(filename = outfn, mode='wb')
+            elif compress_type == 'lzma':
+                from lzma import LZMAFile
+                sfile = '%s.lzma' % sfile
+                outfn = os.path.join(outdir, sfile)
+                output = LZMAFile(filename = outfn, mode='wb', options={'format':'alone'})
+            elif compress_type == 'xz':
+                from lzma import LZMAFile
+                sfile = '%s.xz' % sfile
+                outfn = os.path.join(outdir, sfile)
+                output = LZMAFile(filename = outfn, mode='wb')
         else:
             outfn  = os.path.join(outdir, sfile)
             output = open(outfn, 'w')
@@ -823,17 +851,45 @@
                 dbversion = '9'
             rp = sqlitecachec.RepodataParserSqlite(repopath, repoid, None)
 
+        if self.conf.lzma or self.conf.xz:
+            suffix = self.conf.lzma and ".lzma" or ".xz"
+            if self.conf.nogzip:
+                workfiles = [(self.conf.otherfile, 'other',),
+                             (self.conf.filelistsfile, 'filelists'),
+                             (self.conf.primaryfile, 'primary')]
+            elif self.conf.lzma:
+                workfiles.append((self.conf.otherfile[:-3] + suffix, "other_lzma"))
+                workfiles.append((self.conf.filelistsfile[:-3] + suffix, "filelists_lzma"))
+                workfiles.append((self.conf.primaryfile[:-3] + suffix, "primary_lzma"))
+            elif self.conf.xz:
+                workfiles.append((self.conf.otherfile[:-1] + suffix, "other_xz"))
+                workfiles.append((self.conf.filelistsfile[:-1] + suffix, "filelists_xz"))
+                workfiles.append((self.conf.primaryfile[:-1] + suffix, "primary_xz"))
+
+        open_csums = {}
+        open_sizes = {}
         for (rpm_file, ftype) in workfiles:
             complete_path = os.path.join(repopath, rpm_file)
             
-            zfo = _gzipOpen(complete_path)
-            # This is misc.checksum() done locally so we can get the size too.
-            data = misc.Checksums([sumtype])
-            while data.read(zfo, 2**16):
-                pass
-            uncsum = data.hexdigest(sumtype)
-            unsize = len(data)
-            zfo.close()
+            if (ftype.endswith("_lzma") or ftype.endswith("_xz")) and not self.conf.nogzip:
+                # reuse the open-checksum computed for the .gz file
+                type = ftype[:-5]
+                uncsum = open_csums[type]
+                unsize = open_sizes[type]
+            else:
+                if (self.conf.lzma or self.conf.xz) and self.conf.nogzip:
+                    zfo = _lzmaOpen(complete_path)
+                else:
+                    zfo = _gzipOpen(complete_path)
+                # This is misc.checksum() done locally so we can get the size too.
+                data = misc.Checksums([sumtype])
+                while data.read(zfo, 2**16):
+                    pass
+                uncsum = data.hexdigest(sumtype)
+                unsize = len(data)
+                zfo.close()
+                open_csums[ftype] = uncsum
+                open_sizes[ftype] = unsize
             csum = misc.checksum(sumtype, complete_path)
             timestamp = os.stat(complete_path)[8]
 
@@ -933,7 +985,7 @@
             if self.conf.baseurl is not None:
                 location.newProp('xml:base', self.conf.baseurl)
             if self.conf.unique_md_filenames:
-                res_file = '%s-%s.xml.gz' % (csum, ftype)
+                res_file = '%s-%s' % (csum, rpm_file)
                 orig_file = os.path.join(repopath, rpm_file)
                 dest_file = os.path.join(repopath, res_file)
                 os.rename(orig_file, dest_file)
@@ -1030,8 +1082,10 @@
             oldfile = os.path.join(output_old_dir, f)
             finalfile = os.path.join(output_final_dir, f)
             if f.find('-') != -1 and f.split('-')[1] in ('primary.sqlite.bz2',
-                    'filelists.sqlite.bz2', 'primary.xml.gz','other.sqlite.bz2',
-                    'other.xml.gz','filelists.xml.gz'):
+                    'filelists.sqlite.bz2','other.sqlite.bz2','primary.xml.gz',
+                    'primary.xml.lzma','primary.xml.xz','other.xml.gz',
+                    'other.xml.lzma','other.xml.xz','filelists.xml.gz',
+                    'filelists.xml.lzma','filelists.xml.xz'):
                 os.remove(oldfile) # kill off the old ones
                 continue
             if f in ('filelists.sqlite.bz2', 'other.sqlite.bz2', 
diff -ur createrepo-0.9.8.orig/createrepo/utils.py createrepo-0.9.8/createrepo/utils.py
--- createrepo-0.9.8.orig/createrepo/utils.py	2009-08-28 18:36:29.000000000 +0200
+++ createrepo-0.9.8/createrepo/utils.py	2010-08-23 10:07:15.000000000 +0200
@@ -19,6 +19,10 @@
 import os
 import os.path
 import sys
+try:
+    import lzma
+except ImportError:
+    lzma = None
 import bz2
 import gzip
 from gzip import write32u, FNAME
@@ -51,9 +55,46 @@
             self.fileobj.write(fname + '\000')
 
 
+if lzma:
+    class LzmaFile(lzma.LZMAFile):
+       pass
+else:
+    class LzmaFile:
+        def __init__(self, filename=None, mode=None, options={}):
+            raise ImportError("lzma not found")
+
+class HybridFile:
+    def __init__(self, filename, mode, type='xz'):
+        if filename.endswith(".gz"):
+            filename = filename[:-3]
+        if filename.endswith(".lzma"):
+            filename = filename[:-5]
+        if filename.endswith(".xz"):
+            filename = filename[:-3]
+        if type == 'xz':
+            format = 'xz'
+        else:
+            format = 'alone'
+        self.gz = GzipFile(filename + ".gz", mode)
+        self.lzma = LzmaFile(filename + ".%s" % type, mode,  options={'format':format})
+        return
+
+    def write(self, text):
+        self.gz.write(text)
+        self.lzma.write(text)
+        return
+
+    def close(self):
+        self.gz.close()
+        self.lzma.close()
+        return
+  
 def _gzipOpen(filename, mode="rb", compresslevel=9):
     return GzipFile(filename, mode, compresslevel)
     
+def _lzmaOpen(filename, mode="rb", compresslevel=None):
+    return LzmaFile(filename, mode, options={'level':compresslevel})
+
 def bzipFile(source, dest):
     
     s_fn = open(source, 'rb')
diff -ur createrepo-0.9.8.orig/docs/createrepo.8 createrepo-0.9.8/docs/createrepo.8
--- createrepo-0.9.8.orig/docs/createrepo.8	2009-08-28 18:36:29.000000000 +0200
+++ createrepo-0.9.8/docs/createrepo.8	2010-08-23 10:05:48.000000000 +0200
@@ -66,6 +66,12 @@
 Output version.
 .IP "\fB\-h --help\fP"
 Show help menu.
+.IP "\fB\--lzma\fP"
+Generate lzma-compressed files (.lzma).
+.IP "\fB\--xz\fP"
+Generate xz-compressed files (.xz).
+.IP "\fB\--no-gzip\fP"
+Do not generate gzip-compressed files (.gz).
 
 .IP "\fB\-d --database\fP"
 Generate sqlite databases for use with yum.
diff -ur createrepo-0.9.8.orig/genpkgmetadata.py createrepo-0.9.8/genpkgmetadata.py
--- createrepo-0.9.8.orig/genpkgmetadata.py	2009-08-28 18:36:29.000000000 +0200
+++ createrepo-0.9.8/genpkgmetadata.py	2010-08-23 10:05:48.000000000 +0200
@@ -70,6 +70,12 @@
     #parser.add_option("--database-only", default=False, action="store_true", 
     #  dest='database_only',
     #  help="Only make the sqlite databases - does not work with --update, yet")
+    parser.add_option("--lzma", default=False, action="store_true",
+        help="create lzma-compressed metadata")
+    parser.add_option("--xz", default=False, action="store_true",
+        help="create xz-compressed metadata")
+    parser.add_option("--no-gzip", default=False, dest="nogzip", action="store_true",
+        help="do not create gzip-compressed metadata")
     parser.add_option("--update", default=False, action="store_true",
         help="use the existing repodata to speed up creation of new")
     parser.add_option("--update-md-path", default=None, dest='update_md_path',
