rpms/python-createrepo/EL-5 createrepo-head.patch, NONE, 1.1 import.log, NONE, 1.1 python-createrepo.spec, NONE, 1.1 ten-changelog-limit.patch, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2
Dennis Gilmore
ausil at fedoraproject.org
Fri Feb 20 19:31:17 UTC 2009
Author: ausil
Update of /cvs/pkgs/rpms/python-createrepo/EL-5
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13409/EL-5
Modified Files:
.cvsignore sources
Added Files:
createrepo-head.patch import.log python-createrepo.spec
ten-changelog-limit.patch
Log Message:
initial import of python-createrepo
createrepo-head.patch:
--- NEW FILE createrepo-head.patch ---
diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 744bb67..dcf08b1 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -25,7 +25,7 @@ from bz2 import BZ2File
from urlgrabber import grabber
import tempfile
-from yum import misc, Errors
+from yum import misc, Errors, to_unicode
from yum.sqlutils import executeSQL
from yum.packageSack import MetaSack
from yum.packages import YumAvailablePackage
@@ -44,6 +44,7 @@ except ImportError:
pass
from utils import _gzipOpen, bzipFile, checkAndMakeDir, GzipFile, checksum_and_rename
+import deltarpms
__version__ = '0.9.6'
@@ -52,10 +53,11 @@ class MetaDataConfig(object):
def __init__(self):
self.quiet = False
self.verbose = False
+ self.profile = False
self.excludes = []
self.baseurl = None
self.groupfile = None
- self.sumtype = 'sha'
+ self.sumtype = 'sha256'
self.pretty = False
self.cachedir = None
self.use_cache = False
@@ -63,6 +65,13 @@ class MetaDataConfig(object):
self.checkts = False
self.split = False
self.update = False
+ self.deltas = False # do the deltarpm thing
+ self.deltadir = None # where to put the .drpms - defaults to 'drpms' inside 'repodata'
+ self.delta_relative = 'drpms/'
+ self.oldpackage_paths = [] # where to look for the old packages -
+ self.deltafile = 'prestodelta.xml.gz'
+ self.num_deltas = 1 # number of older versions to delta (max)
+ self.update_md_path = None
self.skip_stat = False
self.database = False
self.outputdir = None
@@ -149,7 +158,6 @@ class MetaDataGenerator:
if not self.conf.outputdir:
self.conf.outputdir = os.path.join(self.conf.basedir, self.conf.relative_dir)
-
def _test_setup_dirs(self):
# start the sanity/stupidity checks
for mydir in self.conf.directories:
@@ -178,13 +186,23 @@ class MetaDataGenerator:
if not checkAndMakeDir(temp_final):
raise MDError, _('Cannot create/verify %s') % temp_final
+ if self.conf.deltas:
+ temp_delta = os.path.join(self.conf.outputdir, self.conf.delta_relative)
+ if not checkAndMakeDir(temp_delta):
+ raise MDError, _('Cannot create/verify %s') % temp_delta
+ self.conf.deltadir = temp_delta
+
if os.path.exists(os.path.join(self.conf.outputdir, self.conf.olddir)):
raise MDError, _('Old data directory exists, please remove: %s') % self.conf.olddir
# make sure we can write to where we want to write to:
# and pickup the mdtimestamps while we're at it
- for direc in ['tempdir', 'finaldir']:
- filepath = os.path.join(self.conf.outputdir, direc)
+ direcs = ['tempdir' , 'finaldir']
+ if self.conf.deltas:
+ direcs.append('deltadir')
+
+ for direc in direcs:
+ filepath = os.path.join(self.conf.outputdir, getattr(self.conf, direc))
if os.path.exists(filepath):
if not os.access(filepath, os.W_OK):
raise MDError, _('error in must be able to write to metadata dir:\n -> %s') % filepath
@@ -300,11 +318,17 @@ class MetaDataGenerator:
'verbose' : self.conf.verbose,
'pkgdir' : os.path.normpath(self.package_dir)
}
+
if self.conf.skip_stat:
opts['do_stat'] = False
+ if self.conf.update_md_path:
+ old_repo_path = os.path.normpath(self.conf.update_md_path)
+ else:
+ old_repo_path = self.conf.outputdir
+
#and scan the old repo
- self.oldData = readMetadata.MetadataIndex(self.conf.outputdir, opts)
+ self.oldData = readMetadata.MetadataIndex(old_repo_path, opts)
def _setup_grabber(self):
if not hasattr(self, '_grabber'):
@@ -340,6 +364,8 @@ class MetaDataGenerator:
self.primaryfile = self._setupPrimary()
self.flfile = self._setupFilelists()
self.otherfile = self._setupOther()
+ if self.conf.deltas:
+ self.deltafile = self._setupDelta()
def _setupPrimary(self):
# setup the primary metadata file
@@ -367,6 +393,14 @@ class MetaDataGenerator:
fo.write('<otherdata xmlns="http://linux.duke.edu/metadata/other" packages="%s">' %
self.pkgcount)
return fo
+
+ def _setupDelta(self):
+ # setup the other file
+ deltafilepath = os.path.join(self.conf.outputdir, self.conf.tempdir, self.conf.deltafile)
+ fo = _gzipOpen(deltafilepath, 'w')
+ fo.write('<?xml version="1.0" encoding="UTF-8"?>\n')
+ fo.write('<prestodelta>\n')
+ return fo
def read_in_package(self, rpmfile, pkgpath=None, reldir=None):
@@ -444,7 +478,8 @@ class MetaDataGenerator:
nodes = self.oldData.getNodes(old_pkg)
if nodes is not None:
recycled = True
-
+
+ # FIXME also open up the delta file
# otherwise do it individually
if not recycled:
@@ -462,6 +497,9 @@ class MetaDataGenerator:
# need to say something here
self.callback.errorlog("\nError %s: %s\n" % (pkg, e))
continue
+ # we can use deltas:
+ self._do_delta_rpm_package(po)
+
else:
po = pkg
@@ -492,6 +530,9 @@ class MetaDataGenerator:
outfile.write('\n')
self.oldData.freeNodes(pkg)
+ #FIXME - if we're in update and we have deltas enabled
+ # check the presto data for this pkg and write its info back out
+ # to our deltafile
if not self.conf.quiet:
if self.conf.verbose:
@@ -532,6 +573,94 @@ class MetaDataGenerator:
self.otherfile.write('\n</otherdata>')
self.otherfile.close()
+ if self.conf.deltas:
+ if not self.conf.quiet:
+ self.callback.log(_('Saving delta metadata'))
+ self.deltafile.write(self.generate_delta_xml())
+ self.deltafile.write('\n</prestodelta>')
+ self.deltafile.close()
+
+ def _do_delta_rpm_package(self, pkg):
+ """makes the drpms, if possible, for this package object.
+ returns the presto/delta xml metadata as a string
+ """
+
+ # generate a list of all the potential 'old rpms'
+ opd = self._get_old_package_dict() # yes I could make this a property but <shrug>
+
+ # for each of our old_package_paths - make a drpm from the newest of that pkg
+ # get list of potential candidates which are likely to match
+ for d in self.conf.oldpackage_paths:
+ pot_cand = []
+ for fn in opd[d]:
+ if os.path.basename(fn).startswith(pkg.name):
+ pot_cand.append(fn)
+
+ candidates = []
+ for fn in pot_cand:
+ try:
+ thispo = yumbased.CreateRepoPackage(self.ts, fn)
+ except Errors.MiscError, e:
+ continue
+ if (thispo.name, thispo.arch) != (pkg.name, pkg.arch):
+ # not the same, doesn't matter
+ continue
+ if thispo == pkg: #exactly the same, doesn't matter
+ continue
+ if thispo.EVR >= pkg.EVR: # greater or equal, doesn't matter
+ continue
+ candidates.append(thispo)
+ candidates.sort()
+ candidates.reverse()
+
+ for delta_p in candidates[0:self.conf.num_deltas]:
+ #make drpm of pkg and delta_p
+ drpmfn = deltarpms.create_drpm(delta_p, pkg, self.conf.deltadir)
+ self.callback.log('created drpm from %s to %s: %s' % (
+ delta_p, pkg, drpmfn))
+
+ def _get_old_package_dict(self):
+ if hasattr(self, '_old_package_dict'):
+ return self._old_package_dict
+
+ self._old_package_dict = {}
+ opl = []
+ for d in self.conf.oldpackage_paths:
+ for f in self.getFileList(d, 'rpm'):
+ if not self._old_package_dict.has_key(d):
+ self._old_package_dict[d] = []
+ self._old_package_dict[d].append(d + '/' + f)
+
+ return self._old_package_dict
+
+ def generate_delta_xml(self):
+ """take the delta rpm output dir, process all the drpm files
+ produce the text output for the presto/delta xml metadata"""
+ # go through the drpm dir
+ # for each file -store the drpm info in a dict based on its target. Just
+ # appending the output. for each of the keys in the dict, return
+ # the tag for the target + each of the drpm infos + closure for the target
+ # tag
+ targets = {}
+ result = u''
+ for drpm_fn in self.getFileList(self.conf.deltadir, 'drpm'):
+ drpm_rel_fn = os.path.normpath(self.conf.delta_relative + '/' + drpm_fn) # this is annoying
+ drpm_po = yumbased.CreateRepoPackage(self.ts, self.conf.deltadir + '/' + drpm_fn)
+
+ drpm = deltarpms.DeltaRPMPackage(drpm_po, self.conf.outputdir, drpm_rel_fn)
+ if not targets.has_key(drpm_po.pkgtup):
+ targets[drpm_po.pkgtup] = u''
+ targets[drpm_po.pkgtup] += drpm.xml_dump_metadata()
+
+ for (n,e,v,r,a) in targets.keys():
+ result += """ <newpackage name="%s" epoch="%s" version="%s" release="%s" arch="%s"\n""" % (
+ n,e,v,r,a)
+ for src in targets[(n,e,v,r,a)]:
+ result += src
+ result += """ </newpackage>\n"""
+
+ return result
+
def addArbitraryMetadata(self, mdfile, mdtype, xml_node, compress=True,
compress_type='gzip', attribs={}):
"""add random metadata to the repodata dir and repomd.xml
@@ -630,6 +759,8 @@ class MetaDataGenerator:
db_workfiles = []
repoid='garbageid'
+ if self.conf.deltas:
+ workfiles.append((self.conf.deltafile, 'deltainfo'))
if self.conf.database:
if not self.conf.quiet: self.callback.log('Generating sqlite DBs')
try:
diff --git a/createrepo/deltarpms.py b/createrepo/deltarpms.py
new file mode 100644
index 0000000..f201ab7
--- /dev/null
+++ b/createrepo/deltarpms.py
@@ -0,0 +1,144 @@
+#!/usr/bin/python -tt
+# util functions for deltarpms
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# copyright 2009 - Red Hat
+
+import os.path
+import commands
+from yum import misc
+import gzip
+import yumbased
+from utils import _, errorprint, MDError
+
+class DeltaRPMPackage:
+ """each drpm is one object, you pass it a drpm file
+ it opens the file, and pulls the information out in bite-sized chunks :)
+ """
+
+ mode_cache = {}
+
+ def __init__(self, po, basedir, filename):
+ try:
+ stats = os.stat(os.path.join(basedir, filename))
+ self.size = stats[6]
+ self.mtime = stats[8]
+ del stats
+ except OSError, e:
+ raise MDError, "Error Stat'ing file %s%s" % (basedir, filename)
+ self.csum_type = 'sha256'
+ self.relativepath = filename
+ self.po = po
+
+ fd = os.open(self.po.localpath, os.O_RDONLY)
+ os.lseek(fd, 0, 0)
+ fo = os.fdopen(fd, 'rb')
+ self.csum = misc.checksum(self.csum_type, fo)
+ fo.seek(int(self.po.hdrend))
+ self._getOldInfo(fo)
+ del fo
+ del fd
+
+ def _stringToNEVR(self, string):
+ i = string.rfind("-", 0, string.rfind("-")-1)
+ name = string[:i]
+ (epoch, ver, rel) = self._stringToVersion(string[i+1:])
+ return (name, epoch, ver, rel)
+
+ def _getLength(self, in_data):
+ length = 0
+ for val in in_data:
+ length = length * 256
+ length += ord(val)
+ return length
+
+ def _getOldInfo(self, fo):
+ try:
+ compobj = gzip.GzipFile("", "rb", 9, fo)
+ except:
+ raise zlibError("Data not stored in gzip format")
+
+ if compobj.read(4)[:3] != "DLT":
+ raise Exception("Not a deltarpm")
+
+ nevr_length = self._getLength(compobj.read(4))
+ nevr = compobj.read(nevr_length).strip("\x00")
+ seq_length = self._getLength(compobj.read(4))
+ seq = compobj.read(seq_length)
+ hex_seq = ""
+ for char in seq:
+ hex_seq += str("%02x" % ord(char))
+ self.oldnevrstring = nevr
+ self.oldnevr = self._stringToNEVR(nevr)
+ self.sequence = hex_seq
+ compobj.close()
+
+ def _stringToVersion(self, strng):
+ i = strng.find(':')
+ if i != -1:
+ epoch = strng[:i]
+ else:
+ epoch = '0'
+ j = strng.find('-')
+ if j != -1:
+ if strng[i + 1:j] == '':
+ version = None
+ else:
+ version = strng[i + 1:j]
+ release = strng[j + 1:]
+ else:
+ if strng[i + 1:] == '':
+ version = None
+ else:
+ version = strng[i + 1:]
+ release = None
+ return (epoch, version, release)
+
+ def xml_dump_metadata(self):
+ """takes an xml doc object and a package metadata entry node, populates a
+ package node with the md information"""
+
+ (oldname, oldepoch, oldver, oldrel) = self.oldnevr
+ sequence = "%s-%s" % (self.oldnevrstring, self.sequence)
+
+ delta_tag = """ <delta oldepoch="%s" oldversion="%s" oldrelease="%s">
+ <filename>%s</filename>
+ <sequence>%s</sequence>
+ <size>%s</size>
+ <checksum type="%s">%s</checksum>
+ </delta>\n""" % (oldepoch, oldver, oldrel, self.relativepath, sequence,
+ self.size, self.csum_type, self.csum)
+ return delta_tag
+
+def create_drpm(old_pkg, new_pkg, destdir):
+ """make a drpm file, if possible. returns None if nothing could
+ be created"""
+ drpmfn = '%s-%s-%s_%s-%s.%s.drpm' % (old_pkg.name, old_pkg.ver,
+ old_pkg.release, new_pkg.ver, new_pkg.release,
+ old_pkg.arch)
+ delta_rpm_path = os.path.join(destdir, drpmfn)
+ delta_command = '/usr/bin/makedeltarpm %s %s %s' % (old_pkg.localpath,
+ new_pkg.localpath,
+ delta_rpm_path)
+ if not os.path.exists(delta_rpm_path):
+ #TODO - check/verify the existing one a bit?
+ (code, out) = commands.getstatusoutput(delta_command)
+ if code:
+ print "Error genDeltaRPM for %s: exitcode was %s - Reported Error: %s" % (old_pkg.name, code, out)
+ return None
+
+ return delta_rpm_path
+
+
+
diff --git a/createrepo/merge.py b/createrepo/merge.py
index d096c61..d4b8359 100644
--- a/createrepo/merge.py
+++ b/createrepo/merge.py
@@ -34,14 +34,24 @@ import tempfile
# excludes?
-class RepoMergeBase():
- def __init__(self, repolist=[]):
+class RepoMergeBase:
+ def __init__(self, repolist=[], yumbase=None, mdconf=None, mdbase_class=None ):
self.repolist = repolist
self.outputdir = '%s/merged_repo' % os.getcwd()
self.exclude_tuples = []
self.sort_func = self._sort_func # callback function to magically sort pkgs
- self.mdconf = createrepo.MetaDataConfig()
- self.yumbase = yum.YumBase()
+ if not mdconf:
+ self.mdconf = createrepo.MetaDataConfig()
+ else:
+ self.mdconf = mdconf
+ if not mdbase_class:
+ self.mdbase_class = createrepo.MetaDataGenerator
+ else:
+ self.mdbase_class = mdbase_class
+ if not yumbase:
+ self.yumbase = yum.YumBase()
+ else:
+ self.yumbase = yumbase
self.yumbase.conf.cachedir = getCacheDir()
self.yumbase.conf.cache = 0
# default to all arches
@@ -121,7 +131,7 @@ class RepoMergeBase():
if not os.path.exists(self.mdconf.directory):
os.makedirs(self.mdconf.directory)
- mdgen = createrepo.MetaDataGenerator(config_obj=self.mdconf)
+ mdgen = self.mdbase_class(config_obj=self.mdconf)
mdgen.doPkgMetadata()
mdgen.doRepoMetadata()
mdgen.doFinalMove()
diff --git a/createrepo/utils.py b/createrepo/utils.py
index 1b0d015..3f6414b 100644
--- a/createrepo/utils.py
+++ b/createrepo/utils.py
@@ -36,7 +36,10 @@ class GzipFile(gzip.GzipFile):
def _write_gzip_header(self):
self.fileobj.write('\037\213') # magic header
self.fileobj.write('\010') # compression method
- fname = self.filename[:-3]
+ if hasattr(self, 'name'):
+ fname = self.name[:-3]
+ else:
+ fname = self.filename[:-3]
flags = 0
if fname:
flags = FNAME
@@ -100,7 +103,7 @@ def checkAndMakeDir(dir):
def checksum_and_rename(fn_path):
"""checksum the file rename the file to contain the checksum as a prefix
return the new filename"""
- csum = misc.checksum('sha', fn_path)
+ csum = misc.checksum('sha256', fn_path)
fn = os.path.basename(fn_path)
fndir = os.path.dirname(fn_path)
csum_fn = csum + '-' + fn
diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index 60568e3..b820fd8 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -19,7 +19,6 @@ import os
import rpm
import types
import re
-import md5
from yum.packages import YumLocalPackage
from yum.Errors import *
@@ -49,6 +48,7 @@ class CreateRepoPackage(YumLocalPackage):
# not using the cachedir
if not self._cachedir:
self._checksum = misc.checksum(self.checksum_type, self.localpath)
+ self._checksums = [(self.checksum_type, self._checksum, 1)]
return self._checksum
@@ -60,7 +60,9 @@ class CreateRepoPackage(YumLocalPackage):
if type(self.hdr[rpm.RPMTAG_HDRID]) is not types.NoneType:
t.append("".join(self.hdr[rpm.RPMTAG_HDRID]))
- key = md5.new("".join(t)).hexdigest()
+ kcsum = misc.Checksums()
+ kcsum.update("".join(t))
+ key = kcsum.hexdigest()
csumtag = '%s-%s-%s-%s' % (os.path.basename(self.localpath),
key, self.size, self.filetime)
@@ -72,12 +74,12 @@ class CreateRepoPackage(YumLocalPackage):
csumo.close()
else:
- checksum = misc.checksum('sha', self.localpath)
+ checksum = misc.checksum(self.checksum_type, self.localpath)
# This is atomic cache creation via. rename, so we can have two
# tasks using the same cachedir ... mash does this.
try:
- (csumo, tmpfilename) = tempfile.mkstemp(dir=self.crp_cachedir)
+ (csumo, tmpfilename) = tempfile.mkstemp(dir=self._cachedir)
csumo = os.fdopen(csumo, 'w', -1)
csumo.write(checksum)
csumo.close()
@@ -86,6 +88,7 @@ class CreateRepoPackage(YumLocalPackage):
pass
self._checksum = checksum
+ self._checksums = [(self.checksum_type, checksum, 1)]
return self._checksum
diff --git a/docs/createrepo.8 b/docs/createrepo.8
index 1a31190..e7cce4f 100644
--- a/docs/createrepo.8
+++ b/docs/createrepo.8
@@ -69,6 +69,11 @@ Show help menu.
Generate sqlite databases for use with yum.
.IP "\fB\-S --skip-symlinks\fP"
Ignore symlinks of packages
+.IP "\fB\-s --checksum\fP"
+Choose the checksum type used in repomd.xml and for packages in the metadata.
+The default is now sha256, the older default was sha which is actually sha1.
+.IP "\fB\-profile\fP"
+Output time based profiling information.
.IP "\fB\--changelog-limit\fP CHANGELOG_LIMIT"
Only import the last N changelog entries, from each rpm, into the metadata
.IP "\fB\--unique-md-filenames\fP"
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index 77b4095..041bc02 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -41,6 +41,8 @@ def parseArgs(args, conf):
help="output nothing except for serious errors")
parser.add_option("-v", "--verbose", default=False, action="store_true",
help="output more debugging info.")
+ parser.add_option("--profile", default=False, action="store_true",
+ help="output timing/profile info.")
parser.add_option("-x", "--excludes", default=[], action="append",
help="files to exclude")
parser.add_option("--basedir", default=os.getcwd(),
@@ -49,7 +51,7 @@ def parseArgs(args, conf):
help="baseurl to append on all files")
parser.add_option("-g", "--groupfile", default=None,
help="path to groupfile to include in metadata")
- parser.add_option("-s", "--checksum", default="sha", dest='sumtype',
+ parser.add_option("-s", "--checksum", default="sha256", dest='sumtype',
help="Deprecated, ignore")
parser.add_option("-p", "--pretty", default=False, action="store_true",
help="make sure all xml generated is formatted")
@@ -64,6 +66,8 @@ def parseArgs(args, conf):
# help="Only make the sqlite databases - does not work with --update, yet")
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',
+ help="use the existing repodata for --update from this path")
parser.add_option("--skip-stat", dest='skip_stat', default=False, action="store_true",
help="skip the stat() call on a --update, assumes if the file" \
"name is the same then the file is still the same" \
@@ -89,6 +93,13 @@ def parseArgs(args, conf):
help="tags for the content in the repository")
parser.add_option("--revision", default=None,
help="user-specified revision for this repository")
+ parser.add_option("--deltas", default=False, action="store_true",
+ help="create delta rpms and metadata")
+ parser.add_option("--oldpackagedirs", default=[], dest="oldpackage_paths",
+ action="append", help="paths to look for older pkgs to delta against")
+ parser.add_option("--num-deltas", default=1, dest='num_deltas', type='int',
+ help="the number of older versions to make deltas against")
+
(opts, argsleft) = parser.parse_args(args)
if len(argsleft) > 1 and not opts.split:
@@ -164,7 +175,7 @@ def main(args):
start_st = time.time()
conf = createrepo.MetaDataConfig()
conf = parseArgs(args, conf)
- if conf.verbose:
+ if conf.profile:
print ('start time: %0.3f' % (time.time() - start_st))
mid_st = time.time()
@@ -178,20 +189,20 @@ def main(args):
print _('repo is up to date')
sys.exit(0)
- if conf.verbose:
+ if conf.profile:
print ('mid time: %0.3f' % (time.time() - mid_st))
pm_st = time.time()
mdgen.doPkgMetadata()
- if conf.verbose:
+ if conf.profile:
print ('pm time: %0.3f' % (time.time() - pm_st))
rm_st = time.time()
mdgen.doRepoMetadata()
- if conf.verbose:
+ if conf.profile:
print ('rm time: %0.3f' % (time.time() - rm_st))
fm_st = time.time()
mdgen.doFinalMove()
- if conf.verbose:
+ if conf.profile:
print ('fm time: %0.3f' % (time.time() - fm_st))
diff --git a/modifyrepo.py b/modifyrepo.py
index 632d824..1efe966 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -35,6 +35,7 @@ class RepoMetadata:
""" Parses the repomd.xml file existing in the given repo directory. """
self.repodir = os.path.abspath(repo)
self.repomdxml = os.path.join(self.repodir, 'repomd.xml')
+ self.checksum_type = 'sha256'
if not os.path.exists(self.repomdxml):
raise Exception('%s not found' % self.repomdxml)
self.doc = minidom.parse(self.repomdxml)
@@ -84,7 +85,7 @@ class RepoMetadata:
newmd.close()
print "Wrote:", destmd
- open_csum = checksum('sha', metadata)
+ open_csum = checksum(self.checksum_type, metadata)
csum, destmd = checksum_and_rename(destmd)
@@ -105,13 +106,13 @@ class RepoMetadata:
self._insert_element(data, 'location',
attrs={ 'href' : 'repodata/' + base_destmd })
data.appendChild(self.doc.createTextNode("\n "))
- self._insert_element(data, 'checksum', attrs={ 'type' : 'sha' },
+ self._insert_element(data, 'checksum', attrs={ 'type' : self.checksum_type },
text=csum)
data.appendChild(self.doc.createTextNode("\n "))
self._insert_element(data, 'timestamp',
text=str(os.stat(destmd).st_mtime))
data.appendChild(self.doc.createTextNode("\n "))
- self._insert_element(data, 'open-checksum', attrs={ 'type' : 'sha' },
+ self._insert_element(data, 'open-checksum', attrs={ 'type' : self.checksum_type },
text=open_csum)
data.appendChild(self.doc.createTextNode("\n "))
--- NEW FILE import.log ---
python-createrepo-0_9_6-1_el5:EL-5:python-createrepo-0.9.6-1.el5.src.rpm:1235158212
--- NEW FILE python-createrepo.spec ---
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Summary: Python module to create common metadata repositorys
Name: python-createrepo
Version: 0.9.6
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Base
Source: createrepo-%{version}.tar.gz
Patch0: ten-changelog-limit.patch
Patch1: createrepo-head.patch
URL: http://createrepo.baseurl.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: python >= 2.1, rpm-python, rpm >= 4.1.1, libxml2-python
Requires: yum-metadata-parser, yum >= 3.2.19
BuildRequires: python
%description
A python module that will generate a common metadata repository from
a directory of rpm packages.
%prep
%setup -q -n createrepo-%{version}
%patch0 -p0
%patch1 -p1
%build
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
rm -rf $RPM_BUILD_ROOT/%{_datadir}/createrepo/
rm -rf $RPM_BUILD_ROOT/%{_bindir}/createrepo
rm -rf $RPM_BUILD_ROOT/%{_bindir}/modifyrepo
rm -rf $RPM_BUILD_ROOT/%{_bindir}/mergerepo
rm -rf $RPM_BUILD_ROOT/%{_mandir}/*/*
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root,-)
%doc ChangeLog README COPYING
%{python_sitelib}/createrepo
%changelog
* Fri Feb 13 2009 Dennis Gilmore <dennis at ausil.us> - 0.9.6-1
- rename to python-createrepo and package as a python module only.
- for koji to run on EL-5
* Tue Feb 10 2009 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-11
- change the order of deltarpms
* Wed Feb 4 2009 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-10
- working mergerepo again
* Tue Feb 3 2009 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-9
- fix normal createrepo'ing w/o the presto patches :(
* Mon Feb 2 2009 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-7
- add deltarpm requirement for making presto metadata
* Tue Jan 27 2009 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-6
- one more patch set to make sure modifyrepo works with sha256's, too
* Mon Jan 26 2009 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-5
- add patch from upstream head for sha256 support
* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm at gmail.com> - 0.9.6-4
- Rebuild for Python 2.6
* Tue Oct 28 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.6-1
- 0.9.6-1
- add mergerepo
* Thu Oct 9 2008 James Antill <james at fedoraproject.org> - 0.9.5-5
- Do atomic updates to the cachedir, for parallel runs
- Fix the patch
* Fri Feb 22 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.5-2
- patch for the mistake in the raise for an empty pkgid
* Tue Feb 19 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.5-1
- 0.9.5
- ten-changelog-limit patch by default in fedora
* Thu Jan 31 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.4-3
- skip if no old metadata and --update was called.
* Wed Jan 30 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.4-1
- 0.9.4
* Tue Jan 22 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.3
- 0.9.3
* Thu Jan 17 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.2-1
- remove all other patches - 0.9.2
* Tue Jan 15 2008 Seth Vidal <skvidal at fedoraproject.org> 0.9.1-3
- more patches - almost 0.9.2 but not quite
* Thu Jan 10 2008 Seth Vidal <skvidal at fedoraproject.org> 0.9.1-2
- patch to fix bug until 0.9.2
* Wed Jan 9 2008 Seth Vidal <skvidal at fedoraproject.org> 0.9.1-1
- 0.9.1
* Mon Jan 7 2008 Seth Vidal <skvidal at fedoraproject.org> 0.9-1
- 0.9
- add yum dep
* Mon Nov 26 2007 Luke Macken <lmacken at redhat.com> - 0.4.11-1
- Update to 0.4.11
- Include COPYING file and change License to GPLv2
* Thu Jun 07 2007 Paul Nasrat <pnasrat at redhat.com> - 0.4.10-1
- Update to 0.4.10
* Wed May 16 2007 Paul Nasrat <pnasrat at redhat.com> - 0.4.9-1
- Update to 0.4.9
* Tue May 15 2007 Jeremy Katz <katzj at redhat.com> - 0.4.8-4
- fix the last patch
* Tue May 15 2007 Jeremy Katz <katzj at redhat.com> - 0.4.8-3
- use dbversion given by yum-metadata-parser instead of hardcoded
value (#239938)
* Wed Mar 14 2007 Paul Nasrat <pnasrat at redhat.com> - 0.4.8-2
- Remove requires (#227680)
* Wed Feb 21 2007 Jeremy Katz <katzj at redhat.com> - 0.4.8-1
- update to 0.4.8
* Mon Feb 12 2007 Jesse Keating <jkeating at redhat.com> - 0.4.7-3
- Require yum-metadata-parser.
* Thu Feb 8 2007 Jeremy Katz <katzj at redhat.com> - 0.4.7-2
- add modifyrepo to the file list
* Thu Feb 8 2007 Jeremy Katz <katzj at redhat.com> - 0.4.7-1
- update to 0.4.7
* Mon Feb 05 2007 Paul Nasrat <pnasrat at redhat.com> - 0.4.6-2
- Packaging guidelines (#225661)
* Thu Nov 09 2006 Paul Nasrat <pnasrat at redhat.com> - 0.4.6-1
- Upgrade to latest release
- Fix requires (#214388)
* Wed Jul 19 2006 Paul Nasrat <pnasrat at redhat.com> - 0.4.4-2
- Fixup relative paths (#199228)
* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 0.4.4-1.1
- rebuild
* Mon Apr 17 2006 Paul Nasrat <pnasrat at redhat.com> - 0.4.4-1
- Update to latest upstream
* Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
- rebuilt
* Fri Nov 18 2005 Paul Nasrat <pnasrat at redhat.com> - 0.4.3-5
- Fix split with normalised directories
* Fri Nov 18 2005 Paul Nasrat <pnasrat at redhat.com> - 0.4.3-4
- Another typo fix
- Normalise directories
* Thu Nov 17 2005 Paul Nasrat <pnasrat at redhat.com> - 0.4.3-3.1
- really fix them
* Thu Nov 17 2005 Paul Nasrat <pnasrat at redhat.com> - 0.4.3-3
- Fix regressions for absolute/relative paths
* Sun Nov 13 2005 Paul Nasrat <pnasrat at redhat.com> - 0.4.3-2
- Sync upto HEAD
- Split media support
* Thu Jul 14 2005 Paul Nasrat <pnasrat at redhat.com> - 0.4.3-1
- New upstream version 0.4.3 (cachedir support)
* Tue Jan 18 2005 Jeremy Katz <katzj at redhat.com> - 0.4.2-2
- add the manpage
* Tue Jan 18 2005 Jeremy Katz <katzj at redhat.com> - 0.4.2-1
- 0.4.2
* Thu Oct 21 2004 Paul Nasrat <pnasrat at redhat.com>
- 0.4.1, fixes #136613
- matched ghosts not being added into primary.xml files
* Mon Oct 18 2004 Bill Nottingham <notting at redhat.com>
- 0.4.0, fixes #134776
* Thu Sep 30 2004 Paul Nasrat <pnasrat at redhat.com>
- Rebuild new upstream release - 0.3.9
* Thu Sep 30 2004 Seth Vidal <skvidal at phy.duke.edu>
- 0.3.9
- fix for groups checksum creation
* Sat Sep 11 2004 Seth Vidal <skvidal at phy.duke.edu>
- 0.3.8
* Wed Sep 1 2004 Seth Vidal <skvidal at phy.duke.edu>
- 0.3.7
* Fri Jul 23 2004 Seth Vidal <skvidal at phy.duke.edu>
- make filelists right <sigh>
* Fri Jul 23 2004 Seth Vidal <skvidal at phy.duke.edu>
- fix for broken filelists
* Mon Jul 19 2004 Seth Vidal <skvidal at phy.duke.edu>
- re-enable groups
- update num to 0.3.4
* Tue Jun 8 2004 Seth Vidal <skvidal at phy.duke.edu>
- update to the format
- versioned deps
- package counts
- uncompressed checksum in repomd.xml
* Fri Apr 16 2004 Seth Vidal <skvidal at phy.duke.edu>
- 0.3.2 - small addition of -p flag
* Sun Jan 18 2004 Seth Vidal <skvidal at phy.duke.edu>
- I'm an idiot
* Sun Jan 18 2004 Seth Vidal <skvidal at phy.duke.edu>
- 0.3
* Tue Jan 13 2004 Seth Vidal <skvidal at phy.duke.edu>
- 0.2 -
* Sat Jan 10 2004 Seth Vidal <skvidal at phy.duke.edu>
- first packaging
ten-changelog-limit.patch:
--- NEW FILE ten-changelog-limit.patch ---
--- createrepo/__init__.py~ 2008-10-28 17:19:58.000000000 -0400
+++ createrepo/__init__.py 2008-10-28 17:19:58.000000000 -0400
@@ -81,7 +81,7 @@
self.mdtimestamp = 0
self.directory = None
self.directories = []
- self.changelog_limit = None # needs to be an int or None
+ self.changelog_limit = 10 # needs to be an int or None
self.unique_md_filenames = False
self.additional_metadata = {} # dict of 'type':'filename'
self.revision = str(int(time.time()))
Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/python-createrepo/EL-5/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 20 Feb 2009 19:27:04 -0000 1.1
+++ .cvsignore 20 Feb 2009 19:30:47 -0000 1.2
@@ -0,0 +1 @@
+createrepo-0.9.6.tar.gz
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/python-createrepo/EL-5/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 20 Feb 2009 19:27:04 -0000 1.1
+++ sources 20 Feb 2009 19:30:47 -0000 1.2
@@ -0,0 +1 @@
+d8b11b3b38205fe351497c7e10ae5500 createrepo-0.9.6.tar.gz
More information about the scm-commits
mailing list