Re: replacing os.chdir calls with basedir config option
Paul Nasrat <[email protected]>
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Organization | Red Hat, Inc. |
| Message-ID | <[email protected]> |
On Fri, 2005-11-11 at 13:33 -0500, Dennis Gregorovic wrote: > On Fri, 2005-11-11 at 13:17 -0500, Paul Nasrat wrote: > > On Fri, 2005-11-11 at 08:44 -0500, Dennis Gregorovic wrote: > > > I've started using createrepo as a library instead of a standalone app. > > > The only issue that I've run into so far is that the os.chdir() calls > > > can cause problems, especially if you have multiple threads using > > > createrepo in parallel. > > > > > > Attached is a patch that removes the os.chdir() calls and introduces a > > > 'basedir' config option, settable with --basedir and defaulting to > > > os.getcwd(). > Hopefully this patch is better. I have emacs set up to automatically > remove tabs and trailing whitespace, so I normally diff -w, but that may > have screwed up the first patch. Patch is much better thanks, however I've noticed you've changed behaviour slightly. tmp/myrepo/Fedora/RPMS/... tmp/rpm/foo.rpm (#broken package) If I'm in tmp/ python ~/scm/duke/metadata/generate/genpkgmetadata.py myrepo fails when parsing the broken package, where as createrepo correctly succeeds. Fix below. Paul _______________________________________________ Rpm-metadata mailing list [email protected] https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
createrepo-basedir-fix.patch
(text/x-patch, 844 B)
diff -u genpkgmetadata.py genpkgmetadata.py
--- genpkgmetadata.py 11 Nov 2005 18:30:05 -0000
+++ genpkgmetadata.py 11 Nov 2005 19:48:33 -0000
@@ -225,12 +225,12 @@
return cmds, directory
-def doPkgMetadata(cmds, ts):
+def doPkgMetadata(directory, cmds, ts):
"""all the heavy lifting for the package metadata"""
# rpms we're going to be dealing with
files = []
- files = getFileList(cmds['basedir'], ".", '.rpm', files)
+ files = getFileList(cmds['basedir'], directory, '.rpm', files)
files = trimRpms(files, cmds['excludes'])
pkgcount = len(files)
@@ -418,7 +418,7 @@
usage()
ts = rpm.TransactionSet()
- doPkgMetadata(cmds, ts)
+ doPkgMetadata(directory, cmds, ts)
doRepoMetadata(cmds)
if os.path.exists(os.path.join(cmds['basedir'], cmds['finaldir'])):