Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 158715 Details for
Bug 240112
[REGRESSION] 0.4.8 does not visit subdirs anymore
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fixes directory traversing regression introduced after createrepo 0.4.4
createrepo-0.4.10-dirwalker.patch (text/plain), 7.29 KB, created by
Enrico Scholz
on 2007-07-07 12:08:14 UTC
(
hide
)
Description:
fixes directory traversing regression introduced after createrepo 0.4.4
Filename:
MIME Type:
Creator:
Enrico Scholz
Created:
2007-07-07 12:08:14 UTC
Size:
7.29 KB
patch
obsolete
>2007-07-07 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> > > * genpkgmetadata.py: fixed regression when traversing repositories > with symlinks; there was added a new option '--skip-dirlinks' to > emulate behavior of createrepo 4.5+ > > This fixes traversing of deep directories structures too; > previously, e.g. only a/foo.rpm but not a/b/foo.rpm was > supported and later would fail with an exception. > > > I am not sure about the SplitMetaDataGenerator; semantic is > unclear and current 'createrepo' throws an exception when > testing it. > > * testsuite/symtest: script to test directory traversing; to be > called like > > | srcdir=<dir-with-genpkgmetadata> symtest > >--- createrepo-0.4.10/genpkgmetadata.py.dirwalker >+++ createrepo-0.4.10/genpkgmetadata.py >@@ -64,10 +64,35 @@ def usage(retval=1): > -p, --pretty = output xml files in pretty format. > --update = update existing metadata (if present) > -d, --database = generate the sqlite databases. >+ --skip-dirlinks = do not follow symbolic directory-links > """) > > sys.exit(retval) > >+class DirWalker: >+ def __init__(self, cmds, visitor): >+ self._visitor = visitor >+ self._cmds = cmds >+ >+ def run(self, startdir, priv=None): >+ >+ def visitor(args, dirname, names): >+ (self, basedir, walkdir, res, priv) = args >+ >+ for fn in names: >+ p = os.path.join(walkdir, dirname, fn) >+ >+ if not self._cmds['skip-dirlinks'] and os.path.isdir(p) and os.path.islink(p): >+ os.path.walk(p, visitor, (self, basedir, p, res, priv)) >+ >+ self._visitor((basedir, walkdir, res, priv), dirname, names) >+ >+ >+ res = [] >+ os.path.walk(startdir, visitor, (self, startdir, startdir, res, priv)) >+ >+ return res >+ > class MetaDataGenerator: > def __init__(self, cmds): > self.cmds = cmds >@@ -81,20 +106,22 @@ class MetaDataGenerator: > > extlen = len(ext) > >- def extension_visitor(filelist, dirname, names): >+ def extension_visitor(args, dirname, names): >+ (basedir, walkdir, filelist, priv) = args >+ > for fn in names: >- if os.path.isdir(fn): >+ p = os.path.join(walkdir, dirname, fn) >+ >+ if os.path.isdir(p): > continue >- if self.cmds['skip-symlinks'] and os.path.islink(fn): >+ if self.cmds['skip-symlinks'] and os.path.islink(p): > continue > elif fn[-extlen:].lower() == '%s' % (ext): >- relativepath = dirname.replace(startdir, "", 1) >- relativepath = relativepath.lstrip("/") >- filelist.append(os.path.join(relativepath,fn)) >+ filelist.append(p.replace(basedir, "", 1).lstrip("/")) > >- filelist = [] > startdir = os.path.join(basepath, directory) + '/' >- os.path.walk(startdir, extension_visitor, filelist) >+ filelist = DirWalker(self.cmds, extension_visitor).run(startdir) >+ > return filelist > > def checkTimeStamps(self, directory): >@@ -323,19 +350,20 @@ class SplitMetaDataGenerator(MetaDataGen > > extlen = len(ext) > >- def extension_visitor(arg, dirname, names): >+ def extension_visitor(args, dirname, names): >+ (basedir, walkdir, arg, priv) = args >+ > for fn in names: >- if os.path.isdir(fn): >+ p = os.path.join(walkdir, dirname, fn) >+ >+ if os.path.isdir(p): > continue > elif string.lower(fn[-extlen:]) == '%s' % (ext): >- reldir = os.path.basename(dirname) >- if reldir == os.path.basename(directory): >- reldir = "" >- arg.append(os.path.join(reldir,fn)) >+ arg.append(p.replace(basedir, "", 1).lstrip("/")) > >- rpmlist = [] > startdir = os.path.join(basepath, directory) >- os.path.walk(startdir, extension_visitor, rpmlist) >+ rpmlist = DirWalker(self.cmds, extension_visitor).run(startdir) >+ > return rpmlist > > def doPkgMetadata(self, directories): >@@ -414,6 +442,7 @@ def parseArgs(args): > cmds['file-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$'] > cmds['dir-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*'] > cmds['skip-symlinks'] = False >+ cmds['skip-dirlinks'] = False > > try: > gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:CS', ['help', 'exclude=', >@@ -421,7 +450,7 @@ def parseArgs(args): > 'baseurl=', 'groupfile=', 'checksum=', > 'version', 'pretty', 'split', 'outputdir=', > 'noepoch', 'checkts', 'database', 'update', >- 'skip-symlinks']) >+ 'skip-symlinks', 'skip-dirlinks']) > except getopt.error, e: > errorprint(_('Options Error: %s.') % e) > usage() >@@ -493,6 +522,8 @@ def parseArgs(args): > cmds['database'] = True > elif arg in ['-S', '--skip-symlinks']: > cmds['skip-symlinks'] = True >+ elif arg in ['--skip-dirlinks']: >+ cmds['skip-dirlinks'] = True > > except ValueError, e: > errorprint(_('Options Error: %s') % e) >--- createrepo-0.4.10/testsuite/symtest.dirwalker >+++ createrepo-0.4.10/testsuite/symtest >@@ -0,0 +1,87 @@ >+#! /bin/sh >+ >+function execute() { >+ num=$1 >+ shift >+ >+ PYTHONPATH=$srcdir python "$srcdir"/genpkgmetadata.py -v "$@" >+ >+ zgrep -q "packages=\"$num\"" repo/repodata/primary.xml.gz || { >+ echo "wrong number of packages" >+ return 1 >+ } >+ >+ find "$d" -name repodata | xargs rm -rf >+} >+ >+set -e >+srcdir=$(cd "${srcdir:-`pwd`/..}" && pwd) >+ >+ >+d=$(mktemp -d -t createrepo-test.XXXXXX) >+trap "rm -rf $d" EXIT >+ >+ >+mkdir $d/rpms >+ >+cd $d/rpms >+ln -s . noarch >+ >+cat <<EOF >dummy.spec >+Name: dummy >+Version: 0 >+Release: 0 >+Summary: none >+Group: none >+License: none >+BuildArch: noarch >+ >+%description >+EOF >+ >+for i in `seq -w 0 10`; do >+ cat <<EOF >>dummy.spec >+%package $i >+Group: none >+Summary: none >+%description $i >+%files $i >+EOF >+done >+ >+rpmbuild -bb dummy.spec \ >+ --define "_topdir `pwd`" --define "_rpmdir `pwd`" >/dev/null >+ >+RPMS=() >+for i in *.rpm; do >+ test -e "$i" || continue >+ RPMS=( "${RPMS[@]}" "$i" ) >+done >+ >+cd .. >+ >+mkdir -p repo/{a/b,c} link{0/a,1,2} >+ln -s ../link0 repo/B >+ln -s ../../link1 repo/a/A >+ln -s ../link2 repo/B/A >+ >+ln rpms/"${RPMS[0]}" repo/ >+ln -s ../rpms/"${RPMS[1]}" repo/ >+ln rpms/"${RPMS[2]}" repo/a/ >+ln -s ../../rpms/"${RPMS[3]}" repo/a/ >+ln rpms/"${RPMS[4]}" repo/a/b >+ln -s ../../../rpms/"${RPMS[5]}" repo/a/b/ >+ln rpms/"${RPMS[6]}" repo/B/ >+ln -s ../rpms/"${RPMS[7]}" repo/B/ >+ln rpms/"${RPMS[8]}" repo/B/A/ >+ln -s ../rpms/"${RPMS[9]}" repo/B/A/ >+ >+tree -aFl repo >+ >+execute 10 repo >+execute 10 --split repo >+ >+execute 6 --skip-dirlinks repo >+execute 5 --skip-symlinks repo >+ >+execute 3 --skip-symlinks --skip-dirlinks repo
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240112
: 158715