Re: CVS access problem
Hans-Peter Jansen <[email protected]>
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <[email protected]> |
Am Freitag, 21. Juli 2006 19:37 schrieb Paul Nasrat: > On Thu, 2006-07-20 at 13:57 +0200, Hans-Peter Jansen wrote: > > e. > > > > Ahh, I see. > > > > Do you already have an opinion on the check timestamps patch, sent > > yesterday evening (CEST)? > > Yeah, I've made a whole bunch of changes before I got to it - can you > possibly rediff against HEAD please. Done, attached. Took a bit longer, since one of your changes made createrepo fail to locate any files in the normal case (without --split option at least), because you reference the wrong var [directory instead of dirname] in extension_visitor(). While at it, I made the extension test a bit more eye friendly (IMHO). You may want to apply this fix immediately. > Note I've started adding unittests, not too many right now - > additions welcome. At the moment just Cool, my "unit test" is currently that: installing the beast and check, if the whole thing explodes ;-). > cd test and run each of the test .py's. I'll hook it up a bit better > over time. Pete _______________________________________________ Rpm-metadata mailing list [email protected] https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
createrepo-checktsoption-take4.diff
(text/x-diff, 5.2 KB)
--- genpkgmetadata.py.new 2006-07-21 21:04:28.933587923 +0200
+++ genpkgmetadata.py 2006-07-21 21:08:08.208789617 +0200
@@ -56,6 +56,8 @@ def usage(retval=1):
(<filename> relative to directory-of-packages)
-v, --verbose = run verbosely
-c, --cachedir <dir> = specify which dir to use for the checksum cache
+ -C, --checkts = don't generate repo metadata, if their ctimes are newer
+ than the rpm ctimes.
-h, --help = show this help
-V, --version = output version
-p, --pretty = output xml files in pretty format.
@@ -88,6 +90,17 @@ class MetaDataGenerator:
os.path.walk(startdir, extension_visitor, rpmlist)
return rpmlist
+ def checkTimeStamps(self, directory):
+ if self.cmds['checkts']:
+ files = self.getFileList(self.cmds['basedir'], directory, '.rpm')
+ files = self.trimRpms(files)
+ for f in files:
+ fn = os.path.join(self.cmds['basedir'], directory, f)
+ if not os.path.exists(fn):
+ errorprint(_('cannot get to file: %s') % fn)
+ if os.path.getctime(fn) > self.cmds['mdtimestamp']:
+ return False
+ return True
def trimRpms(self, files):
badrpms = []
@@ -358,17 +371,19 @@ def parseArgs(args):
cmds['cachedir'] = None
cmds['basedir'] = os.getcwd()
cmds['cache'] = False
+ cmds['checkts'] = False
+ cmds['mdtimestamp'] = 0
cmds['split'] = False
cmds['outputdir'] = ""
cmds['file-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$']
cmds['dir-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*']
try:
- gopts, argsleft = getopt.getopt(args, 'phqVvng:s:x:u:c:o:', ['help', 'exclude=',
+ gopts, argsleft = getopt.getopt(args, 'phqVvng:s:x:u:c:o:C', ['help', 'exclude=',
'quiet', 'verbose', 'cachedir=', 'basedir=',
'baseurl=', 'groupfile=', 'checksum=',
'version', 'pretty', 'split', 'outputdir=',
- 'noepoch'])
+ 'noepoch', 'checkts'])
except getopt.error, e:
errorprint(_('Options Error: %s.') % e)
usage()
@@ -426,6 +441,8 @@ def parseArgs(args):
elif arg in ['-c', '--cachedir']:
cmds['cache'] = True
cmds['cachedir'] = a
+ elif arg in ['-C', '--checkts']:
+ cmds['checkts'] = True
elif arg == '--basedir':
cmds['basedir'] = a
elif arg in ['-o','--outputdir']:
@@ -437,6 +454,10 @@ def parseArgs(args):
errorprint(_('Options Error: %s') % e)
usage()
+ if cmds['split'] and cmds['checkts']:
+ errorprint(_('--split and --checkts options are mutually exclusive'))
+ sys.exit(1)
+
directory = directories[0]
#
directory = os.path.normpath(directory)
@@ -520,13 +541,21 @@ def main(args):
if not os.access(filepath, os.W_OK):
errorprint(_('error in must be able to write to metadata files:\n -> %s') % filepath)
usage()
-
+ if cmds['checkts']:
+ ts = os.path.getctime(filepath)
+ if ts > cmds['mdtimestamp']:
+ cmds['mdtimestamp'] = ts
+
if cmds['split']:
cmds['basedir'] = oldbase
mdgen = SplitMetaDataGenerator(cmds)
mdgen.doPkgMetadata(directories)
else:
mdgen = MetaDataGenerator(cmds)
+ if cmds['checkts'] and mdgen.checkTimeStamps(directory):
+ if cmds['verbose']:
+ print _('repo is up to date')
+ sys.exit(0)
mdgen.doPkgMetadata(directory)
mdgen.doRepoMetadata()
--- ChangeLog.orig 2006-07-19 21:12:39.546793958 +0200
+++ ChangeLog 2006-07-19 21:29:48.365194764 +0200
@@ -1,3 +1,10 @@
+2006-07-19 21:03 [email protected]
+
+ * genpkgmetadata.py, docs/createrepo.8:
+ -C, --checkts option added to avoid metadata generation, if ctime
+ filestamps are up to date. It's currently mutually exclusive with
+ the --split option.
+
2006-06-15 11:39 lmacken
* ChangeLog, genpkgmetadata.py, docs/createrepo.8: 2006-06-15 11:40
--- docs/createrepo.8.orig 2006-07-19 21:12:54.095275300 +0200
+++ docs/createrepo.8 2006-07-19 21:29:45.396300173 +0200
@@ -32,6 +32,12 @@ cache of checksums of packages in the re
createrepo over the same repository of files that do not have a complete
change out of all packages this decreases the processing time dramatically.
.br
+.IP "\fB\-C --checkts\fP"
+Don't generate repo metadata, if their timestamps are newer than its rpms.
+This option decreases the processing time drastically again, if you happen
+to run it on an unmodified repo, but it is (currently) mutual exclusive
+with the --split option.
+.br
.IP "\fB\--split\fP"
Run in split media mode. Rather than pass a single directory, take a set of
directories corresponding to different volumes in a media set.
createrepo-cvs20060721-fix.diff
(text/x-diff, 577 B)
--- genpkgmetadata.py.orig 2006-07-21 21:38:35.103859011 +0200
+++ genpkgmetadata.py 2006-07-21 21:43:05.002247480 +0200
@@ -80,8 +80,8 @@ class MetaDataGenerator:
for fn in names:
if os.path.isdir(fn):
continue
- elif string.lower(fn[-extlen:]) == '%s' % (ext):
- arg.append(os.path.join(directory,fn))
+ elif fn[-extlen:].lower() == ext:
+ arg.append(os.path.join(dirname,fn))
rpmlist = []
startdir = os.path.join(basepath, directory)